| Previous | 15994 Revisions | Next |
| r10887 Monday 21st March, 2011 at 07:17:02 UTC by Curt Coder |
|---|
| Synced with MAME. |
| [src/emu] | memory.c memory.h |
| [src/emu/cpu/hd6309] | 6309ops.c |
| [src/emu/cpu/konami] | konamops.c |
| [src/emu/cpu/m6800] | 6800ops.c |
| [src/emu/cpu/m6805] | 6805ops.c |
| [src/emu/cpu/m6809] | 6809ops.c m6809.c |
| [src/emu/cpu/pps4] | pps4.c |
| [src/emu/machine] | s3c2400.c s3c2410.c s3c2440.c |
| [src/emu/video] | resnet.h |
| [src/mame] | mamedriv.c |
| [src/mame/audio] | |
| [src/mame/drivers] | 5clown.c 8080bw.c acefruit.c adp.c asteroid.c astrocde.c atvtrack.c avt.c bingor.c blackt96.c blitz.c blitz68k.c buster.c bwing.c calchase.c carrera.c cb2001.c chsuper.c coinmstr.c coinmvga.c combatsc.c contra.c cubeqst.c cybertnk.c dgpix.c dmndrby.c drw80pkr.c esh.c ettrivia.c flower.c fortecar.c gal3.c galaga.c galaxian.c gamecstl.c gei.c goldngam.c goldnpkr.c gunpey.c hitpoker.c hotstuff.c hvyunit.c intrscti.c istellar.c itgambl2.c itgambl3.c jackpool.c jokrwild.c jubilee.c kingpin.c ksys573.c kungfur.c limenko.c ltcasino.c luckgrln.c m92.c magic10.c magicard.c magicfly.c mcr3.c megasys1.c midas.c mil4000.c miniboy7.c mirax.c murogem.c murogmbl.c namcona1.c namcos86.c naomi.c neoprint.c nmk16.c nsmpoker.c pachifev.c pcat_nit.c pcxt.c peplus.c photon2.c photoply.c pinkiri8.c pipeline.c pkscram.c play_1.c pntnpuzl.c poker72.c poo.c rbmk.c re900.c rgum.c rocnrope.c roul.c sfbonus.c shangkid.c skimaxx.c skylncr.c slotcarn.c sms.c sothello.c ssfindo.c st_mp200.c statriv2.c taito_f3.c tattack.c tgtpanic.c thayers.c thedeep.c tickee.c trvmadns.c ttchamp.c tugboat.c vamphalf.c vcombat.c vicdual.c videopkr.c vpoker.c vroulet.c wldarrow.c zaxxon.c |
| [src/mame/includes] | astrocde.h flower.h galaxian.h mcr3.h megasys1.h namcona1.h namcos86.h nmk16.h shangkid.h taito_f3.h thedeep.h |
| [src/mame/layout] | depthch.lay |
| [src/mame/machine] | |
| [src/mame/video] | astrocde.c bwing.c flower.c galaxian.c konamiic.c konicdev.c mcr3.c megasys1.c namcona1.c namcos86.c shangkid.c taito_f3.c thedeep.c |
| [src/mess/drivers] | vixen.c |
| r10886 | r10887 | |
|---|---|---|
| 1 | #include "emu.h" | |
| 2 | #include "sound/okim6295.h" | |
| 3 | #include "includes/toaplan2.h" | |
| 4 | ||
| 5 | /**************************************************************************** | |
| 6 | The Toaplan 2 hardware with V25 secondary CPU controls the sound through | |
| 7 | to a YM2151 and OKI M6295 on some boards. Here we just interpret some of | |
| 8 | commands sent to the V25, directly onto the OKI M6295 | |
| 9 | ||
| 10 | These tables convert commands sent from the main CPU, into sample numbers | |
| 11 | played back by the sound processor. | |
| 12 | The ADPCM ROMs contain intrument samples which are sequenced by the | |
| 13 | sound processor to create some of the backing tracks. This is beyond the | |
| 14 | scope of this playback file. Time would be better spent elsewhere. | |
| 15 | ****************************************************************************/ | |
| 16 | ||
| 17 | static const UINT8 fixeight_cmd_snd[128] = | |
| 18 | { | |
| 19 | /* Some sound commands are mixed with tones produced by the FM chip */ | |
| 20 | /* Probably 96(60H), 82(52H), 80(50H) and 70(46H) and maybe others */ | |
| 21 | /*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 22 | /*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 23 | /*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 24 | /*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 25 | /*20*/ 0x18, 0x3e, 0x37, 0x48, 0x38, 0x49, 0x4a, 0x4b, | |
| 26 | /*28*/ 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x53, 0x54, 0x51, | |
| 27 | /*30*/ 0x52, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, | |
| 28 | /*38*/ 0x07, 0x08, 0x00, 0x1b, 0x00, 0x43, 0x00, 0x00, | |
| 29 | /*40*/ 0x00, 0x47, 0x00, 0x3a, 0x44, 0x0a, 0x0a, 0x06, | |
| 30 | /*48*/ 0x3c, 0x46, 0x3f, 0x45, 0x00, 0x02, 0x04, 0x10, | |
| 31 | /*50*/ 0x0f, 0x11, 0x09, 0x0d, 0x0c, 0x0b, 0x00, 0x00, | |
| 32 | /*58*/ 0x00, 0x15, 0x3d, 0x3f, 0x1e, 0x1c, 0x19, 0x13, | |
| 33 | /*60*/ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 34 | /*68*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 35 | /*70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 36 | /*78*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
| 37 | }; | |
| 38 | ||
| 39 | static void play_oki_sound(okim6295_device *oki, int game_sound, int data) | |
| 40 | { | |
| 41 | int status = oki->read_status(); | |
| 42 | ||
| 43 | logerror("Playing sample %02x from command %02x\n",game_sound,data); | |
| 44 | ||
| 45 | if (game_sound != 0) | |
| 46 | { | |
| 47 | if ((status & 0x01) == 0) { | |
| 48 | oki->write_command(0x80 | game_sound); | |
| 49 | oki->write_command(0x11); | |
| 50 | } | |
| 51 | else if ((status & 0x02) == 0) { | |
| 52 | oki->write_command(0x80 | game_sound); | |
| 53 | oki->write_command(0x21); | |
| 54 | } | |
| 55 | else if ((status & 0x04) == 0) { | |
| 56 | oki->write_command(0x80 | game_sound); | |
| 57 | oki->write_command(0x41); | |
| 58 | } | |
| 59 | else if ((status & 0x08) == 0) { | |
| 60 | oki->write_command(0x80 | game_sound); | |
| 61 | oki->write_command(0x81); | |
| 62 | } | |
| 63 | } | |
| 64 | } | |
| 65 | ||
| 66 | void fixeight_okisnd_w(device_t *device, int data) | |
| 67 | { | |
| 68 | // popmessage("Writing %04x to Sound CPU",data); | |
| 69 | ||
| 70 | okim6295_device *oki = downcast<okim6295_device *>(device); | |
| 71 | if (data == 0) | |
| 72 | { | |
| 73 | oki->write_command(0x78); /* Stop playing effects */ | |
| 74 | } | |
| 75 | else if ((data > 0) && (data < 128)) | |
| 76 | { | |
| 77 | play_oki_sound(oki, fixeight_cmd_snd[data], data); | |
| 78 | } | |
| 79 | } |
| r10886 | r10887 | |
|---|---|---|
| 1 | #include "emu.h" | |
| 2 | #include "machine/ms32crpt.h" | |
| 3 | ||
| 4 | ||
| 5 | /********** DECRYPT **********/ | |
| 6 | ||
| 7 | /* 4 known types */ | |
| 8 | ||
| 9 | /* SS91022-10: desertwr, gratiaa, tp2m32, gametngk */ | |
| 10 | ||
| 11 | /* SS92046_01: bbbxing, f1superb, tetrisp, hayaosi2 */ | |
| 12 | ||
| 13 | /* SS92047-01: gratia, kirarast */ | |
| 14 | ||
| 15 | /* SS92048-01: p47aces, 47pie2, 47pie2o */ | |
| 16 | ||
| 17 | void ms32_rearrange_sprites(running_machine *machine, const char *region) | |
| 18 | { | |
| 19 | /* sprites are not encrypted, but we need to move the data around to handle them as 256x256 tiles */ | |
| 20 | int i; | |
| 21 | UINT8 *source_data; | |
| 22 | int source_size; | |
| 23 | ||
| 24 | UINT8 *result_data; | |
| 25 | ||
| 26 | source_data = machine->region ( region )->base(); | |
| 27 | source_size = machine->region( region )->bytes(); | |
| 28 | ||
| 29 | result_data = auto_alloc_array(machine, UINT8, source_size); | |
| 30 | ||
| 31 | for(i=0; i<source_size; i++) | |
| 32 | { | |
| 33 | int j = (i & ~0x07f8) | ((i & 0x00f8) << 3) | ((i & 0x0700) >> 5); | |
| 34 | ||
| 35 | result_data[i] = source_data[j]; | |
| 36 | } | |
| 37 | ||
| 38 | memcpy (source_data, result_data, source_size); | |
| 39 | auto_free (machine, result_data); | |
| 40 | } | |
| 41 | ||
| 42 | ||
| 43 | void decrypt_ms32_tx(running_machine *machine, int addr_xor,int data_xor, const char *region) | |
| 44 | { | |
| 45 | int i; | |
| 46 | UINT8 *source_data; | |
| 47 | int source_size; | |
| 48 | ||
| 49 | UINT8 *result_data; | |
| 50 | ||
| 51 | source_data = machine->region ( region )->base(); | |
| 52 | source_size = machine->region( region )->bytes(); | |
| 53 | ||
| 54 | result_data = auto_alloc_array(machine, UINT8, source_size); | |
| 55 | ||
| 56 | addr_xor ^= 0x1005d; | |
| 57 | ||
| 58 | for(i=0; i<source_size; i++) | |
| 59 | { | |
| 60 | int j; | |
| 61 | ||
| 62 | /* two groups of cascading XORs for the address */ | |
| 63 | j = 0; | |
| 64 | i ^= addr_xor; | |
| 65 | ||
| 66 | if (BIT(i,18)) j ^= 0x40000; // 18 | |
| 67 | if (BIT(i,17)) j ^= 0x60000; // 17 | |
| 68 | if (BIT(i, 7)) j ^= 0x70000; // 16 | |
| 69 | if (BIT(i, 3)) j ^= 0x78000; // 15 | |
| 70 | if (BIT(i,14)) j ^= 0x7c000; // 14 | |
| 71 | if (BIT(i,13)) j ^= 0x7e000; // 13 | |
| 72 | if (BIT(i, 0)) j ^= 0x7f000; // 12 | |
| 73 | if (BIT(i,11)) j ^= 0x7f800; // 11 | |
| 74 | if (BIT(i,10)) j ^= 0x7fc00; // 10 | |
| 75 | ||
| 76 | if (BIT(i, 9)) j ^= 0x00200; // 9 | |
| 77 | if (BIT(i, 8)) j ^= 0x00300; // 8 | |
| 78 | if (BIT(i,16)) j ^= 0x00380; // 7 | |
| 79 | if (BIT(i, 6)) j ^= 0x003c0; // 6 | |
| 80 | if (BIT(i,12)) j ^= 0x003e0; // 5 | |
| 81 | if (BIT(i, 4)) j ^= 0x003f0; // 4 | |
| 82 | if (BIT(i,15)) j ^= 0x003f8; // 3 | |
| 83 | if (BIT(i, 2)) j ^= 0x003fc; // 2 | |
| 84 | if (BIT(i, 1)) j ^= 0x003fe; // 1 | |
| 85 | if (BIT(i, 5)) j ^= 0x003ff; // 0 | |
| 86 | ||
| 87 | i ^= addr_xor; | |
| 88 | ||
| 89 | /* simple XOR for the data */ | |
| 90 | result_data[i] = source_data[j] ^ (i & 0xff) ^ data_xor; | |
| 91 | } | |
| 92 | ||
| 93 | memcpy (source_data, result_data, source_size); | |
| 94 | auto_free (machine, result_data); | |
| 95 | } | |
| 96 | ||
| 97 | void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, const char *region) | |
| 98 | { | |
| 99 | int i; | |
| 100 | UINT8 *source_data; | |
| 101 | int source_size; | |
| 102 | ||
| 103 | UINT8 *result_data; | |
| 104 | ||
| 105 | source_data = machine->region ( region )->base(); | |
| 106 | source_size = machine->region( region )->bytes(); | |
| 107 | ||
| 108 | result_data = auto_alloc_array(machine, UINT8, source_size); | |
| 109 | ||
| 110 | addr_xor ^= 0xc1c5b; | |
| 111 | ||
| 112 | for(i=0; i<source_size; i++) | |
| 113 | { | |
| 114 | int j; | |
| 115 | ||
| 116 | /* two groups of cascading XORs for the address */ | |
| 117 | j = (i & ~0xfffff); /* top bits are not affected */ | |
| 118 | i ^= addr_xor; | |
| 119 | ||
| 120 | if (BIT(i,19)) j ^= 0x80000; // 19 | |
| 121 | if (BIT(i, 8)) j ^= 0xc0000; // 18 | |
| 122 | if (BIT(i,17)) j ^= 0xe0000; // 17 | |
| 123 | if (BIT(i, 2)) j ^= 0xf0000; // 16 | |
| 124 | if (BIT(i,15)) j ^= 0xf8000; // 15 | |
| 125 | if (BIT(i,14)) j ^= 0xfc000; // 14 | |
| 126 | if (BIT(i,13)) j ^= 0xfe000; // 13 | |
| 127 | if (BIT(i,12)) j ^= 0xff000; // 12 | |
| 128 | if (BIT(i, 1)) j ^= 0xff800; // 11 | |
| 129 | if (BIT(i,10)) j ^= 0xffc00; // 10 | |
| 130 | ||
| 131 | if (BIT(i, 9)) j ^= 0x00200; // 9 | |
| 132 | if (BIT(i, 3)) j ^= 0x00300; // 8 | |
| 133 | if (BIT(i, 7)) j ^= 0x00380; // 7 | |
| 134 | if (BIT(i, 6)) j ^= 0x003c0; // 6 | |
| 135 | if (BIT(i, 5)) j ^= 0x003e0; // 5 | |
| 136 | if (BIT(i, 4)) j ^= 0x003f0; // 4 | |
| 137 | if (BIT(i,18)) j ^= 0x003f8; // 3 | |
| 138 | if (BIT(i,16)) j ^= 0x003fc; // 2 | |
| 139 | if (BIT(i,11)) j ^= 0x003fe; // 1 | |
| 140 | if (BIT(i, 0)) j ^= 0x003ff; // 0 | |
| 141 | ||
| 142 | i ^= addr_xor; | |
| 143 | ||
| 144 | /* simple XOR for the data */ | |
| 145 | result_data[i] = source_data[j] ^ (i & 0xff) ^ data_xor; | |
| 146 | } | |
| 147 | ||
| 148 | memcpy (source_data, result_data, source_size); | |
| 149 | auto_free (machine, result_data); | |
| 150 | } |
| r10886 | r10887 | |
|---|---|---|
| 1 | void ms32_rearrange_sprites(running_machine *machine, const char *region); | |
| 2 | void decrypt_ms32_tx(running_machine *machine, int addr_xor,int data_xor, const char *region); | |
| 3 | void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, const char *region); |
| r10886 | r10887 | |
|---|---|---|
| 5523 | 5523 | DRIVER( mastkin ) /* (c) 1988 Du Tech */ |
| 5524 | 5524 | DRIVER( rocnrope ) /* GX364 (c) 1983 */ |
| 5525 | 5525 | DRIVER( rocnropek ) /* GX364 (c) 1983 + Kosuka */ |
| 5526 | DRIVER( ropeman ) /* (c) 1983 bootleg */ | |
| 5526 | 5527 | DRIVER( circusc ) /* GX380 (c) 1984 */ |
| 5527 | 5528 | DRIVER( circusc2 ) /* GX380 (c) 1984 */ |
| 5528 | 5529 | DRIVER( circusc3 ) /* GX380 (c) 1984 */ |
| r10886 | r10887 | |
| 7880 | 7881 | |
| 7881 | 7882 | /* SH-4 hardware */ |
| 7882 | 7883 | DRIVER( atvtrack ) /* (c) 2002 - Ref 020419 */ |
| 7884 | DRIVER( atvtracka ) /* (c) 2002 - Ref 020419 */ | |
| 7883 | 7885 | |
| 7884 | 7886 | /* |
| 7885 | 7887 | Remaining Gaelco Games: |
| r10886 | r10887 | |
| 7895 | 7897 | /* Kaneko games */ |
| 7896 | 7898 | DRIVER( hvyunit ) /* (c) 1988 Kaneko */ |
| 7897 | 7899 | DRIVER( hvyunitj ) /* (c) 1988 Kaneko */ |
| 7898 | DRIVER( hvyunito ) /* (c) 1988 Kaneko */ | |
| 7900 | DRIVER( hvyunitjo ) /* (c) 1988 Kaneko */ | |
| 7901 | DRIVER( hvyunitu ) /* (c) 1988 Kaneko */ | |
| 7899 | 7902 | DRIVER( djboy ) /* (c) 1989 Kaneko */ |
| 7900 | 7903 | DRIVER( djboyj ) /* (c) 1989 Kaneko */ |
| 7901 | 7904 | DRIVER( djboya ) /* (c) 1989 Kaneko */ |
| r10886 | r10887 | |
|---|---|---|
| 37 | 37 | UINT16 vscroll[4]; |
| 38 | 38 | UINT8 *spriteram; |
| 39 | 39 | size_t spriteram_size; |
| 40 | int prot_count; | |
| 41 | UINT8 input_pressed; | |
| 42 | UINT8 start_helper; | |
| 43 | UINT8 coin_count[2]; | |
| 44 | UINT8 coin_count_frac[2]; | |
| 40 | 45 | }; |
| 41 | 46 | |
| 42 | 47 |
| r10886 | r10887 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | UINT8 *videoram; |
| 8 | 8 | UINT8 *spriteram; |
| 9 | UINT8 bbx_sound_enable; | |
| 10 | UINT8 sound_latch; | |
| 11 | UINT8 *videoreg; | |
| 12 | int gfx_type; | |
| 13 | tilemap_t *background; | |
| 9 | 14 | }; |
| 10 | 15 | |
| 11 | 16 | |
| 12 | 17 | /*----------- defined in video/shangkid.c -----------*/ |
| 13 | 18 | |
| 14 | extern UINT8 *shangkid_videoreg; | |
| 15 | extern int shangkid_gfx_type; | |
| 16 | ||
| 17 | 19 | VIDEO_START( shangkid ); |
| 18 | 20 | SCREEN_UPDATE( shangkid ); |
| 19 | 21 | WRITE8_HANDLER( shangkid_videoram_w ); |
| r10886 | r10887 | |
|---|---|---|
| 1 | class namcona1_state : public driver_device | |
| 2 | { | |
| 3 | public: | |
| 4 | namcona1_state(running_machine &machine, const driver_device_config_base &config) | |
| 5 | : driver_device(machine, config) { } | |
| 6 | ||
| 7 | UINT16 *videoram; | |
| 8 | UINT16 *spriteram; | |
| 9 | }; | |
| 10 | ||
| 11 | ||
| 12 | /*----------- defined in video/namcona1.c -----------*/ | |
| 13 | ||
| 14 | 1 | enum |
| 15 | 2 | { |
| 16 | 3 | NAMCO_CGANGPZL, |
| r10886 | r10887 | |
| 27 | 14 | }; |
| 28 | 15 | |
| 29 | 16 | #define NA1_NVRAM_SIZE (0x800) |
| 17 | #define NAMCONA1_NUM_TILEMAPS 4 | |
| 30 | 18 | |
| 31 | extern UINT16 *namcona1_workram; | |
| 32 | extern UINT16 *namcona1_vreg; | |
| 33 | extern UINT16 *namcona1_scroll; | |
| 19 | class namcona1_state : public driver_device | |
| 20 | { | |
| 21 | public: | |
| 22 | namcona1_state(running_machine &machine, const driver_device_config_base &config) | |
| 23 | : driver_device(machine, config) { } | |
| 34 | 24 | |
| 25 | UINT16 *videoram; | |
| 26 | UINT16 *spriteram; | |
| 27 | UINT16 *mpBank0; | |
| 28 | UINT16 *mpBank1; | |
| 29 | int mEnableInterrupts; | |
| 30 | int gametype; | |
| 31 | UINT8 nvmem[NA1_NVRAM_SIZE]; | |
| 32 | UINT16 count; | |
| 33 | UINT32 keyval; | |
| 34 | UINT16 mcu_mailbox[8]; | |
| 35 | UINT8 mcu_port4; | |
| 36 | UINT8 mcu_port5; | |
| 37 | UINT8 mcu_port6; | |
| 38 | UINT8 mcu_port8; | |
| 39 | UINT16 *workram; | |
| 40 | UINT16 *vreg; | |
| 41 | UINT16 *scroll; | |
| 42 | UINT16 *shaperam; | |
| 43 | UINT16 *cgram; | |
| 44 | tilemap_t *roz_tilemap; | |
| 45 | int roz_palette; | |
| 46 | tilemap_t *bg_tilemap[NAMCONA1_NUM_TILEMAPS]; | |
| 47 | int tilemap_palette_bank[NAMCONA1_NUM_TILEMAPS]; | |
| 48 | int palette_is_dirty; | |
| 49 | UINT8 mask_data[8]; | |
| 50 | UINT8 conv_data[9]; | |
| 51 | }; | |
| 52 | ||
| 53 | ||
| 54 | /*----------- defined in video/namcona1.c -----------*/ | |
| 55 | ||
| 56 | ||
| 35 | 57 | extern WRITE16_HANDLER( namcona1_videoram_w ); |
| 36 | 58 | extern READ16_HANDLER( namcona1_videoram_r ); |
| 37 | 59 |
| r10886 | r10887 | |
|---|---|---|
| 7 | 7 | UINT8 *videoram; |
| 8 | 8 | UINT8 *spriteram; |
| 9 | 9 | size_t spriteram_size; |
| 10 | UINT8 input_mux; | |
| 11 | UINT8 latched_input; | |
| 12 | UINT8 last_op4; | |
| 13 | UINT8 maxrpm_adc_control; | |
| 14 | UINT8 maxrpm_adc_select; | |
| 15 | UINT8 maxrpm_last_shift; | |
| 16 | INT8 maxrpm_p1_shift; | |
| 17 | INT8 maxrpm_p2_shift; | |
| 18 | UINT8 spyhunt_sprite_color_mask; | |
| 19 | INT16 spyhunt_scroll_offset; | |
| 20 | UINT8 *spyhunt_alpharam; | |
| 21 | INT16 spyhunt_scrollx; | |
| 22 | INT16 spyhunt_scrolly; | |
| 23 | tilemap_t *bg_tilemap; | |
| 24 | tilemap_t *alpha_tilemap; | |
| 10 | 25 | }; |
| 11 | 26 | |
| 12 | 27 | |
| 13 | 28 | /*----------- defined in video/mcr3.c -----------*/ |
| 14 | 29 | |
| 15 | extern UINT8 spyhunt_sprite_color_mask; | |
| 16 | extern INT16 spyhunt_scroll_offset; | |
| 17 | ||
| 18 | extern UINT8 *spyhunt_alpharam; | |
| 19 | ||
| 20 | 30 | WRITE8_HANDLER( mcr3_paletteram_w ); |
| 21 | 31 | WRITE8_HANDLER( mcr3_videoram_w ); |
| 22 | 32 | WRITE8_HANDLER( spyhunt_videoram_w ); |
| r10886 | r10887 | |
|---|---|---|
| 5 | 5 | : driver_device(machine, config) { } |
| 6 | 6 | |
| 7 | 7 | UINT8 *spriteram; |
| 8 | int wdog; | |
| 9 | UINT8 *rthunder_videoram1; | |
| 10 | UINT8 *rthunder_videoram2; | |
| 11 | UINT8 *rthunder_spriteram; | |
| 12 | int tilebank; | |
| 13 | int xscroll[4]; | |
| 14 | int yscroll[4]; | |
| 15 | tilemap_t *bg_tilemap[4]; | |
| 16 | int backcolor; | |
| 17 | const UINT8 *tile_address_prom; | |
| 18 | int copy_sprites; | |
| 8 | 19 | }; |
| 9 | 20 | |
| 10 | 21 | |
| 11 | 22 | /*----------- defined in video/namcos86.c -----------*/ |
| 12 | 23 | |
| 13 | extern UINT8 *rthunder_videoram1, *rthunder_videoram2, *rthunder_spriteram; | |
| 14 | ||
| 15 | 24 | PALETTE_INIT( namcos86 ); |
| 16 | 25 | VIDEO_START( namcos86 ); |
| 17 | 26 | SCREEN_UPDATE( namcos86 ); |
| r10886 | r10887 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | extern UINT8 galaxian_frogger_adjust; |
| 44 | 44 | extern UINT8 galaxian_sfx_tilemap; |
| 45 | extern UINT8 galaxian_sprite_clip_start; | |
| 46 | extern UINT8 galaxian_sprite_clip_end; | |
| 47 | 45 | |
| 48 | 46 | PALETTE_INIT( galaxian ); |
| 49 | 47 | PALETTE_INIT( moonwar ); |
| r10886 | r10887 | |
|---|---|---|
| 7 | 7 | : driver_device(machine, config) { } |
| 8 | 8 | |
| 9 | 9 | UINT8 *spriteram; |
| 10 | UINT8 *sn_irq_enable; | |
| 11 | UINT8 *sn_nmi_enable; | |
| 12 | UINT8 *textram; | |
| 13 | UINT8 *bg0ram; | |
| 14 | UINT8 *bg1ram; | |
| 15 | UINT8 *bg0_scroll; | |
| 16 | UINT8 *bg1_scroll; | |
| 17 | tilemap_t *bg0_tilemap; | |
| 18 | tilemap_t *bg1_tilemap; | |
| 19 | tilemap_t *text_tilemap; | |
| 20 | tilemap_t *text_right_tilemap; | |
| 10 | 21 | }; |
| 11 | 22 | |
| 12 | 23 | |
| r10886 | r10887 | |
| 20 | 31 | |
| 21 | 32 | /*----------- defined in video/flower.c -----------*/ |
| 22 | 33 | |
| 23 | extern UINT8 *flower_textram, *flower_bg0ram, *flower_bg1ram, *flower_bg0_scroll, *flower_bg1_scroll; | |
| 24 | ||
| 25 | 34 | WRITE8_HANDLER( flower_textram_w ); |
| 26 | 35 | WRITE8_HANDLER( flower_bg0ram_w ); |
| 27 | 36 | WRITE8_HANDLER( flower_bg1ram_w ); |
| r10886 | r10887 | |
|---|---|---|
| 9 | 9 | #define AC_SOUND_PRESENT (0x01) |
| 10 | 10 | #define AC_LIGHTPEN_INTS (0x02) |
| 11 | 11 | #define AC_STARS (0x04) |
| 12 | #define AC_MONITOR_BW (0x08) | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | class astrocde_state : public driver_device |
| r10886 | r10887 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | UINT8 *spriteram; |
| 8 | 8 | size_t spriteram_size; |
| 9 | int nmi_enable; | |
| 10 | UINT8 protection_command; | |
| 11 | UINT8 protection_data; | |
| 12 | int protection_index; | |
| 13 | int protection_irq; | |
| 14 | int rombank; | |
| 15 | UINT8 *vram_0; | |
| 16 | UINT8 *vram_1; | |
| 17 | UINT8 *scroll; | |
| 18 | UINT8 *scroll2; | |
| 19 | tilemap_t *tilemap_0; | |
| 20 | tilemap_t *tilemap_1; | |
| 9 | 21 | }; |
| 10 | 22 | |
| 11 | 23 | |
| 12 | 24 | /*----------- defined in video/thedeep.c -----------*/ |
| 13 | 25 | |
| 14 | extern UINT8 *thedeep_vram_0, *thedeep_vram_1; | |
| 15 | extern UINT8 *thedeep_scroll, *thedeep_scroll2; | |
| 16 | ||
| 17 | 26 | WRITE8_HANDLER( thedeep_vram_0_w ); |
| 18 | 27 | WRITE8_HANDLER( thedeep_vram_1_w ); |
| 19 | 28 |
| r10886 | r10887 | |
|---|---|---|
| 48 | 48 | UINT32 *videoram; |
| 49 | 49 | UINT32 *spriteram; |
| 50 | 50 | size_t spriteram_size; |
| 51 | UINT32 coin_word[2]; | |
| 52 | UINT32 *f3_ram; | |
| 53 | int f3_game; | |
| 54 | UINT32 *f3_vram; | |
| 55 | UINT32 *f3_line_ram; | |
| 56 | UINT32 *f3_pf_data; | |
| 57 | UINT32 *f3_pivot_ram; | |
| 58 | tilemap_t *pf1_tilemap; | |
| 59 | tilemap_t *pf2_tilemap; | |
| 60 | tilemap_t *pf3_tilemap; | |
| 61 | tilemap_t *pf4_tilemap; | |
| 62 | tilemap_t *pixel_layer; | |
| 63 | tilemap_t *vram_layer; | |
| 64 | UINT32 *spriteram32_buffered; | |
| 65 | UINT32 f3_control_0[8]; | |
| 66 | UINT32 f3_control_1[8]; | |
| 67 | int flipscreen; | |
| 68 | UINT8 sprite_extra_planes; | |
| 69 | UINT8 sprite_pen_mask; | |
| 70 | UINT32 *f3_pf_data_1; | |
| 71 | UINT32 *f3_pf_data_2; | |
| 72 | UINT32 *f3_pf_data_3; | |
| 73 | UINT32 *f3_pf_data_4; | |
| 74 | int f3_skip_this_frame; | |
| 75 | int sprite_lag; | |
| 76 | UINT8 sprite_pri_usage; | |
| 77 | bitmap_t *pri_alp_bitmap; | |
| 78 | int f3_alpha_level_2as; | |
| 79 | int f3_alpha_level_2ad; | |
| 80 | int f3_alpha_level_3as; | |
| 81 | int f3_alpha_level_3ad; | |
| 82 | int f3_alpha_level_2bs; | |
| 83 | int f3_alpha_level_2bd; | |
| 84 | int f3_alpha_level_3bs; | |
| 85 | int f3_alpha_level_3bd; | |
| 86 | int alpha_level_last; | |
| 87 | int width_mask; | |
| 88 | int twidth_mask; | |
| 89 | int twidth_mask_bit; | |
| 90 | UINT8 *tile_opaque_sp; | |
| 91 | UINT8 *tile_opaque_pf[4]; | |
| 92 | UINT8 add_sat[256][256]; | |
| 93 | int alpha_s_1_1; | |
| 94 | int alpha_s_1_2; | |
| 95 | int alpha_s_1_4; | |
| 96 | int alpha_s_1_5; | |
| 97 | int alpha_s_1_6; | |
| 98 | int alpha_s_1_8; | |
| 99 | int alpha_s_1_9; | |
| 100 | int alpha_s_1_a; | |
| 101 | int alpha_s_2a_0; | |
| 102 | int alpha_s_2a_4; | |
| 103 | int alpha_s_2a_8; | |
| 104 | int alpha_s_2b_0; | |
| 105 | int alpha_s_2b_4; | |
| 106 | int alpha_s_2b_8; | |
| 107 | int alpha_s_3a_0; | |
| 108 | int alpha_s_3a_1; | |
| 109 | int alpha_s_3a_2; | |
| 110 | int alpha_s_3b_0; | |
| 111 | int alpha_s_3b_1; | |
| 112 | int alpha_s_3b_2; | |
| 113 | UINT32 dval; | |
| 114 | UINT8 pval; | |
| 115 | UINT8 tval; | |
| 116 | UINT8 pdest_2a; | |
| 117 | UINT8 pdest_2b; | |
| 118 | int tr_2a; | |
| 119 | int tr_2b; | |
| 120 | UINT8 pdest_3a; | |
| 121 | UINT8 pdest_3b; | |
| 122 | int tr_3a; | |
| 123 | int tr_3b; | |
| 124 | UINT16 *src0; | |
| 125 | UINT16 *src_s0; | |
| 126 | UINT16 *src_e0; | |
| 127 | UINT16 clip_al0; | |
| 128 | UINT16 clip_ar0; | |
| 129 | UINT16 clip_bl0; | |
| 130 | UINT16 clip_br0; | |
| 131 | UINT8 *tsrc0; | |
| 132 | UINT8 *tsrc_s0; | |
| 133 | UINT32 x_count0; | |
| 134 | UINT32 x_zoom0; | |
| 135 | UINT16 *src1; | |
| 136 | UINT16 *src_s1; | |
| 137 | UINT16 *src_e1; | |
| 138 | UINT16 clip_al1; | |
| 139 | UINT16 clip_ar1; | |
| 140 | UINT16 clip_bl1; | |
| 141 | UINT16 clip_br1; | |
| 142 | UINT8 *tsrc1; | |
| 143 | UINT8 *tsrc_s1; | |
| 144 | UINT32 x_count1; | |
| 145 | UINT32 x_zoom1; | |
| 146 | UINT16 *src2; | |
| 147 | UINT16 *src_s2; | |
| 148 | UINT16 *src_e2; | |
| 149 | UINT16 clip_al2; | |
| 150 | UINT16 clip_ar2; | |
| 151 | UINT16 clip_bl2; | |
| 152 | UINT16 clip_br2; | |
| 153 | UINT8 *tsrc2; | |
| 154 | UINT8 *tsrc_s2; | |
| 155 | UINT32 x_count2; | |
| 156 | UINT32 x_zoom2; | |
| 157 | UINT16 *src3; | |
| 158 | UINT16 *src_s3; | |
| 159 | UINT16 *src_e3; | |
| 160 | UINT16 clip_al3; | |
| 161 | UINT16 clip_ar3; | |
| 162 | UINT16 clip_bl3; | |
| 163 | UINT16 clip_br3; | |
| 164 | UINT8 *tsrc3; | |
| 165 | UINT8 *tsrc_s3; | |
| 166 | UINT32 x_count3; | |
| 167 | UINT32 x_zoom3; | |
| 168 | UINT16 *src4; | |
| 169 | UINT16 *src_s4; | |
| 170 | UINT16 *src_e4; | |
| 171 | UINT16 clip_al4; | |
| 172 | UINT16 clip_ar4; | |
| 173 | UINT16 clip_bl4; | |
| 174 | UINT16 clip_br4; | |
| 175 | UINT8 *tsrc4; | |
| 176 | UINT8 *tsrc_s4; | |
| 177 | UINT32 x_count4; | |
| 178 | UINT32 x_zoom4; | |
| 179 | struct tempsprite *spritelist; | |
| 180 | const struct tempsprite *sprite_end; | |
| 181 | struct f3_playfield_line_inf *pf_line_inf; | |
| 182 | struct f3_spritealpha_line_inf *sa_line_inf; | |
| 183 | const struct F3config *f3_game_config; | |
| 184 | int (*dpix_n[8][16])(taito_f3_state *state, UINT32 s_pix); | |
| 185 | int (**dpix_lp[5])(taito_f3_state *state, UINT32 s_pix); | |
| 186 | int (**dpix_sp[9])(taito_f3_state *state, UINT32 s_pix); | |
| 51 | 187 | }; |
| 52 | 188 | |
| 53 | 189 | |
| 54 | /*----------- defined in drivers/taito_f3.c -----------*/ | |
| 55 | ||
| 56 | extern int f3_game; | |
| 57 | ||
| 58 | 190 | /*----------- defined in video/taito_f3.c -----------*/ |
| 59 | 191 | |
| 60 | extern UINT32 *f3_vram,*f3_line_ram; | |
| 61 | extern UINT32 *f3_pf_data,*f3_pivot_ram; | |
| 62 | ||
| 63 | 192 | VIDEO_START( f3 ); |
| 64 | 193 | SCREEN_UPDATE( f3 ); |
| 65 | 194 | SCREEN_EOF( f3 ); |
| r10886 | r10887 | |
|---|---|---|
| 14 | 14 | ***************************************************************************/ |
| 15 | 15 | |
| 16 | 16 | |
| 17 | /*************************************************************************** | |
| 18 | ||
| 19 | Scrolling Layers Handling | |
| 20 | ||
| 21 | ***************************************************************************/ | |
| 22 | ||
| 23 | 17 | class megasys1_state : public driver_device |
| 24 | 18 | { |
| 25 | 19 | public: |
| r10886 | r10887 | |
| 27 | 21 | : driver_device(machine, config) { } |
| 28 | 22 | |
| 29 | 23 | UINT16 *spriteram; |
| 24 | UINT16 ip_select; | |
| 25 | UINT16 ip_select_values[5]; | |
| 26 | UINT8 ignore_oki_status; | |
| 27 | UINT16 protection_val; | |
| 28 | int bank; | |
| 29 | UINT16 *scrollram[3]; | |
| 30 | UINT16 *objectram; | |
| 31 | UINT16 *vregs; | |
| 32 | UINT16 *ram; | |
| 33 | int scrollx[3]; | |
| 34 | int scrolly[3]; | |
| 35 | int active_layers; | |
| 36 | int bits_per_color_code; | |
| 37 | int scroll_flag[3]; | |
| 38 | int sprite_bank; | |
| 39 | int screen_flag; | |
| 40 | int sprite_flag; | |
| 41 | int _8x8_scroll_factor[3]; | |
| 42 | int _16x16_scroll_factor[3]; | |
| 43 | tilemap_t *tmap[3]; | |
| 44 | tilemap_t *tilemap[3][2][4]; | |
| 45 | int hardware_type_z; | |
| 46 | UINT16 *buffer_objectram; | |
| 47 | UINT16 *buffer2_objectram; | |
| 48 | UINT16 *buffer_spriteram16; | |
| 49 | UINT16 *buffer2_spriteram16; | |
| 50 | int layers_order[16]; | |
| 30 | 51 | }; |
| 31 | 52 | |
| 32 | 53 | |
| 33 | 54 | /*----------- defined in video/megasys1.c -----------*/ |
| 34 | 55 | |
| 35 | /* Variables */ | |
| 36 | extern UINT16 *megasys1_scrollram[3]; | |
| 37 | extern UINT16 *megasys1_objectram, *megasys1_vregs, *megasys1_ram; | |
| 38 | ||
| 39 | ||
| 40 | /* Functions */ | |
| 41 | 56 | VIDEO_START( megasys1 ); |
| 42 | 57 | SCREEN_UPDATE( megasys1 ); |
| 43 | 58 | SCREEN_EOF( megasys1 ); |
| r10886 | r10887 | |
|---|---|---|
| 4 | 4 | #include "cpu/z80/z80.h" |
| 5 | 5 | #include "includes/shangkid.h" |
| 6 | 6 | |
| 7 | static tilemap_t *background; | |
| 8 | UINT8 *shangkid_videoreg; | |
| 9 | int shangkid_gfx_type; | |
| 10 | 7 | |
| 11 | ||
| 12 | ||
| 13 | 8 | static TILE_GET_INFO( get_bg_tile_info ){ |
| 14 | 9 | shangkid_state *state = machine->driver_data<shangkid_state>(); |
| 15 | 10 | UINT8 *videoram = state->videoram; |
| r10886 | r10887 | |
| 17 | 12 | int tile_number = videoram[tile_index]+0x100*(attributes&0x3); |
| 18 | 13 | int color; |
| 19 | 14 | |
| 20 | if( s | |
| 15 | if( state-> | |
| 21 | 16 | { |
| 22 | 17 | /* Shanghai Kid: |
| 23 | 18 | ------xx bank |
| r10886 | r10887 | |
| 53 | 48 | |
| 54 | 49 | VIDEO_START( shangkid ) |
| 55 | 50 | { |
| 56 | background = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32); | |
| 51 | shangkid_state *state = machine->driver_data<shangkid_state>(); | |
| 52 | state->background = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32); | |
| 57 | 53 | } |
| 58 | 54 | |
| 59 | 55 | WRITE8_HANDLER( shangkid_videoram_w ) |
| r10886 | r10887 | |
| 61 | 57 | shangkid_state *state = space->machine->driver_data<shangkid_state>(); |
| 62 | 58 | UINT8 *videoram = state->videoram; |
| 63 | 59 | videoram[offset] = data; |
| 64 | tilemap_mark_tile_dirty( background, offset&0x7ff ); | |
| 60 | tilemap_mark_tile_dirty( state->background, offset&0x7ff ); | |
| 65 | 61 | } |
| 66 | 62 | |
| 67 | 63 | static void draw_sprite(running_machine *machine, const UINT8 *source, bitmap_t *bitmap, const rectangle *cliprect) |
| 68 | 64 | { |
| 65 | shangkid_state *state = machine->driver_data<shangkid_state>(); | |
| 69 | 66 | const gfx_element *gfx; |
| 70 | 67 | int transparent_pen; |
| 71 | 68 | int bank_index; |
| r10886 | r10887 | |
| 89 | 86 | if( xsize==0 && xflip ) xpos -= 16; |
| 90 | 87 | if( ysize==0 && yflip==0 ) ypos += 16; |
| 91 | 88 | |
| 92 | if( s | |
| 89 | if( state-> | |
| 93 | 90 | { |
| 94 | 91 | /* Shanghai Kid */ |
| 95 | 92 | switch( bank&0x30 ) |
| r10886 | r10887 | |
| 190 | 187 | |
| 191 | 188 | SCREEN_UPDATE( shangkid ) |
| 192 | 189 | { |
| 193 | int flipscreen = shangkid_videoreg[1]&0x80; | |
| 194 | tilemap_set_flip( background, flipscreen?(TILEMAP_FLIPX|TILEMAP_FLIPY):0 ); | |
| 195 | tilemap_set_scrollx( background,0,shangkid_videoreg[0]-40 ); | |
| 196 | tilemap_set_scrolly( background,0,shangkid_videoreg[2]+0x10 ); | |
| 190 | shangkid_state *state = screen->machine->driver_data<shangkid_state>(); | |
| 191 | int flipscreen = state->videoreg[1]&0x80; | |
| 192 | tilemap_set_flip( state->background, flipscreen?(TILEMAP_FLIPX|TILEMAP_FLIPY):0 ); | |
| 193 | tilemap_set_scrollx( state->background,0,state->videoreg[0]-40 ); | |
| 194 | tilemap_set_scrolly( state->background,0,state->videoreg[2]+0x10 ); | |
| 197 | 195 | |
| 198 | tilemap_draw( bitmap,cliprect,background,0,0 ); | |
| 196 | tilemap_draw( bitmap,cliprect,state->background,0,0 ); | |
| 199 | 197 | shangkid_draw_sprites(screen->machine, bitmap,cliprect ); |
| 200 | tilemap_draw( bitmap,cliprect,background,1,0 ); /* high priority tiles */ | |
| 198 | tilemap_draw( bitmap,cliprect,state->background,1,0 ); /* high priority tiles */ | |
| 201 | 199 | return 0; |
| 202 | 200 | } |
| 203 | 201 |
| r10886 | r10887 | |
|---|---|---|
| 9 | 9 | #include "emu.h" |
| 10 | 10 | #include "includes/namcona1.h" |
| 11 | 11 | |
| 12 | #define NAMCONA1_NUM_TILEMAPS 4 | |
| 13 | 12 | |
| 14 | /* public variables */ | |
| 15 | UINT16 *namcona1_vreg; | |
| 16 | UINT16 *namcona1_scroll; | |
| 17 | UINT16 *namcona1_workram; | |
| 18 | //UINT16 *namcona1_sparevram; | |
| 19 | //UINT16 *namcona1_pixmap; | |
| 20 | ||
| 21 | /* private variables */ | |
| 22 | static UINT16 *shaperam; | |
| 23 | static UINT16 *cgram; | |
| 24 | static tilemap_t *roz_tilemap; | |
| 25 | static int roz_palette; | |
| 26 | static tilemap_t *bg_tilemap[NAMCONA1_NUM_TILEMAPS]; | |
| 27 | static int tilemap_palette_bank[NAMCONA1_NUM_TILEMAPS]; | |
| 28 | static int palette_is_dirty; | |
| 29 | ||
| 30 | 13 | static void tilemap_get_info( |
| 31 | 14 | running_machine *machine, |
| 32 | 15 | tile_data *tileinfo, |
| r10886 | r10887 | |
| 35 | 18 | int tilemap_color, |
| 36 | 19 | int use_4bpp_gfx ) |
| 37 | 20 | { |
| 21 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 38 | 22 | UINT16 *source; |
| 39 | static UINT8 mask_data[8]; | |
| 40 | 23 | |
| 41 | 24 | int data = tilemap_videoram[tile_index]; |
| 42 | 25 | int tile = data&0xfff; |
| r10886 | r10887 | |
| 61 | 44 | { |
| 62 | 45 | SET_TILE_INFO( gfx,tile,tilemap_color,0 ); |
| 63 | 46 | if (ENDIANNESS_NATIVE == ENDIANNESS_BIG) |
| 64 | tileinfo->mask_data = (UINT8 *)(shaperam+4*tile); | |
| 47 | tileinfo->mask_data = (UINT8 *)(state->shaperam+4*tile); | |
| 65 | 48 | else |
| 66 | 49 | { |
| 67 | source = shaperam+4*tile; | |
| 50 | UINT8 *mask_data = state->mask_data; | |
| 51 | source = state->shaperam+4*tile; | |
| 68 | 52 | mask_data[0] = source[0]>>8; |
| 69 | 53 | mask_data[1] = source[0]&0xff; |
| 70 | 54 | mask_data[2] = source[1]>>8; |
| r10886 | r10887 | |
| 82 | 66 | { |
| 83 | 67 | namcona1_state *state = machine->driver_data<namcona1_state>(); |
| 84 | 68 | UINT16 *videoram = state->videoram; |
| 85 | tilemap_get_info(machine,tileinfo,tile_index,0*0x1000+videoram,tilemap_palette_bank[0], | |
| 69 | tilemap_get_info(machine,tileinfo,tile_index,0*0x1000+videoram,state->tilemap_palette_bank[0],state-> | |
| 86 | 70 | } |
| 87 | 71 | |
| 88 | 72 | static TILE_GET_INFO( tilemap_get_info1 ) |
| 89 | 73 | { |
| 90 | 74 | namcona1_state *state = machine->driver_data<namcona1_state>(); |
| 91 | 75 | UINT16 *videoram = state->videoram; |
| 92 | tilemap_get_info(machine,tileinfo,tile_index,1*0x1000+videoram,tilemap_palette_bank[1], | |
| 76 | tilemap_get_info(machine,tileinfo,tile_index,1*0x1000+videoram,state->tilemap_palette_bank[1],state-> | |
| 93 | 77 | } |
| 94 | 78 | |
| 95 | 79 | static TILE_GET_INFO( tilemap_get_info2 ) |
| 96 | 80 | { |
| 97 | 81 | namcona1_state *state = machine->driver_data<namcona1_state>(); |
| 98 | 82 | UINT16 *videoram = state->videoram; |
| 99 | tilemap_get_info(machine,tileinfo,tile_index,2*0x1000+videoram,tilemap_palette_bank[2], | |
| 83 | tilemap_get_info(machine,tileinfo,tile_index,2*0x1000+videoram,state->tilemap_palette_bank[2],state-> | |
| 100 | 84 | } |
| 101 | 85 | |
| 102 | 86 | static TILE_GET_INFO( tilemap_get_info3 ) |
| 103 | 87 | { |
| 104 | 88 | namcona1_state *state = machine->driver_data<namcona1_state>(); |
| 105 | 89 | UINT16 *videoram = state->videoram; |
| 106 | tilemap_get_info(machine,tileinfo,tile_index,3*0x1000+videoram,tilemap_palette_bank[3], | |
| 90 | tilemap_get_info(machine,tileinfo,tile_index,3*0x1000+videoram,state->tilemap_palette_bank[3],state-> | |
| 107 | 91 | } |
| 108 | 92 | |
| 109 | 93 | static TILE_GET_INFO( roz_get_info ) |
| r10886 | r10887 | |
| 111 | 95 | namcona1_state *state = machine->driver_data<namcona1_state>(); |
| 112 | 96 | UINT16 *videoram = state->videoram; |
| 113 | 97 | /* each logical tile is constructed from 4*4 normal tiles */ |
| 114 | int tilemap_color = roz_palette; | |
| 115 | int use_4bpp_gfx = namcona1_vreg[0xbc/2]&16; /* ? */ | |
| 98 | int tilemap_color = state->roz_palette; | |
| 99 | int use_4bpp_gfx = state->vreg[0xbc/2]&16; /* ? */ | |
| 116 | 100 | int c = tile_index%0x40; |
| 117 | 101 | int r = tile_index/0x40; |
| 118 | 102 | int data = videoram[0x8000/2+(r/4)*0x40+c/4]&0xfbf; /* mask out bit 0x40 - patch for Emeraldia Japan */ |
| r10886 | r10887 | |
| 129 | 113 | } |
| 130 | 114 | else |
| 131 | 115 | { |
| 132 | UINT8 *mask_data = (UINT8 *)(shaperam+4*tile); | |
| 116 | UINT8 *mask_data = (UINT8 *)(state->shaperam+4*tile); | |
| 133 | 117 | |
| 134 | 118 | if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) |
| 135 | 119 | { |
| 136 | 120 | UINT16 *source = (UINT16 *)mask_data; |
| 137 | | |
| 121 | | |
| 138 | 122 | conv_data[0] = source[0]>>8; |
| 139 | 123 | conv_data[1] = source[0]&0xff; |
| 140 | 124 | conv_data[2] = source[1]>>8; |
| r10886 | r10887 | |
| 159 | 143 | COMBINE_DATA( &videoram[offset] ); |
| 160 | 144 | if( offset<0x8000/2 ) |
| 161 | 145 | { |
| 162 | tilemap_mark_tile_dirty( bg_tilemap[offset/0x1000], offset&0xfff ); | |
| 146 | tilemap_mark_tile_dirty( state->bg_tilemap[offset/0x1000], offset&0xfff ); | |
| 163 | 147 | } |
| 164 | 148 | else if( offset<0xa000/2 ) |
| 165 | 149 | { |
| 166 | tilemap_mark_all_tiles_dirty( roz_tilemap ); | |
| 150 | tilemap_mark_all_tiles_dirty( state->roz_tilemap ); | |
| 167 | 151 | } |
| 168 | 152 | } /* namcona1_videoram_w */ |
| 169 | 153 | |
| r10886 | r10887 | |
| 201 | 185 | |
| 202 | 186 | WRITE16_HANDLER( namcona1_paletteram_w ) |
| 203 | 187 | { |
| 188 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 204 | 189 | COMBINE_DATA( &space->machine->generic.paletteram.u16[offset] ); |
| 205 | if( | |
| 190 | if( state-> | |
| 206 | 191 | { /* graphics enabled; update palette immediately */ |
| 207 | 192 | UpdatePalette(space->machine, offset ); |
| 208 | 193 | } |
| 209 | 194 | else |
| 210 | 195 | { |
| 211 | palette_is_dirty = 1; | |
| 196 | state->palette_is_dirty = 1; | |
| 212 | 197 | } |
| 213 | 198 | } |
| 214 | 199 | |
| r10886 | r10887 | |
| 251 | 236 | |
| 252 | 237 | READ16_HANDLER( namcona1_gfxram_r ) |
| 253 | 238 | { |
| 254 | UINT16 type = namcona1_vreg[0x0c/2]; | |
| 239 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 240 | UINT16 type = state->vreg[0x0c/2]; | |
| 255 | 241 | if( type == 0x03 ) |
| 256 | 242 | { |
| 257 | 243 | if( offset<0x4000 ) |
| 258 | 244 | { |
| 259 | return shaperam[offset]; | |
| 245 | return state->shaperam[offset]; | |
| 260 | 246 | } |
| 261 | 247 | } |
| 262 | 248 | else if( type == 0x02 ) |
| 263 | 249 | { |
| 264 | return cgram[offset]; | |
| 250 | return state->cgram[offset]; | |
| 265 | 251 | } |
| 266 | 252 | return 0x0000; |
| 267 | 253 | } /* namcona1_gfxram_r */ |
| 268 | 254 | |
| 269 | 255 | WRITE16_HANDLER( namcona1_gfxram_w ) |
| 270 | 256 | { |
| 271 | UINT16 type = namcona1_vreg[0x0c/2]; | |
| 257 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 258 | UINT16 type = state->vreg[0x0c/2]; | |
| 272 | 259 | UINT16 old_word; |
| 273 | 260 | |
| 274 | 261 | if( type == 0x03 ) |
| 275 | 262 | { |
| 276 | 263 | if( offset<0x4000 ) |
| 277 | 264 | { |
| 278 | old_word = shaperam[offset]; | |
| 279 | COMBINE_DATA( &shaperam[offset] ); | |
| 280 | if( shaperam[offset]!=old_word ) | |
| 265 | old_word = state->shaperam[offset]; | |
| 266 | COMBINE_DATA( &state->shaperam[offset] ); | |
| 267 | if( state->shaperam[offset]!=old_word ) | |
| 281 | 268 | gfx_element_mark_dirty(space->machine->gfx[2], offset/4); |
| 282 | 269 | } |
| 283 | 270 | } |
| 284 | 271 | else if( type == 0x02 ) |
| 285 | 272 | { |
| 286 | old_word = cgram[offset]; | |
| 287 | COMBINE_DATA( &cgram[offset] ); | |
| 288 | if( cgram[offset]!=old_word ) | |
| 273 | old_word = state->cgram[offset]; | |
| 274 | COMBINE_DATA( &state->cgram[offset] ); | |
| 275 | if( state->cgram[offset]!=old_word ) | |
| 289 | 276 | { |
| 290 | 277 | gfx_element_mark_dirty(space->machine->gfx[0], offset/0x20); |
| 291 | 278 | gfx_element_mark_dirty(space->machine->gfx[1], offset/0x20); |
| r10886 | r10887 | |
| 299 | 286 | |
| 300 | 287 | VIDEO_START( namcona1 ) |
| 301 | 288 | { |
| 289 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 302 | 290 | static const tile_get_info_func get_info[4] = { tilemap_get_info0, tilemap_get_info1, tilemap_get_info2, tilemap_get_info3 }; |
| 303 | 291 | int i; |
| 304 | 292 | |
| 305 | roz_tilemap = tilemap_create( machine, roz_get_info, tilemap_scan_rows, 8,8,64,64 ); | |
| 306 | roz_palette = -1; | |
| 293 | state->roz_tilemap = tilemap_create( machine, roz_get_info, tilemap_scan_rows, 8,8,64,64 ); | |
| 294 | state->roz_palette = -1; | |
| 307 | 295 | |
| 308 | 296 | for( i=0; i<NAMCONA1_NUM_TILEMAPS; i++ ) |
| 309 | 297 | { |
| 310 | bg_tilemap[i] = tilemap_create( machine, get_info[i], tilemap_scan_rows, 8,8,64,64 ); | |
| 311 | tilemap_palette_bank[i] = -1; | |
| 298 | state->bg_tilemap[i] = tilemap_create( machine, get_info[i], tilemap_scan_rows, 8,8,64,64 ); | |
| 299 | state->tilemap_palette_bank[i] = -1; | |
| 312 | 300 | } |
| 313 | 301 | |
| 314 | shaperam = auto_alloc_array(machine, UINT16, 0x2000*4/2 ); | |
| 315 | cgram = auto_alloc_array(machine, UINT16, 0x1000*0x40/2 ); | |
| 302 | state->shaperam = auto_alloc_array(machine, UINT16, 0x2000*4/2 ); | |
| 303 | state->cgram = auto_alloc_array(machine, UINT16, 0x1000*0x40/2 ); | |
| 316 | 304 | |
| 317 | machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)cgram, machine->total_colors()/256, 0 ); | |
| 318 | machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)cgram, machine->total_colors()/16, 0 ); | |
| 319 | machine->gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)shaperam, machine->total_colors()/2, 0 ); | |
| 305 | machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)state->cgram, machine->total_colors()/256, 0 ); | |
| 306 | machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)state->cgram, machine->total_colors()/16, 0 ); | |
| 307 | machine->gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)state->shaperam, machine->total_colors()/2, 0 ); | |
| 320 | 308 | |
| 321 | 309 | } /* namcona1_vh_start */ |
| 322 | 310 | |
| r10886 | r10887 | |
| 481 | 469 | int row,col; |
| 482 | 470 | int sx,sy; |
| 483 | 471 | |
| 484 | sprite_control = | |
| 472 | sprite_control = state-> | |
| 485 | 473 | if( sprite_control&1 ) source += 0x400; /* alternate spriteram bank */ |
| 486 | 474 | |
| 487 | 475 | for( which=0; which<0x100; which++ ) |
| r10886 | r10887 | |
| 576 | 564 | * tmap3 ffec00 ffee00 |
| 577 | 565 | */ |
| 578 | 566 | int xadjust = 0x3a - which*2; |
| 579 | const UINT16 *scroll = | |
| 567 | const UINT16 *scroll = state-> | |
| 580 | 568 | int line; |
| 581 | 569 | UINT16 xdata, ydata; |
| 582 | 570 | int scrollx, scrolly; |
| r10886 | r10887 | |
| 585 | 573 | gfx_element *pGfx; |
| 586 | 574 | |
| 587 | 575 | pGfx = machine->gfx[0]; |
| 588 | paldata = &machine->pens[pGfx->color_base + pGfx->color_granularity * tilemap_palette_bank[which]]; | |
| 576 | paldata = &machine->pens[pGfx->color_base + pGfx->color_granularity * state->tilemap_palette_bank[which]]; | |
| 589 | 577 | |
| 590 | 578 | /* draw one scanline at a time */ |
| 591 | 579 | clip.min_x = cliprect->min_x; |
| r10886 | r10887 | |
| 626 | 614 | { |
| 627 | 615 | if(which == NAMCONA1_NUM_TILEMAPS ) |
| 628 | 616 | { |
| 629 | int incxx = ((INT16)namcona1_vreg[0xc0/2])<<8; | |
| 630 | int incxy = ((INT16)namcona1_vreg[0xc2/2])<<8; | |
| 631 | int incyx = ((INT16)namcona1_vreg[0xc4/2])<<8; | |
| 632 | int incyy = ((INT16)namcona1_vreg[0xc6/2])<<8; | |
| 633 | INT16 xoffset = namcona1_vreg[0xc8/2]; | |
| 634 | INT16 yoffset = namcona1_vreg[0xca/2]; | |
| 617 | int incxx = ((INT16)state->vreg[0xc0/2])<<8; | |
| 618 | int incxy = ((INT16)state->vreg[0xc2/2])<<8; | |
| 619 | int incyx = ((INT16)state->vreg[0xc4/2])<<8; | |
| 620 | int incyy = ((INT16)state->vreg[0xc6/2])<<8; | |
| 621 | INT16 xoffset = state->vreg[0xc8/2]; | |
| 622 | INT16 yoffset = state->vreg[0xca/2]; | |
| 635 | 623 | int dx = 46; /* horizontal adjust */ |
| 636 | 624 | int dy = -8; /* vertical adjust */ |
| 637 | 625 | UINT32 startx = (xoffset<<12)+incxx*dx+incyx*dy; |
| 638 | 626 | UINT32 starty = (yoffset<<12)+incxy*dx+incyy*dy; |
| 639 | tilemap_draw_roz_primask(bitmap, &clip, roz_tilemap, | |
| 627 | tilemap_draw_roz_primask(bitmap, &clip, state->roz_tilemap, | |
| 640 | 628 | startx, starty, incxx, incxy, incyx, incyy, 0, 0, primask, 0); |
| 641 | 629 | } |
| 642 | 630 | else |
| 643 | 631 | { |
| 644 | tilemap_set_scrollx( bg_tilemap[which], 0, scrollx ); | |
| 645 | tilemap_set_scrolly( bg_tilemap[which], 0, scrolly ); | |
| 646 | tilemap_draw_primask( bitmap, &clip, bg_tilemap[which], 0, primask, 0 ); | |
| 632 | tilemap_set_scrollx( state->bg_tilemap[which], 0, scrollx ); | |
| 633 | tilemap_set_scrolly( state->bg_tilemap[which], 0, scrolly ); | |
| 634 | tilemap_draw_primask( bitmap, &clip, state->bg_tilemap[which], 0, primask, 0 ); | |
| 647 | 635 | } |
| 648 | 636 | } |
| 649 | 637 | } |
| r10886 | r10887 | |
| 652 | 640 | |
| 653 | 641 | SCREEN_UPDATE( namcona1 ) |
| 654 | 642 | { |
| 643 | namcona1_state *state = screen->machine->driver_data<namcona1_state>(); | |
| 655 | 644 | int which; |
| 656 | 645 | int priority; |
| 657 | 646 | |
| 658 | /* int flipscreen = | |
| 647 | /* int flipscreen = state-> | |
| 659 | 648 | |
| 660 | if( | |
| 649 | if( state-> | |
| 661 | 650 | { /* gfx enabled */ |
| 662 | if( palette_is_dirty ) | |
| 651 | if( state->palette_is_dirty ) | |
| 663 | 652 | { |
| 664 | 653 | /* palette updates are delayed when graphics are disabled */ |
| 665 | 654 | for( which=0; which<0x1000; which++ ) |
| 666 | 655 | { |
| 667 | 656 | UpdatePalette(screen->machine, which ); |
| 668 | 657 | } |
| 669 | palette_is_dirty = 0; | |
| 658 | state->palette_is_dirty = 0; | |
| 670 | 659 | } |
| 671 | 660 | UpdateGfx(screen->machine); |
| 672 | 661 | for( which=0; which<NAMCONA1_NUM_TILEMAPS; which++ ) |
| 673 | 662 | { |
| 674 | int tilemap_color = namcona1_vreg[0xb0/2+(which&3)]&0xf; | |
| 675 | if( tilemap_color!=tilemap_palette_bank[which] ) | |
| 663 | int tilemap_color = state->vreg[0xb0/2+(which&3)]&0xf; | |
| 664 | if( tilemap_color!=state->tilemap_palette_bank[which] ) | |
| 676 | 665 | { |
| 677 | tilemap_mark_all_tiles_dirty( bg_tilemap[which] ); | |
| 678 | tilemap_palette_bank[which] = tilemap_color; | |
| 666 | tilemap_mark_all_tiles_dirty( state->bg_tilemap[which] ); | |
| 667 | state->tilemap_palette_bank[which] = tilemap_color; | |
| 679 | 668 | } |
| 680 | 669 | } /* next tilemap */ |
| 681 | 670 | |
| 682 | 671 | { /* ROZ tilemap */ |
| 683 | int color = namcona1_vreg[0xba/2]&0xf; | |
| 684 | if( color != roz_palette ) | |
| 672 | int color = state->vreg[0xba/2]&0xf; | |
| 673 | if( color != state->roz_palette ) | |
| 685 | 674 | { |
| 686 | tilemap_mark_all_tiles_dirty( roz_tilemap ); | |
| 687 | roz_palette = color; | |
| 675 | tilemap_mark_all_tiles_dirty( state->roz_tilemap ); | |
| 676 | state->roz_palette = color; | |
| 688 | 677 | } |
| 689 | 678 | } |
| 690 | 679 | |
| r10886 | r10887 | |
| 699 | 688 | int pri; |
| 700 | 689 | if( which==4 ) |
| 701 | 690 | { |
| 702 | pri = | |
| 691 | pri = state-> | |
| 703 | 692 | } |
| 704 | 693 | else |
| 705 | 694 | { |
| 706 | pri = | |
| 695 | pri = state-> | |
| 707 | 696 | } |
| 708 | 697 | if( pri == priority ) |
| 709 | 698 | { |
| r10886 | r10887 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | /************************************* |
| 14 | 14 | * |
| 15 | * Global variables | |
| 16 | * | |
| 17 | *************************************/ | |
| 18 | ||
| 19 | /* Spy Hunter hardware extras */ | |
| 20 | UINT8 spyhunt_sprite_color_mask; | |
| 21 | static INT16 spyhunt_scrollx, spyhunt_scrolly; | |
| 22 | INT16 spyhunt_scroll_offset; | |
| 23 | ||
| 24 | UINT8 *spyhunt_alpharam; | |
| 25 | //size_t spyhunt_alpharam_size; | |
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | /************************************* | |
| 30 | * | |
| 31 | * Local variables | |
| 32 | * | |
| 33 | *************************************/ | |
| 34 | ||
| 35 | static tilemap_t *bg_tilemap; | |
| 36 | static tilemap_t *alpha_tilemap; | |
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | /************************************* | |
| 41 | * | |
| 42 | 15 | * Tilemap callbacks |
| 43 | 16 | * |
| 44 | 17 | *************************************/ |
| r10886 | r10887 | |
| 86 | 59 | |
| 87 | 60 | static TILE_GET_INFO( spyhunt_get_alpha_tile_info ) |
| 88 | 61 | { |
| 89 | SET_TILE_INFO(2, spyhunt_alpharam[tile_index], 0, 0); | |
| 62 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 63 | SET_TILE_INFO(2, state->spyhunt_alpharam[tile_index], 0, 0); | |
| 90 | 64 | } |
| 91 | 65 | |
| 92 | 66 | |
| r10886 | r10887 | |
| 117 | 91 | #ifdef UNUSED_FUNCTION |
| 118 | 92 | VIDEO_START( mcr3 ) |
| 119 | 93 | { |
| 94 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 120 | 95 | /* initialize the background tilemap */ |
| 121 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16,16, 32,30); | |
| 96 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16,16, 32,30); | |
| 122 | 97 | } |
| 123 | 98 | #endif |
| 124 | 99 | |
| 125 | 100 | |
| 126 | 101 | VIDEO_START( mcrmono ) |
| 127 | 102 | { |
| 103 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 128 | 104 | /* initialize the background tilemap */ |
| 129 | bg_tilemap = tilemap_create(machine, mcrmono_get_bg_tile_info, tilemap_scan_rows, 16,16, 32,30); | |
| 105 | state->bg_tilemap = tilemap_create(machine, mcrmono_get_bg_tile_info, tilemap_scan_rows, 16,16, 32,30); | |
| 130 | 106 | } |
| 131 | 107 | |
| 132 | 108 | |
| 133 | 109 | VIDEO_START( spyhunt ) |
| 134 | 110 | { |
| 111 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 135 | 112 | /* initialize the background tilemap */ |
| 136 | bg_tilemap = tilemap_create(machine, spyhunt_get_bg_tile_info, spyhunt_bg_scan, 64,32, 64,32); | |
| 113 | state->bg_tilemap = tilemap_create(machine, spyhunt_get_bg_tile_info, spyhunt_bg_scan, 64,32, 64,32); | |
| 137 | 114 | |
| 138 | 115 | /* initialize the text tilemap */ |
| 139 | alpha_tilemap = tilemap_create(machine, spyhunt_get_alpha_tile_info, tilemap_scan_cols, 16,16, 32,32); | |
| 140 | tilemap_set_transparent_pen(alpha_tilemap, 0); | |
| 141 | tilemap_set_scrollx(alpha_tilemap, 0, 16); | |
| 116 | state->alpha_tilemap = tilemap_create(machine, spyhunt_get_alpha_tile_info, tilemap_scan_cols, 16,16, 32,32); | |
| 117 | tilemap_set_transparent_pen(state->alpha_tilemap, 0); | |
| 118 | tilemap_set_scrollx(state->alpha_tilemap, 0, 16); | |
| 142 | 119 | |
| 143 | state_save_register_global(machine, spyhunt_sprite_color_mask); | |
| 144 | state_save_register_global(machine, spyhunt_scrollx); | |
| 145 | state_save_register_global(machine, spyhunt_scrolly); | |
| 146 | state_save_register_global(machine, spyhunt_scroll_offset); | |
| 120 | state_save_register_global(machine, state->spyhunt_sprite_color_mask); | |
| 121 | state_save_register_global(machine, state->spyhunt_scrollx); | |
| 122 | state_save_register_global(machine, state->spyhunt_scrolly); | |
| 123 | state_save_register_global(machine, state->spyhunt_scroll_offset); | |
| 147 | 124 | } |
| 148 | 125 | |
| 149 | 126 | |
| r10886 | r10887 | |
| 176 | 153 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); |
| 177 | 154 | UINT8 *videoram = state->videoram; |
| 178 | 155 | videoram[offset] = data; |
| 179 | tilemap_mark_tile_dirty(bg_tilemap, offset / 2); | |
| 156 | tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2); | |
| 180 | 157 | } |
| 181 | 158 | |
| 182 | 159 | |
| r10886 | r10887 | |
| 185 | 162 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); |
| 186 | 163 | UINT8 *videoram = state->videoram; |
| 187 | 164 | videoram[offset] = data; |
| 188 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 165 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 189 | 166 | } |
| 190 | 167 | |
| 191 | 168 | |
| 192 | 169 | WRITE8_HANDLER( spyhunt_alpharam_w ) |
| 193 | 170 | { |
| 194 | spyhunt_alpharam[offset] = data; | |
| 195 | tilemap_mark_tile_dirty(alpha_tilemap, offset); | |
| 171 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 172 | state->spyhunt_alpharam[offset] = data; | |
| 173 | tilemap_mark_tile_dirty(state->alpha_tilemap, offset); | |
| 196 | 174 | } |
| 197 | 175 | |
| 198 | 176 | |
| 199 | 177 | WRITE8_HANDLER( spyhunt_scroll_value_w ) |
| 200 | 178 | { |
| 179 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 201 | 180 | switch (offset) |
| 202 | 181 | { |
| 203 | 182 | case 0: |
| 204 | 183 | /* low 8 bits of horizontal scroll */ |
| 205 | spyhunt_scrollx = (spyhunt_scrollx & ~0xff) | data; | |
| 184 | state->spyhunt_scrollx = (state->spyhunt_scrollx & ~0xff) | data; | |
| 206 | 185 | break; |
| 207 | 186 | |
| 208 | 187 | case 1: |
| 209 | 188 | /* upper 3 bits of horizontal scroll and upper 1 bit of vertical scroll */ |
| 210 | spyhunt_scrollx = (spyhunt_scrollx & 0xff) | ((data & 0x07) << 8); | |
| 211 | spyhunt_scrolly = (spyhunt_scrolly & 0xff) | ((data & 0x80) << 1); | |
| 189 | state->spyhunt_scrollx = (state->spyhunt_scrollx & 0xff) | ((data & 0x07) << 8); | |
| 190 | state->spyhunt_scrolly = (state->spyhunt_scrolly & 0xff) | ((data & 0x80) << 1); | |
| 212 | 191 | break; |
| 213 | 192 | |
| 214 | 193 | case 2: |
| 215 | 194 | /* low 8 bits of vertical scroll */ |
| 216 | spyhunt_scrolly = (spyhunt_scrolly & ~0xff) | data; | |
| 195 | state->spyhunt_scrolly = (state->spyhunt_scrolly & ~0xff) | data; | |
| 217 | 196 | break; |
| 218 | 197 | } |
| 219 | 198 | } |
| r10886 | r10887 | |
| 303 | 282 | |
| 304 | 283 | SCREEN_UPDATE( mcr3 ) |
| 305 | 284 | { |
| 285 | mcr3_state *state = screen->machine->driver_data<mcr3_state>(); | |
| 306 | 286 | /* update the flip state */ |
| 307 | tilemap_set_flip(bg_tilemap, mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); | |
| 287 | tilemap_set_flip(state->bg_tilemap, mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); | |
| 308 | 288 | |
| 309 | 289 | /* draw the background */ |
| 310 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 290 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 311 | 291 | |
| 312 | 292 | /* draw the sprites */ |
| 313 | 293 | mcr3_update_sprites(screen->machine, bitmap, cliprect, 0x03, 0, 0, 0); |
| r10886 | r10887 | |
| 317 | 297 | |
| 318 | 298 | SCREEN_UPDATE( spyhunt ) |
| 319 | 299 | { |
| 300 | mcr3_state *state = screen->machine->driver_data<mcr3_state>(); | |
| 320 | 301 | /* for every character in the Video RAM, check if it has been modified */ |
| 321 | 302 | /* since last time and update it accordingly. */ |
| 322 | tilemap_set_scrollx(bg_tilemap, 0, spyhunt_scrollx * 2 + spyhunt_scroll_offset); | |
| 323 | tilemap_set_scrolly(bg_tilemap, 0, spyhunt_scrolly * 2); | |
| 324 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 303 | tilemap_set_scrollx(state->bg_tilemap, 0, state->spyhunt_scrollx * 2 + state->spyhunt_scroll_offset); | |
| 304 | tilemap_set_scrolly(state->bg_tilemap, 0, state->spyhunt_scrolly * 2); | |
| 305 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 325 | 306 | |
| 326 | 307 | /* draw the sprites */ |
| 327 | mcr3_update_sprites(screen->machine, bitmap, cliprect, spyhunt_sprite_color_mask, 0, -12, 0); | |
| 308 | mcr3_update_sprites(screen->machine, bitmap, cliprect, state->spyhunt_sprite_color_mask, 0, -12, 0); | |
| 328 | 309 | |
| 329 | 310 | /* render any characters on top */ |
| 330 | tilemap_draw(bitmap, cliprect, alpha_tilemap, 0, 0); | |
| 311 | tilemap_draw(bitmap, cliprect, state->alpha_tilemap, 0, 0); | |
| 331 | 312 | return 0; |
| 332 | 313 | } |
| r10886 | r10887 | |
|---|---|---|
| 8 | 8 | #include "includes/namcos86.h" |
| 9 | 9 | |
| 10 | 10 | |
| 11 | UINT8 *rthunder_videoram1, *rthunder_videoram2, *rthunder_spriteram; | |
| 12 | ||
| 13 | static int tilebank; | |
| 14 | static int xscroll[4], yscroll[4]; /* scroll + priority */ | |
| 15 | ||
| 16 | static tilemap_t *bg_tilemap[4]; | |
| 17 | ||
| 18 | static int backcolor; | |
| 19 | static const UINT8 *tile_address_prom; | |
| 20 | ||
| 21 | ||
| 22 | 11 | /*************************************************************************** |
| 23 | 12 | |
| 24 | 13 | Convert the color PROMs into a more useable format. |
| r10886 | r10887 | |
| 45 | 34 | |
| 46 | 35 | PALETTE_INIT( namcos86 ) |
| 47 | 36 | { |
| 37 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 48 | 38 | int i; |
| 49 | 39 | rgb_t palette[512]; |
| 50 | 40 | |
| r10886 | r10887 | |
| 85 | 75 | |
| 86 | 76 | /* color_prom now points to the beginning of the tile address decode PROM */ |
| 87 | 77 | |
| 88 | tile_address_prom = color_prom; /* we'll need this at run time */ | |
| 78 | state->tile_address_prom = color_prom; /* we'll need this at run time */ | |
| 89 | 79 | } |
| 90 | 80 | |
| 91 | 81 | |
| r10886 | r10887 | |
| 99 | 89 | |
| 100 | 90 | INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT8 *vram) |
| 101 | 91 | { |
| 92 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 102 | 93 | int attr = vram[2*tile_index + 1]; |
| 103 | 94 | int tile_offs; |
| 104 | 95 | if (layer & 2) |
| 105 | tile_offs = ((tile_address_prom[((layer & 1) << 4) + (attr & 0x03)] & 0xe0) >> 5) * 0x100; | |
| 96 | tile_offs = ((state->tile_address_prom[((layer & 1) << 4) + (attr & 0x03)] & 0xe0) >> 5) * 0x100; | |
| 106 | 97 | else |
| 107 | tile_offs = ((tile_address_prom[((layer & 1) << 4) + ((attr & 0x03) << 2)] & 0x0e) >> 1) * 0x100 + tilebank * 0x800; | |
| 98 | tile_offs = ((state->tile_address_prom[((layer & 1) << 4) + ((attr & 0x03) << 2)] & 0x0e) >> 1) * 0x100 + state->tilebank * 0x800; | |
| 108 | 99 | |
| 109 | 100 | SET_TILE_INFO( |
| 110 | 101 | (layer & 2) ? 1 : 0, |
| r10886 | r10887 | |
| 113 | 104 | 0); |
| 114 | 105 | } |
| 115 | 106 | |
| 116 | static TILE_GET_INFO( get_tile_info0 ) { get_tile_info(machine,tileinfo,tile_index,0,&rthunder_videoram1[0x0000]); } | |
| 117 | static TILE_GET_INFO( get_tile_info1 ) { get_tile_info(machine,tileinfo,tile_index,1,&rthunder_videoram1[0x1000]); } | |
| 118 | static TILE_GET_INFO( get_tile_info2 ) { get_tile_info(machine,tileinfo,tile_index,2,&rthunder_videoram2[0x0000]); } | |
| 119 | static TILE_GET_INFO( get_tile_info3 ) { get_tile_info(machine,tileinfo,tile_index,3,&rthunder_videoram2[0x1000]); } | |
| 107 | static TILE_GET_INFO( get_tile_info0 ) | |
| 108 | { | |
| 109 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 110 | get_tile_info(machine,tileinfo,tile_index,0,&state->rthunder_videoram1[0x0000]); | |
| 111 | } | |
| 120 | 112 | |
| 113 | static TILE_GET_INFO( get_tile_info1 ) | |
| 114 | { | |
| 115 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 116 | get_tile_info(machine,tileinfo,tile_index,1,&state->rthunder_videoram1[0x1000]); | |
| 117 | } | |
| 121 | 118 | |
| 119 | static TILE_GET_INFO( get_tile_info2 ) | |
| 120 | { | |
| 121 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 122 | get_tile_info(machine,tileinfo,tile_index,2,&state->rthunder_videoram2[0x0000]); | |
| 123 | } | |
| 124 | ||
| 125 | static TILE_GET_INFO( get_tile_info3 ) | |
| 126 | { | |
| 127 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 128 | get_tile_info(machine,tileinfo,tile_index,3,&state->rthunder_videoram2[0x1000]); | |
| 129 | } | |
| 130 | ||
| 131 | ||
| 122 | 132 | /*************************************************************************** |
| 123 | 133 | |
| 124 | 134 | Start the video hardware emulation. |
| r10886 | r10887 | |
| 128 | 138 | VIDEO_START( namcos86 ) |
| 129 | 139 | { |
| 130 | 140 | namcos86_state *state = machine->driver_data<namcos86_state>(); |
| 131 | bg_tilemap[0] = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,64,32); | |
| 132 | bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,8,8,64,32); | |
| 133 | bg_tilemap[2] = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,8,8,64,32); | |
| 134 | bg_tilemap[3] = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,8,8,64,32); | |
| 141 | state->bg_tilemap[0] = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,64,32); | |
| 142 | state->bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,8,8,64,32); | |
| 143 | state->bg_tilemap[2] = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,8,8,64,32); | |
| 144 | state->bg_tilemap[3] = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,8,8,64,32); | |
| 135 | 145 | |
| 136 | tilemap_set_transparent_pen(bg_tilemap[0],7); | |
| 137 | tilemap_set_transparent_pen(bg_tilemap[1],7); | |
| 138 | tilemap_set_transparent_pen(bg_tilemap[2],7); | |
| 139 | tilemap_set_transparent_pen(bg_tilemap[3],7); | |
| 146 | tilemap_set_transparent_pen(state->bg_tilemap[0],7); | |
| 147 | tilemap_set_transparent_pen(state->bg_tilemap[1],7); | |
| 148 | tilemap_set_transparent_pen(state->bg_tilemap[2],7); | |
| 149 | tilemap_set_transparent_pen(state->bg_tilemap[3],7); | |
| 140 | 150 | |
| 141 | state->spriteram = rthunder_spriteram + 0x1800; | |
| 151 | state->spriteram = state->rthunder_spriteram + 0x1800; | |
| 142 | 152 | } |
| 143 | 153 | |
| 144 | 154 | |
| r10886 | r10887 | |
| 151 | 161 | |
| 152 | 162 | READ8_HANDLER( rthunder_videoram1_r ) |
| 153 | 163 | { |
| 154 | return rthunder_videoram1[offset]; | |
| 164 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 165 | return state->rthunder_videoram1[offset]; | |
| 155 | 166 | } |
| 156 | 167 | |
| 157 | 168 | WRITE8_HANDLER( rthunder_videoram1_w ) |
| 158 | 169 | { |
| 159 | rthunder_videoram1[offset] = data; | |
| 160 | tilemap_mark_tile_dirty(bg_tilemap[offset/0x1000],(offset & 0xfff)/2); | |
| 170 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 171 | state->rthunder_videoram1[offset] = data; | |
| 172 | tilemap_mark_tile_dirty(state->bg_tilemap[offset/0x1000],(offset & 0xfff)/2); | |
| 161 | 173 | } |
| 162 | 174 | |
| 163 | 175 | READ8_HANDLER( rthunder_videoram2_r ) |
| 164 | 176 | { |
| 165 | return rthunder_videoram2[offset]; | |
| 177 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 178 | return state->rthunder_videoram2[offset]; | |
| 166 | 179 | } |
| 167 | 180 | |
| 168 | 181 | WRITE8_HANDLER( rthunder_videoram2_w ) |
| 169 | 182 | { |
| 170 | rthunder_videoram2[offset] = data; | |
| 171 | tilemap_mark_tile_dirty(bg_tilemap[2+offset/0x1000],(offset & 0xfff)/2); | |
| 183 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 184 | state->rthunder_videoram2[offset] = data; | |
| 185 | tilemap_mark_tile_dirty(state->bg_tilemap[2+offset/0x1000],(offset & 0xfff)/2); | |
| 172 | 186 | } |
| 173 | 187 | |
| 174 | 188 | WRITE8_HANDLER( rthunder_tilebank_select_w ) |
| 175 | 189 | { |
| 190 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 176 | 191 | int bit = BIT(offset,10); |
| 177 | if (tilebank != bit) | |
| 192 | if (state->tilebank != bit) | |
| 178 | 193 | { |
| 179 | tilebank = bit; | |
| 180 | tilemap_mark_all_tiles_dirty(bg_tilemap[0]); | |
| 181 | tilemap_mark_all_tiles_dirty(bg_tilemap[1]); | |
| 194 | state->tilebank = bit; | |
| 195 | tilemap_mark_all_tiles_dirty(state->bg_tilemap[0]); | |
| 196 | tilemap_mark_all_tiles_dirty(state->bg_tilemap[1]); | |
| 182 | 197 | } |
| 183 | 198 | } |
| 184 | 199 | |
| 185 | static void scroll_w( | |
| 200 | static void scroll_w(address_space *space | |
| 186 | 201 | { |
| 202 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 187 | 203 | switch (offset) |
| 188 | 204 | { |
| 189 | 205 | case 0: |
| 190 | xscroll[layer] = (xscroll[layer]&0xff)|(data<<8); | |
| 206 | state->xscroll[layer] = (state->xscroll[layer]&0xff)|(data<<8); | |
| 191 | 207 | break; |
| 192 | 208 | case 1: |
| 193 | xscroll[layer] = (xscroll[layer]&0xff00)|data; | |
| 209 | state->xscroll[layer] = (state->xscroll[layer]&0xff00)|data; | |
| 194 | 210 | break; |
| 195 | 211 | case 2: |
| 196 | yscroll[layer] = data; | |
| 212 | state->yscroll[layer] = data; | |
| 197 | 213 | break; |
| 198 | 214 | } |
| 199 | 215 | } |
| 200 | 216 | |
| 201 | 217 | WRITE8_HANDLER( rthunder_scroll0_w ) |
| 202 | 218 | { |
| 203 | scroll_w( | |
| 219 | scroll_w(space,offset,data,0); | |
| 204 | 220 | } |
| 205 | 221 | WRITE8_HANDLER( rthunder_scroll1_w ) |
| 206 | 222 | { |
| 207 | scroll_w( | |
| 223 | scroll_w(space,offset,data,1); | |
| 208 | 224 | } |
| 209 | 225 | WRITE8_HANDLER( rthunder_scroll2_w ) |
| 210 | 226 | { |
| 211 | scroll_w( | |
| 227 | scroll_w(space,offset,data,2); | |
| 212 | 228 | } |
| 213 | 229 | WRITE8_HANDLER( rthunder_scroll3_w ) |
| 214 | 230 | { |
| 215 | scroll_w( | |
| 231 | scroll_w(space,offset,data,3); | |
| 216 | 232 | } |
| 217 | 233 | |
| 218 | 234 | WRITE8_HANDLER( rthunder_backcolor_w ) |
| 219 | 235 | { |
| 220 | backcolor = data; | |
| 236 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 237 | state->backcolor = data; | |
| 221 | 238 | } |
| 222 | 239 | |
| 223 | 240 | |
| 224 | static int copy_sprites; | |
| 225 | 241 | |
| 226 | 242 | READ8_HANDLER( rthunder_spriteram_r ) |
| 227 | 243 | { |
| 228 | return rthunder_spriteram[offset]; | |
| 244 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 245 | return state->rthunder_spriteram[offset]; | |
| 229 | 246 | } |
| 230 | 247 | |
| 231 | 248 | WRITE8_HANDLER( rthunder_spriteram_w ) |
| 232 | 249 | { |
| 233 | rthunder_spriteram[offset] = data; | |
| 250 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 251 | state->rthunder_spriteram[offset] = data; | |
| 234 | 252 | |
| 235 | 253 | /* a write to this offset tells the sprite chip to buffer the sprite list */ |
| 236 | 254 | if (offset == 0x1ff2) |
| 237 | copy_sprites = 1; | |
| 255 | state->copy_sprites = 1; | |
| 238 | 256 | } |
| 239 | 257 | |
| 240 | 258 | |
| r10886 | r10887 | |
| 328 | 346 | |
| 329 | 347 | static void set_scroll(running_machine *machine, int layer) |
| 330 | 348 | { |
| 349 | namcos86_state *state = machine->driver_data<namcos86_state>(); | |
| 331 | 350 | static const int xdisp[4] = { 47, 49, 46, 48 }; |
| 332 | 351 | int scrollx,scrolly; |
| 333 | 352 | |
| 334 | scrollx = xscroll[layer] - xdisp[layer]; | |
| 335 | scrolly = yscroll[layer] + 9; | |
| 353 | scrollx = state->xscroll[layer] - xdisp[layer]; | |
| 354 | scrolly = state->yscroll[layer] + 9; | |
| 336 | 355 | if (flip_screen_get(machine)) |
| 337 | 356 | { |
| 338 | 357 | scrollx = -scrollx; |
| 339 | 358 | scrolly = -scrolly; |
| 340 | 359 | } |
| 341 | tilemap_set_scrollx(bg_tilemap[layer], 0, scrollx); | |
| 342 | tilemap_set_scrolly(bg_tilemap[layer], 0, scrolly); | |
| 360 | tilemap_set_scrollx(state->bg_tilemap[layer], 0, scrollx); | |
| 361 | tilemap_set_scrolly(state->bg_tilemap[layer], 0, scrolly); | |
| 343 | 362 | } |
| 344 | 363 | |
| 345 | 364 | |
| r10886 | r10887 | |
| 359 | 378 | |
| 360 | 379 | bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); |
| 361 | 380 | |
| 362 | bitmap_fill(bitmap,cliprect,screen->machine->gfx[0]->color_base + 8*backcolor+7); | |
| 381 | bitmap_fill(bitmap,cliprect,screen->machine->gfx[0]->color_base + 8*state->backcolor+7); | |
| 363 | 382 | |
| 364 | 383 | for (layer = 0;layer < 8;layer++) |
| 365 | 384 | { |
| r10886 | r10887 | |
| 367 | 386 | |
| 368 | 387 | for (i = 3;i >= 0;i--) |
| 369 | 388 | { |
| 370 | if (((xscroll[i] & 0x0e00) >> 9) == layer) | |
| 371 | tilemap_draw_primask(bitmap,cliprect,bg_tilemap[i],0,layer,0); | |
| 389 | if (((state->xscroll[i] & 0x0e00) >> 9) == layer) | |
| 390 | tilemap_draw_primask(bitmap,cliprect,state->bg_tilemap[i],0,layer,0); | |
| 372 | 391 | } |
| 373 | 392 | } |
| 374 | 393 | |
| r10886 | r10887 | |
| 380 | 399 | SCREEN_EOF( namcos86 ) |
| 381 | 400 | { |
| 382 | 401 | namcos86_state *state = machine->driver_data<namcos86_state>(); |
| 383 | if (copy_sprites) | |
| 402 | if (state->copy_sprites) | |
| 384 | 403 | { |
| 385 | 404 | UINT8 *spriteram = state->spriteram; |
| 386 | 405 | int i,j; |
| r10886 | r10887 | |
| 391 | 410 | spriteram[i+j] = spriteram[i+j - 6]; |
| 392 | 411 | } |
| 393 | 412 | |
| 394 | copy_sprites = 0; | |
| 413 | state->copy_sprites = 0; | |
| 395 | 414 | } |
| 396 | 415 | } |
| r10886 | r10887 | |
|---|---|---|
| 245 | 245 | /* global tweaks */ |
| 246 | 246 | UINT8 galaxian_frogger_adjust; |
| 247 | 247 | UINT8 galaxian_sfx_tilemap; |
| 248 | UINT8 galaxian_sprite_clip_start; | |
| 249 | UINT8 galaxian_sprite_clip_end; | |
| 250 | 248 | |
| 251 | 249 | |
| 252 | 250 | |
| r10886 | r10887 | |
| 427 | 425 | { |
| 428 | 426 | PALETTE_INIT_CALL(galaxian); |
| 429 | 427 | |
| 430 | ||
| 431 | 428 | /* wire mod to connect the bullet blue output to the 220 ohm resistor */ |
| 432 | 429 | bullet_color[7] = MAKE_RGB(0xef,0xef,0x97); |
| 433 | 430 | } |
| r10886 | r10887 | |
| 600 | 597 | { |
| 601 | 598 | rectangle clip = *cliprect; |
| 602 | 599 | int sprnum; |
| 603 | int clip_ofs = (flipscreen_x ? 16 : 0); | |
| 604 | 600 | |
| 605 | 601 | /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ |
| 606 | /* according to the schematics, it should be the first 16 pixels; however, */ | |
| 607 | /* some bootlegs demonstrate that this can be shifted to other positions. */ | |
| 608 | clip.min_x = MAX(clip.min_x, (galaxian_sprite_clip_start - clip_ofs) * GALAXIAN_XSCALE); | |
| 609 | clip.max_x = MIN(clip.max_x, (galaxian_sprite_clip_end - clip_ofs + 1) * GALAXIAN_XSCALE - 1); | |
| 602 | /* according to the schematics, it should be the first 16 pixels */ | |
| 603 | clip.min_x = MAX(clip.min_x, (!flipscreen_x) * 16 * GALAXIAN_XSCALE); | |
| 604 | clip.max_x = MIN(clip.max_x, (256 - flipscreen_x * 16) * GALAXIAN_XSCALE - 1); | |
| 610 | 605 | |
| 611 | 606 | /* The line buffer is only written if it contains a '0' currently; */ |
| 612 | 607 | /* it is cleared during the visible area, and populated during HBLANK */ |
| r10886 | r10887 | |
| 623 | 618 | UINT8 flipx = base[1] & 0x40; |
| 624 | 619 | UINT8 flipy = base[1] & 0x80; |
| 625 | 620 | UINT8 color = base[2] & 7; |
| 626 | UINT8 sx = base[3]; | |
| 621 | UINT8 sx = base[3] + 1; | |
| 627 | 622 | |
| 628 | 623 | /* extend the sprite information */ |
| 629 | 624 | if (galaxian_extend_sprite_info_ptr != NULL) |
| r10886 | r10887 | |
| 632 | 627 | /* apply flipscreen in X direction */ |
| 633 | 628 | if (flipscreen_x) |
| 634 | 629 | { |
| 635 | sx = 24 | |
| 630 | sx = 240 - sx; | |
| 636 | 631 | flipx = !flipx; |
| 637 | 632 | } |
| 638 | 633 | |
| r10886 | r10887 | |
| 1239 | 1234 | |
| 1240 | 1235 | /************************************* |
| 1241 | 1236 | * |
| 1242 | * | |
| 1237 | * V | |
| 1243 | 1238 | * |
| 1244 | 1239 | *************************************/ |
| 1245 | 1240 | |
| 1241 | /*** generic ***/ | |
| 1246 | 1242 | void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1247 | 1243 | { |
| 1248 | 1244 | /* tiles are in the upper half of a larger ROM */ |
| 1249 | 1245 | *code += 0x100; |
| 1250 | 1246 | } |
| 1251 | 1247 | |
| 1252 | ||
| 1253 | 1248 | void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1254 | 1249 | { |
| 1255 | 1250 | /* sprites are in the upper half of a larger ROM */ |
| r10886 | r10887 | |
| 1257 | 1252 | } |
| 1258 | 1253 | |
| 1259 | 1254 | |
| 1260 | ||
| 1261 | /************************************* | |
| 1262 | * | |
| 1263 | * Frogger extensions | |
| 1264 | * | |
| 1265 | *************************************/ | |
| 1266 | ||
| 1255 | /*** Frogger ***/ | |
| 1267 | 1256 | void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1268 | 1257 | { |
| 1269 | 1258 | *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); |
| r10886 | r10887 | |
| 1275 | 1264 | } |
| 1276 | 1265 | |
| 1277 | 1266 | |
| 1278 | ||
| 1279 | /************************************* | |
| 1280 | * | |
| 1281 | * Ghostmuncher Galaxian extensions | |
| 1282 | * | |
| 1283 | *************************************/ | |
| 1284 | ||
| 1267 | /*** Ghostmuncher Galaxian ***/ | |
| 1285 | 1268 | void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1286 | 1269 | { |
| 1287 | 1270 | *code |= gfxbank[0] << 9; |
| r10886 | r10887 | |
| 1295 | 1278 | } |
| 1296 | 1279 | |
| 1297 | 1280 | |
| 1298 | ||
| 1299 | /************************************* | |
| 1300 | * | |
| 1301 | * Pisces extensions | |
| 1302 | * | |
| 1303 | *************************************/ | |
| 1304 | ||
| 1281 | /*** Pisces ***/ | |
| 1305 | 1282 | void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1306 | 1283 | { |
| 1307 | 1284 | *code |= gfxbank[0] << 8; |
| r10886 | r10887 | |
| 1313 | 1290 | } |
| 1314 | 1291 | |
| 1315 | 1292 | |
| 1316 | ||
| 1317 | /************************************* | |
| 1318 | * | |
| 1319 | * Batman Part 2 extensions | |
| 1320 | * | |
| 1321 | *************************************/ | |
| 1322 | ||
| 1293 | /*** Batman Part 2 ***/ | |
| 1323 | 1294 | void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1324 | 1295 | { |
| 1325 | 1296 | if (*code & 0x80) |
| r10886 | r10887 | |
| 1327 | 1298 | } |
| 1328 | 1299 | |
| 1329 | 1300 | |
| 1330 | ||
| 1331 | /************************************* | |
| 1332 | * | |
| 1333 | * Moon Cresta extensions | |
| 1334 | * | |
| 1335 | *************************************/ | |
| 1336 | ||
| 1301 | /*** Moon Cresta ***/ | |
| 1337 | 1302 | void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1338 | 1303 | { |
| 1339 | 1304 | if (gfxbank[2] && (*code & 0xc0) == 0x80) |
| r10886 | r10887 | |
| 1347 | 1312 | } |
| 1348 | 1313 | |
| 1349 | 1314 | |
| 1350 | ||
| 1351 | /************************************* | |
| 1352 | * | |
| 1353 | * Moon Quasar extensions | |
| 1354 | * | |
| 1355 | *************************************/ | |
| 1356 | ||
| 1315 | /*** Moon Quasar ***/ | |
| 1357 | 1316 | void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1358 | 1317 | { |
| 1359 | 1318 | *code |= (attrib & 0x20) << 3; |
| r10886 | r10887 | |
| 1365 | 1324 | } |
| 1366 | 1325 | |
| 1367 | 1326 | |
| 1368 | ||
| 1369 | /************************************* | |
| 1370 | * | |
| 1371 | * Moon Shuttle extensions | |
| 1372 | * | |
| 1373 | *************************************/ | |
| 1374 | ||
| 1327 | /*** Moon Shuttle ***/ | |
| 1375 | 1328 | void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1376 | 1329 | { |
| 1377 | 1330 | *code |= (attrib & 0x30) << 4; |
| r10886 | r10887 | |
| 1383 | 1336 | } |
| 1384 | 1337 | |
| 1385 | 1338 | |
| 1386 | /************************************* | |
| 1387 | * | |
| 1388 | * Calipso extensions | |
| 1389 | * | |
| 1390 | *************************************/ | |
| 1391 | ||
| 1339 | /*** Calipso ***/ | |
| 1392 | 1340 | void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1393 | 1341 | { |
| 1394 | 1342 | /* same as the others, but no sprite flipping, but instead the bits are used |
| r10886 | r10887 | |
| 1399 | 1347 | *flipy = 0; |
| 1400 | 1348 | } |
| 1401 | 1349 | |
| 1402 | /************************************* | |
| 1403 | * | |
| 1404 | * Jumpbug extensions | |
| 1405 | * | |
| 1406 | *************************************/ | |
| 1407 | 1350 | |
| 1351 | /*** Jumpbug ***/ | |
| 1408 | 1352 | void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1409 | 1353 | { |
| 1410 | 1354 | if ((*code & 0xc0) == 0x80 && (gfxbank[2] & 0x01)) |
| r10886 | r10887 | |
|---|---|---|
| 3 | 3 | #include "emu.h" |
| 4 | 4 | #include "includes/flower.h" |
| 5 | 5 | |
| 6 | static tilemap_t *flower_bg0_tilemap, *flower_bg1_tilemap, *flower_text_tilemap, *flower_text_right_tilemap; | |
| 7 | UINT8 *flower_textram, *flower_bg0ram, *flower_bg1ram, *flower_bg0_scroll, *flower_bg1_scroll; | |
| 8 | 6 | |
| 9 | ||
| 10 | 7 | PALETTE_INIT( flower ) |
| 11 | 8 | { |
| 12 | 9 | int i; |
| r10886 | r10887 | |
| 122 | 119 | |
| 123 | 120 | static TILE_GET_INFO( get_bg0_tile_info ) |
| 124 | 121 | { |
| 125 | int code = flower_bg0ram[tile_index]; | |
| 126 | int color = flower_bg0ram[tile_index+0x100]; | |
| 122 | flower_state *state = machine->driver_data<flower_state>(); | |
| 123 | int code = state->bg0ram[tile_index]; | |
| 124 | int color = state->bg0ram[tile_index+0x100]; | |
| 127 | 125 | /* Todo - may be tile flip bits? */ |
| 128 | 126 | |
| 129 | 127 | SET_TILE_INFO(2, code, color>>4, 0); |
| r10886 | r10887 | |
| 131 | 129 | |
| 132 | 130 | static TILE_GET_INFO( get_bg1_tile_info ) |
| 133 | 131 | { |
| 134 | int code = flower_bg1ram[tile_index]; | |
| 135 | int color = flower_bg1ram[tile_index+0x100]; | |
| 132 | flower_state *state = machine->driver_data<flower_state>(); | |
| 133 | int code = state->bg1ram[tile_index]; | |
| 134 | int color = state->bg1ram[tile_index+0x100]; | |
| 136 | 135 | /* Todo - may be tile flip bits? */ |
| 137 | 136 | |
| 138 | 137 | SET_TILE_INFO(2, code, color>>4, 0); |
| r10886 | r10887 | |
| 140 | 139 | |
| 141 | 140 | static TILE_GET_INFO( get_text_tile_info ) |
| 142 | 141 | { |
| 143 | int code = flower_textram[tile_index]; | |
| 144 | int color = flower_textram[tile_index+0x400]; | |
| 142 | flower_state *state = machine->driver_data<flower_state>(); | |
| 143 | int code = state->textram[tile_index]; | |
| 144 | int color = state->textram[tile_index+0x400]; | |
| 145 | 145 | /* Todo - may be tile flip bits? */ |
| 146 | 146 | |
| 147 | 147 | SET_TILE_INFO(0, code, color>>2, 0); |
| r10886 | r10887 | |
| 149 | 149 | |
| 150 | 150 | VIDEO_START(flower) |
| 151 | 151 | { |
| 152 | flower_bg0_tilemap = tilemap_create(machine, get_bg0_tile_info, tilemap_scan_rows, 16,16,16,16); | |
| 153 | flower_bg1_tilemap = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows,16,16,16,16); | |
| 154 | flower_text_tilemap = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8, 8,32,32); | |
| 155 | flower_text_right_tilemap = tilemap_create(machine, get_text_tile_info,tilemap_scan_cols, 8, 8, 2,32); | |
| 152 | flower_state *state = machine->driver_data<flower_state>(); | |
| 153 | state->bg0_tilemap = tilemap_create(machine, get_bg0_tile_info, tilemap_scan_rows, 16,16,16,16); | |
| 154 | state->bg1_tilemap = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows,16,16,16,16); | |
| 155 | state->text_tilemap = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8, 8,32,32); | |
| 156 | state->text_right_tilemap = tilemap_create(machine, get_text_tile_info,tilemap_scan_cols, 8, 8, 2,32); | |
| 156 | 157 | |
| 157 | tilemap_set_transparent_pen(flower_bg1_tilemap,15); | |
| 158 | tilemap_set_transparent_pen(flower_text_tilemap,3); | |
| 159 | tilemap_set_transparent_pen(flower_text_right_tilemap,3); | |
| 158 | tilemap_set_transparent_pen(state->bg1_tilemap,15); | |
| 159 | tilemap_set_transparent_pen(state->text_tilemap,3); | |
| 160 | tilemap_set_transparent_pen(state->text_right_tilemap,3); | |
| 160 | 161 | |
| 161 | tilemap_set_scrolly(flower_text_tilemap, 0, 16); | |
| 162 | tilemap_set_scrolly(flower_text_right_tilemap, 0, 16); | |
| 162 | tilemap_set_scrolly(state->text_tilemap, 0, 16); | |
| 163 | tilemap_set_scrolly(state->text_right_tilemap, 0, 16); | |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | 166 | SCREEN_UPDATE( flower ) |
| 166 | 167 | { |
| 168 | flower_state *state = screen->machine->driver_data<flower_state>(); | |
| 167 | 169 | rectangle myclip = *cliprect; |
| 168 | 170 | |
| 169 | tilemap_set_scrolly(flower_bg0_tilemap,0, flower_bg0_scroll[0]+16); | |
| 170 | tilemap_set_scrolly(flower_bg1_tilemap,0, flower_bg1_scroll[0]+16); | |
| 171 | tilemap_set_scrolly(state->bg0_tilemap,0, state->bg0_scroll[0]+16); | |
| 172 | tilemap_set_scrolly(state->bg1_tilemap,0, state->bg1_scroll[0]+16); | |
| 171 | 173 | |
| 172 | tilemap_draw(bitmap,cliprect,flower_bg0_tilemap,0,0); | |
| 173 | tilemap_draw(bitmap,cliprect,flower_bg1_tilemap,0,0); | |
| 174 | tilemap_draw(bitmap,cliprect,state->bg0_tilemap,0,0); | |
| 175 | tilemap_draw(bitmap,cliprect,state->bg1_tilemap,0,0); | |
| 174 | 176 | |
| 175 | 177 | draw_sprites(screen->machine,bitmap,cliprect); |
| 176 | 178 | |
| r10886 | r10887 | |
| 185 | 187 | myclip.max_x = cliprect->max_x; |
| 186 | 188 | } |
| 187 | 189 | |
| 188 | tilemap_draw(bitmap,cliprect,flower_text_tilemap,0,0); | |
| 189 | tilemap_draw(bitmap,&myclip,flower_text_right_tilemap,0,0); | |
| 190 | tilemap_draw(bitmap,cliprect,state->text_tilemap,0,0); | |
| 191 | tilemap_draw(bitmap,&myclip,state->text_right_tilemap,0,0); | |
| 190 | 192 | return 0; |
| 191 | 193 | } |
| 192 | 194 | |
| 193 | 195 | WRITE8_HANDLER( flower_textram_w ) |
| 194 | 196 | { |
| 195 | flower_textram[offset] = data; | |
| 196 | tilemap_mark_tile_dirty(flower_text_tilemap, offset); | |
| 197 | tilemap_mark_all_tiles_dirty(flower_text_right_tilemap); | |
| 197 | flower_state *state = space->machine->driver_data<flower_state>(); | |
| 198 | state->textram[offset] = data; | |
| 199 | tilemap_mark_tile_dirty(state->text_tilemap, offset); | |
| 200 | tilemap_mark_all_tiles_dirty(state->text_right_tilemap); | |
| 198 | 201 | } |
| 199 | 202 | |
| 200 | 203 | WRITE8_HANDLER( flower_bg0ram_w ) |
| 201 | 204 | { |
| 202 | flower_bg0ram[offset] = data; | |
| 203 | tilemap_mark_tile_dirty(flower_bg0_tilemap, offset & 0x1ff); | |
| 205 | flower_state *state = space->machine->driver_data<flower_state>(); | |
| 206 | state->bg0ram[offset] = data; | |
| 207 | tilemap_mark_tile_dirty(state->bg0_tilemap, offset & 0x1ff); | |
| 204 | 208 | } |
| 205 | 209 | |
| 206 | 210 | WRITE8_HANDLER( flower_bg1ram_w ) |
| 207 | 211 | { |
| 208 | flower_bg1ram[offset] = data; | |
| 209 | tilemap_mark_tile_dirty(flower_bg1_tilemap, offset & 0x1ff); | |
| 212 | flower_state *state = space->machine->driver_data<flower_state>(); | |
| 213 | state->bg1ram[offset] = data; | |
| 214 | tilemap_mark_tile_dirty(state->bg1_tilemap, offset & 0x1ff); | |
| 210 | 215 | } |
| 211 | 216 | |
| 212 | 217 | WRITE8_HANDLER( flower_flipscreen_w ) |
| r10886 | r10887 | |
|---|---|---|
| 305 | 305 | { |
| 306 | 306 | astrocde_state *state = screen->machine->driver_data<astrocde_state>(); |
| 307 | 307 | UINT8 *videoram = state->videoram; |
| 308 | UINT32 sparklebase = 0; | |
| 309 | const int colormask = (astrocade_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; | |
| 308 | 310 | int xystep = 2 - video_mode; |
| 309 | UINT32 sparklebase = 0; | |
| 310 | 311 | int y; |
| 311 | 312 | |
| 312 | 313 | /* compute the starting point of sparkle for the current frame */ |
| r10886 | r10887 | |
| 349 | 350 | for (xx = 0; xx < 4; xx++) |
| 350 | 351 | { |
| 351 | 352 | UINT8 pixdata = (data >> 6) & 3; |
| 352 | int coldata = colorbase[pixdata] << 1; | |
| 353 | int luma = coldata & 0x0f; | |
| 353 | int colordata = colorbase[pixdata] << 1; | |
| 354 | int luma = colordata & 0x0f; | |
| 354 | 355 | rgb_t color; |
| 355 | 356 | |
| 356 | 357 | /* handle stars/sparkle */ |
| r10886 | r10887 | |
| 363 | 364 | if (pixdata != 0 || (sparklestar[staroffs] & 0x10)) |
| 364 | 365 | luma = sparklestar[sparkleoffs] & 0x0f; |
| 365 | 366 | else if (pixdata == 0) |
| 366 | coldata = luma = 0; | |
| 367 | colordata = luma = 0; | |
| 367 | 368 | } |
| 368 | 369 | |
| 369 | 370 | /* update sparkle/star offsets */ |
| r10886 | r10887 | |
| 371 | 372 | if (++sparkleoffs >= RNG_PERIOD) |
| 372 | 373 | sparkleoffs = 0; |
| 373 | 374 | } |
| 374 | color = (coldata & | |
| 375 | color = (colordata & colormask) | luma; | |
| 375 | 376 | |
| 376 | 377 | /* store the final color to the destination and shift */ |
| 377 | 378 | *dest++ = color; |
| r10886 | r10887 | |
|---|---|---|
| 44 | 44 | Koi no Hotrock |
| 45 | 45 | Mr Kabuki/Mr Goemon GX621*1986 Z80 005849 |
| 46 | 46 | Jackal GX631*1986 6809 005885(x2) 007327 007343 (address decoder) |
| 47 | Contra / Gryzor GX633*1987 6 | |
| 47 | Contra / Gryzor GX633*1987 6309 007121(x2) 007593 | |
| 48 | 48 | Flak Attack GX669*1987 6309 007121 007327 007452 |
| 49 | 49 | Devil World / Dark GX687*1987 2x68000 TWIN16 |
| 50 | 50 | Adventure / Majuu no Oukoku |
| r10886 | r10887 | |
|---|---|---|
| 31 | 31 | #include "emu.h" |
| 32 | 32 | #include "includes/thedeep.h" |
| 33 | 33 | |
| 34 | /* Variables only used here: */ | |
| 35 | 34 | |
| 36 | static tilemap_t *tilemap_0,*tilemap_1; | |
| 37 | ||
| 38 | /* Variables & functions needed by drivers: */ | |
| 39 | ||
| 40 | UINT8 *thedeep_vram_0, *thedeep_vram_1; | |
| 41 | UINT8 *thedeep_scroll, *thedeep_scroll2; | |
| 42 | ||
| 43 | ||
| 44 | 35 | /*************************************************************************** |
| 45 | 36 | |
| 46 | 37 | Callbacks for the TileMap code |
| r10886 | r10887 | |
| 54 | 45 | |
| 55 | 46 | static TILE_GET_INFO( get_tile_info_0 ) |
| 56 | 47 | { |
| 57 | UINT8 code = thedeep_vram_0[ tile_index * 2 + 0 ]; | |
| 58 | UINT8 color = thedeep_vram_0[ tile_index * 2 + 1 ]; | |
| 48 | thedeep_state *state = machine->driver_data<thedeep_state>(); | |
| 49 | UINT8 code = state->vram_0[ tile_index * 2 + 0 ]; | |
| 50 | UINT8 color = state->vram_0[ tile_index * 2 + 1 ]; | |
| 59 | 51 | SET_TILE_INFO( |
| 60 | 52 | 1, |
| 61 | 53 | code + (color << 8), |
| r10886 | r10887 | |
| 65 | 57 | |
| 66 | 58 | static TILE_GET_INFO( get_tile_info_1 ) |
| 67 | 59 | { |
| 68 | UINT8 code = thedeep_vram_1[ tile_index * 2 + 0 ]; | |
| 69 | UINT8 color = thedeep_vram_1[ tile_index * 2 + 1 ]; | |
| 60 | thedeep_state *state = machine->driver_data<thedeep_state>(); | |
| 61 | UINT8 code = state->vram_1[ tile_index * 2 + 0 ]; | |
| 62 | UINT8 color = state->vram_1[ tile_index * 2 + 1 ]; | |
| 70 | 63 | SET_TILE_INFO( |
| 71 | 64 | 2, |
| 72 | 65 | code + (color << 8), |
| r10886 | r10887 | |
| 76 | 69 | |
| 77 | 70 | WRITE8_HANDLER( thedeep_vram_0_w ) |
| 78 | 71 | { |
| 79 | thedeep_vram_0[offset] = data; | |
| 80 | tilemap_mark_tile_dirty(tilemap_0, offset / 2); | |
| 72 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 73 | state->vram_0[offset] = data; | |
| 74 | tilemap_mark_tile_dirty(state->tilemap_0, offset / 2); | |
| 81 | 75 | } |
| 82 | 76 | |
| 83 | 77 | WRITE8_HANDLER( thedeep_vram_1_w ) |
| 84 | 78 | { |
| 85 | thedeep_vram_1[offset] = data; | |
| 86 | tilemap_mark_tile_dirty(tilemap_1, offset / 2); | |
| 79 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 80 | state->vram_1[offset] = data; | |
| 81 | tilemap_mark_tile_dirty(state->tilemap_1, offset / 2); | |
| 87 | 82 | } |
| 88 | 83 | |
| 89 | 84 | |
| r10886 | r10887 | |
| 108 | 103 | |
| 109 | 104 | VIDEO_START( thedeep ) |
| 110 | 105 | { |
| 111 | tilemap_0 = tilemap_create(machine, get_tile_info_0,tilemap_scan_rows_back,16,16,0x20,0x20); | |
| 112 | tilemap_1 = tilemap_create(machine, get_tile_info_1,tilemap_scan_rows,8,8,0x20,0x20); | |
| 106 | thedeep_state *state = machine->driver_data<thedeep_state>(); | |
| 107 | state->tilemap_0 = tilemap_create(machine, get_tile_info_0,tilemap_scan_rows_back,16,16,0x20,0x20); | |
| 108 | state->tilemap_1 = tilemap_create(machine, get_tile_info_1,tilemap_scan_rows,8,8,0x20,0x20); | |
| 113 | 109 | |
| 114 | tilemap_set_transparent_pen( tilemap_0, 0 ); | |
| 115 | tilemap_set_transparent_pen( tilemap_1, 0 ); | |
| 110 | tilemap_set_transparent_pen( state->tilemap_0, 0 ); | |
| 111 | tilemap_set_transparent_pen( state->tilemap_1, 0 ); | |
| 116 | 112 | |
| 117 | tilemap_set_scroll_cols(tilemap_0, 0x20); // column scroll for the background | |
| 113 | tilemap_set_scroll_cols(state->tilemap_0, 0x20); // column scroll for the background | |
| 118 | 114 | } |
| 119 | 115 | |
| 120 | 116 | /*************************************************************************** |
| r10886 | r10887 | |
| 215 | 211 | |
| 216 | 212 | SCREEN_UPDATE( thedeep ) |
| 217 | 213 | { |
| 218 | int scrollx = thedeep_scroll[0] + (thedeep_scroll[1]<<8); | |
| 219 | int scrolly = thedeep_scroll[2] + (thedeep_scroll[3]<<8); | |
| 214 | thedeep_state *state = screen->machine->driver_data<thedeep_state>(); | |
| 215 | int scrollx = state->scroll[0] + (state->scroll[1]<<8); | |
| 216 | int scrolly = state->scroll[2] + (state->scroll[3]<<8); | |
| 220 | 217 | int x; |
| 221 | 218 | |
| 222 | tilemap_set_scrollx(tilemap_0, 0, scrollx); | |
| 219 | tilemap_set_scrollx(state->tilemap_0, 0, scrollx); | |
| 223 | 220 | |
| 224 | 221 | for (x = 0; x < 0x20; x++) |
| 225 | 222 | { |
| 226 | int y = thedeep_scroll2[x*2+0] + (thedeep_scroll2[x*2+1]<<8); | |
| 227 | tilemap_set_scrolly(tilemap_0, x, y + scrolly); | |
| 223 | int y = state->scroll2[x*2+0] + (state->scroll2[x*2+1]<<8); | |
| 224 | tilemap_set_scrolly(state->tilemap_0, x, y + scrolly); | |
| 228 | 225 | } |
| 229 | 226 | |
| 230 | 227 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 231 | 228 | |
| 232 | tilemap_draw(bitmap,cliprect,tilemap_0,0,0); | |
| 229 | tilemap_draw(bitmap,cliprect,state->tilemap_0,0,0); | |
| 233 | 230 | draw_sprites(screen->machine, bitmap,cliprect); |
| 234 | tilemap_draw(bitmap,cliprect,tilemap_1,0,0); | |
| 231 | tilemap_draw(bitmap,cliprect,state->tilemap_1,0,0); | |
| 235 | 232 | return 0; |
| 236 | 233 | } |
| r10886 | r10887 | |
|---|---|---|
| 44 | 44 | Koi no Hotrock |
| 45 | 45 | Mr Kabuki/Mr Goemon GX621*1986 Z80 005849 |
| 46 | 46 | Jackal GX631*1986 6809 005885(x2) 007327 007343 (address decoder) |
| 47 | Contra / Gryzor GX633*1987 6 | |
| 47 | Contra / Gryzor GX633*1987 6309 007121(x2) 007593 | |
| 48 | 48 | Flak Attack GX669*1987 6309 007121 007327 007452 |
| 49 | 49 | Devil World / Dark GX687*1987 2x68000 TWIN16 |
| 50 | 50 | Adventure / Majuu no Oukoku |
| r10886 | r10887 | |
|---|---|---|
| 212 | 212 | #define DARIUSG_KLUDGE |
| 213 | 213 | //#define DEBUG_F3 1 |
| 214 | 214 | |
| 215 | static tilemap_t *pf1_tilemap,*pf2_tilemap,*pf3_tilemap,*pf4_tilemap; | |
| 216 | static tilemap_t *pixel_layer,*vram_layer; | |
| 217 | static UINT32 *spriteram32_buffered; | |
| 218 | static UINT32 f3_control_0[8]; | |
| 219 | static UINT32 f3_control_1[8]; | |
| 220 | static int flipscreen; | |
| 221 | static UINT8 sprite_extra_planes; | |
| 222 | static UINT8 sprite_pen_mask; | |
| 223 | 215 | |
| 224 | static UINT32 *f3_pf_data_1,*f3_pf_data_2,*f3_pf_data_3,*f3_pf_data_4; | |
| 225 | ||
| 226 | UINT32 *f3_vram,*f3_line_ram; | |
| 227 | UINT32 *f3_pf_data,*f3_pivot_ram; | |
| 228 | ||
| 229 | static int f3_skip_this_frame; | |
| 230 | ||
| 231 | 216 | /* Game specific data, some of this can be |
| 232 | 217 | removed when the software values are figured out */ |
| 233 | 218 | struct F3config |
| r10886 | r10887 | |
| 237 | 222 | int sprite_lag; |
| 238 | 223 | }; |
| 239 | 224 | |
| 240 | static const struct F3config *f3_game_config; | |
| 241 | ||
| 242 | 225 | static const struct F3config f3_config_table[] = |
| 243 | 226 | { |
| 244 | 227 | /* Name Extend Lag */ |
| r10886 | r10887 | |
| 286 | 269 | int zoomx,zoomy; |
| 287 | 270 | int pri; |
| 288 | 271 | }; |
| 289 | static struct tempsprite *spritelist; | |
| 290 | static const struct tempsprite *sprite_end; | |
| 291 | 272 | |
| 292 | 273 | static void get_sprite_info(running_machine *machine, const UINT32 *spriteram32_ptr); |
| 293 | static int sprite_lag; | |
| 294 | static UINT8 sprite_pri_usage=0; | |
| 295 | 274 | |
| 296 | 275 | struct f3_playfield_line_inf |
| 297 | 276 | { |
| r10886 | r10887 | |
| 328 | 307 | 1-------- opaque line |
| 329 | 308 | */ |
| 330 | 309 | |
| 331 | static struct f3_playfield_line_inf *pf_line_inf; | |
| 332 | static struct f3_spritealpha_line_inf *sa_line_inf; | |
| 333 | 310 | |
| 334 | ||
| 335 | static bitmap_t *pri_alp_bitmap; | |
| 336 | 311 | /* |
| 337 | 312 | pri_alp_bitmap |
| 338 | 313 | ---- ---1 sprite priority 0 |
| r10886 | r10887 | |
| 345 | 320 | 1--- ---- alpha level b b000 |
| 346 | 321 | 1111 1111 opaque pixel |
| 347 | 322 | */ |
| 348 | static int f3_alpha_level_2as; | |
| 349 | static int f3_alpha_level_2ad; | |
| 350 | static int f3_alpha_level_3as; | |
| 351 | static int f3_alpha_level_3ad; | |
| 352 | static int f3_alpha_level_2bs; | |
| 353 | static int f3_alpha_level_2bd; | |
| 354 | static int f3_alpha_level_3bs; | |
| 355 | static int f3_alpha_level_3bd; | |
| 356 | static int alpha_level_last; | |
| 357 | 323 | |
| 358 | static void init_alpha_blend_func( | |
| 324 | static void init_alpha_blend_func(running_machine *machine); | |
| 359 | 325 | |
| 360 | static int width_mask; | |
| 361 | static int twidth_mask; | |
| 362 | static int twidth_mask_bit; | |
| 363 | ||
| 364 | static UINT8 *tile_opaque_sp; | |
| 365 | static UINT8 *tile_opaque_pf[4]; | |
| 366 | ||
| 367 | ||
| 368 | static UINT8 add_sat[256][256]; | |
| 369 | ||
| 370 | static int alpha_s_1_1; | |
| 371 | static int alpha_s_1_2; | |
| 372 | static int alpha_s_1_4; | |
| 373 | static int alpha_s_1_5; | |
| 374 | static int alpha_s_1_6; | |
| 375 | static int alpha_s_1_8; | |
| 376 | static int alpha_s_1_9; | |
| 377 | static int alpha_s_1_a; | |
| 378 | ||
| 379 | static int alpha_s_2a_0; | |
| 380 | static int alpha_s_2a_4; | |
| 381 | static int alpha_s_2a_8; | |
| 382 | ||
| 383 | static int alpha_s_2b_0; | |
| 384 | static int alpha_s_2b_4; | |
| 385 | static int alpha_s_2b_8; | |
| 386 | ||
| 387 | static int alpha_s_3a_0; | |
| 388 | static int alpha_s_3a_1; | |
| 389 | static int alpha_s_3a_2; | |
| 390 | ||
| 391 | static int alpha_s_3b_0; | |
| 392 | static int alpha_s_3b_1; | |
| 393 | static int alpha_s_3b_2; | |
| 394 | ||
| 395 | static UINT32 dval; | |
| 396 | static UINT8 pval; | |
| 397 | static UINT8 tval; | |
| 398 | static UINT8 pdest_2a; | |
| 399 | static UINT8 pdest_2b; | |
| 400 | static int tr_2a; | |
| 401 | static int tr_2b; | |
| 402 | static UINT8 pdest_3a; | |
| 403 | static UINT8 pdest_3b; | |
| 404 | static int tr_3a; | |
| 405 | static int tr_3b; | |
| 406 | ||
| 407 | static int (*dpix_n[8][16])(UINT32 s_pix); | |
| 408 | static int (**dpix_lp[5])(UINT32 s_pix); | |
| 409 | static int (**dpix_sp[9])(UINT32 s_pix); | |
| 410 | ||
| 411 | ||
| 412 | 326 | /******************************************************************************/ |
| 413 | 327 | |
| 414 | 328 | static void print_debug_info(running_machine *machine, bitmap_t *bitmap) |
| 415 | 329 | { |
| 330 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 331 | UINT32 *f3_line_ram = state->f3_line_ram; | |
| 416 | 332 | int l[16]; |
| 417 | 333 | char buf[64*16]; |
| 418 | 334 | char *bufptr = buf; |
| 419 | 335 | |
| 420 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",f3_control_0[0]>>22,(f3_control_0[0]&0xffff)>>6,f3_control_0[1]>>22,(f3_control_0[1]&0xffff)>>6); | |
| 421 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",f3_control_0[2]>>23,(f3_control_0[2]&0xffff)>>7,f3_control_0[3]>>23,(f3_control_0[3]&0xffff)>>7); | |
| 422 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",f3_control_1[0]>>16,f3_control_1[0]&0xffff,f3_control_1[1]>>16,f3_control_1[1]&0xffff); | |
| 423 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",f3_control_1[2]>>16,f3_control_1[2]&0xffff,f3_control_1[3]>>16,f3_control_1[3]&0xffff); | |
| 336 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->f3_control_0[0]>>22,(state->f3_control_0[0]&0xffff)>>6,state->f3_control_0[1]>>22,(state->f3_control_0[1]&0xffff)>>6); | |
| 337 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->f3_control_0[2]>>23,(state->f3_control_0[2]&0xffff)>>7,state->f3_control_0[3]>>23,(state->f3_control_0[3]&0xffff)>>7); | |
| 338 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->f3_control_1[0]>>16,state->f3_control_1[0]&0xffff,state->f3_control_1[1]>>16,state->f3_control_1[1]&0xffff); | |
| 339 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X\n",state->f3_control_1[2]>>16,state->f3_control_1[2]&0xffff,state->f3_control_1[3]>>16,state->f3_control_1[3]&0xffff); | |
| 424 | 340 | |
| 425 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",spriteram32_buffered[0]>>16,spriteram32_buffered[0]&0xffff,spriteram32_buffered[1]>>16,spriteram32_buffered[1]&0xffff,spriteram32_buffered[2]>>16,spriteram32_buffered[2]&0xffff,spriteram32_buffered[3]>>16,spriteram32_buffered[3]&0xffff); | |
| 426 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",spriteram32_buffered[4]>>16,spriteram32_buffered[4]&0xffff,spriteram32_buffered[5]>>16,spriteram32_buffered[5]&0xffff,spriteram32_buffered[6]>>16,spriteram32_buffered[6]&0xffff,spriteram32_buffered[7]>>16,spriteram32_buffered[7]&0xffff); | |
| 427 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",spriteram32_buffered[8]>>16,spriteram32_buffered[8]&0xffff,spriteram32_buffered[9]>>16,spriteram32_buffered[9]&0xffff,spriteram32_buffered[10]>>16,spriteram32_buffered[10]&0xffff,spriteram32_buffered[11]>>16,spriteram32_buffered[11]&0xffff); | |
| 341 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->spriteram32_buffered[0]>>16,state->spriteram32_buffered[0]&0xffff,state->spriteram32_buffered[1]>>16,state->spriteram32_buffered[1]&0xffff,state->spriteram32_buffered[2]>>16,state->spriteram32_buffered[2]&0xffff,state->spriteram32_buffered[3]>>16,state->spriteram32_buffered[3]&0xffff); | |
| 342 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->spriteram32_buffered[4]>>16,state->spriteram32_buffered[4]&0xffff,state->spriteram32_buffered[5]>>16,state->spriteram32_buffered[5]&0xffff,state->spriteram32_buffered[6]>>16,state->spriteram32_buffered[6]&0xffff,state->spriteram32_buffered[7]>>16,state->spriteram32_buffered[7]&0xffff); | |
| 343 | bufptr += sprintf(bufptr,"%04X %04X %04X %04X %04X %04X %04X %04X\n",state->spriteram32_buffered[8]>>16,state->spriteram32_buffered[8]&0xffff,state->spriteram32_buffered[9]>>16,state->spriteram32_buffered[9]&0xffff,state->spriteram32_buffered[10]>>16,state->spriteram32_buffered[10]&0xffff,state->spriteram32_buffered[11]>>16,state->spriteram32_buffered[11]&0xffff); | |
| 428 | 344 | |
| 429 | 345 | l[0]=f3_line_ram[0x0040]&0xffff; |
| 430 | 346 | l[1]=f3_line_ram[0x00c0]&0xffff; |
| r10886 | r10887 | |
| 505 | 421 | |
| 506 | 422 | static TILE_GET_INFO( get_tile_info1 ) |
| 507 | 423 | { |
| 508 | get_tile_info(machine,tileinfo,tile_index,f3_pf_data_1); | |
| 424 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 425 | get_tile_info(machine,tileinfo,tile_index,state->f3_pf_data_1); | |
| 509 | 426 | } |
| 510 | 427 | |
| 511 | 428 | static TILE_GET_INFO( get_tile_info2 ) |
| 512 | 429 | { |
| 513 | get_tile_info(machine,tileinfo,tile_index,f3_pf_data_2); | |
| 430 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 431 | get_tile_info(machine,tileinfo,tile_index,state->f3_pf_data_2); | |
| 514 | 432 | } |
| 515 | 433 | |
| 516 | 434 | static TILE_GET_INFO( get_tile_info3 ) |
| 517 | 435 | { |
| 518 | get_tile_info(machine,tileinfo,tile_index,f3_pf_data_3); | |
| 436 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 437 | get_tile_info(machine,tileinfo,tile_index,state->f3_pf_data_3); | |
| 519 | 438 | } |
| 520 | 439 | |
| 521 | 440 | static TILE_GET_INFO( get_tile_info4 ) |
| 522 | 441 | { |
| 523 | get_tile_info(machine,tileinfo,tile_index,f3_pf_data_4); | |
| 442 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 443 | get_tile_info(machine,tileinfo,tile_index,state->f3_pf_data_4); | |
| 524 | 444 | } |
| 525 | 445 | |
| 526 | 446 | static TILE_GET_INFO( get_tile_info_vram ) |
| r10886 | r10887 | |
| 551 | 471 | UINT32 *videoram = state->videoram; |
| 552 | 472 | int vram_tile,col_off; |
| 553 | 473 | int flags=0; |
| 554 | int y_offs=(f3_control_1[2]&0x1ff); | |
| 555 | if (flipscreen) y_offs+=0x100; | |
| 474 | int y_offs=(state->f3_control_1[2]&0x1ff); | |
| 475 | if (state->flipscreen) y_offs+=0x100; | |
| 556 | 476 | |
| 557 | 477 | /* Colour is shared with VRAM layer */ |
| 558 | 478 | if ((((tile_index%32)*8 + y_offs)&0x1ff)>0xff) |
| r10886 | r10887 | |
| 580 | 500 | SCREEN_EOF( f3 ) |
| 581 | 501 | { |
| 582 | 502 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); |
| 583 | if (sprite_lag==2) | |
| 503 | if (state->sprite_lag==2) | |
| 584 | 504 | { |
| 585 | 505 | if (machine->video().skip_this_frame() == 0) |
| 586 | 506 | { |
| 587 | get_sprite_info(machine, spriteram32_buffered); | |
| 507 | get_sprite_info(machine, state->spriteram32_buffered); | |
| 588 | 508 | } |
| 589 | memcpy(spriteram32_buffered,state->spriteram,state->spriteram_size); | |
| 509 | memcpy(state->spriteram32_buffered,state->spriteram,state->spriteram_size); | |
| 590 | 510 | } |
| 591 | else if (sprite_lag==1) | |
| 511 | else if (state->sprite_lag==1) | |
| 592 | 512 | { |
| 593 | 513 | if (machine->video().skip_this_frame() == 0) |
| 594 | 514 | { |
| r10886 | r10887 | |
| 603 | 523 | const struct F3config *pCFG=&f3_config_table[0]; |
| 604 | 524 | int width, height, i; |
| 605 | 525 | |
| 606 | f3_alpha_level_2as=127; | |
| 607 | f3_alpha_level_2ad=127; | |
| 608 | f3_alpha_level_3as=127; | |
| 609 | f3_alpha_level_3ad=127; | |
| 610 | f3_alpha_level_2bs=127; | |
| 611 | f3_alpha_level_2bd=127; | |
| 612 | f3_alpha_level_3bs=127; | |
| 613 | f3_alpha_level_3bd=127; | |
| 614 | alpha_level_last = -1; | |
| 526 | state->f3_alpha_level_2as=127; | |
| 527 | state->f3_alpha_level_2ad=127; | |
| 528 | state->f3_alpha_level_3as=127; | |
| 529 | state->f3_alpha_level_3ad=127; | |
| 530 | state->f3_alpha_level_2bs=127; | |
| 531 | state->f3_alpha_level_2bd=127; | |
| 532 | state->f3_alpha_level_3bs=127; | |
| 533 | state->f3_alpha_level_3bd=127; | |
| 534 | state->alpha_level_last = -1; | |
| 615 | 535 | |
| 616 | pdest_2a = 0x10; | |
| 617 | pdest_2b = 0x20; | |
| 618 | tr_2a = 0; | |
| 619 | tr_2b = 1; | |
| 620 | pdest_3a = 0x40; | |
| 621 | pdest_3b = 0x80; | |
| 622 | tr_3a = 0; | |
| 623 | tr_3b = 1; | |
| 536 | state->pdest_2a = 0x10; | |
| 537 | state->pdest_2b = 0x20; | |
| 538 | state->tr_2a = 0; | |
| 539 | state->tr_2b = 1; | |
| 540 | state->pdest_3a = 0x40; | |
| 541 | state->pdest_3b = 0x80; | |
| 542 | state->tr_3a = 0; | |
| 543 | state->tr_3b = 1; | |
| 624 | 544 | |
| 625 | spritelist=0; | |
| 626 | spriteram32_buffered=0; | |
| 627 | pf_line_inf=0; | |
| 628 | pri_alp_bitmap=0; | |
| 629 | tile_opaque_sp=0; | |
| 545 | state->spritelist=0; | |
| 546 | state->spriteram32_buffered=0; | |
| 547 | state->pf_line_inf=0; | |
| 548 | state->pri_alp_bitmap=0; | |
| 549 | state->tile_opaque_sp=0; | |
| 630 | 550 | |
| 631 | 551 | /* Setup individual game */ |
| 632 | 552 | do { |
| 633 | if (pCFG->name==f3_game) | |
| 553 | if (pCFG->name==state->f3_game) | |
| 634 | 554 | { |
| 635 | 555 | break; |
| 636 | 556 | } |
| 637 | 557 | pCFG++; |
| 638 | 558 | } while(pCFG->name); |
| 639 | 559 | |
| 640 | f3_game_config=pCFG; | |
| 560 | state->f3_game_config=pCFG; | |
| 641 | 561 | |
| 642 | if (f3_game_config->extend) { | |
| 643 | pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,64,32); | |
| 644 | pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,64,32); | |
| 645 | pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,64,32); | |
| 646 | pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,64,32); | |
| 562 | if (state->f3_game_config->extend) { | |
| 563 | state->pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,64,32); | |
| 564 | state->pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,64,32); | |
| 565 | state->pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,64,32); | |
| 566 | state->pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,64,32); | |
| 647 | 567 | |
| 648 | f3_pf_data_1=f3_pf_data+0x0000; | |
| 649 | f3_pf_data_2=f3_pf_data+0x0800; | |
| 650 | f3_pf_data_3=f3_pf_data+0x1000; | |
| 651 | f3_pf_data_4=f3_pf_data+0x1800; | |
| 568 | state->f3_pf_data_1=state->f3_pf_data+0x0000; | |
| 569 | state->f3_pf_data_2=state->f3_pf_data+0x0800; | |
| 570 | state->f3_pf_data_3=state->f3_pf_data+0x1000; | |
| 571 | state->f3_pf_data_4=state->f3_pf_data+0x1800; | |
| 652 | 572 | |
| 653 | width_mask=0x3ff; | |
| 654 | twidth_mask=0x3f; | |
| 655 | twidth_mask_bit=6; | |
| 573 | state->width_mask=0x3ff; | |
| 574 | state->twidth_mask=0x3f; | |
| 575 | state->twidth_mask_bit=6; | |
| 656 | 576 | |
| 657 | 577 | } else { |
| 658 | pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,32,32); | |
| 659 | pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,32,32); | |
| 660 | pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,32,32); | |
| 661 | pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,32,32); | |
| 578 | state->pf1_tilemap = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,32,32); | |
| 579 | state->pf2_tilemap = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,32,32); | |
| 580 | state->pf3_tilemap = tilemap_create(machine, get_tile_info3,tilemap_scan_rows,16,16,32,32); | |
| 581 | state->pf4_tilemap = tilemap_create(machine, get_tile_info4,tilemap_scan_rows,16,16,32,32); | |
| 662 | 582 | |
| 663 | f3_pf_data_1=f3_pf_data+0x0000; | |
| 664 | f3_pf_data_2=f3_pf_data+0x0400; | |
| 665 | f3_pf_data_3=f3_pf_data+0x0800; | |
| 666 | f3_pf_data_4=f3_pf_data+0x0c00; | |
| 583 | state->f3_pf_data_1=state->f3_pf_data+0x0000; | |
| 584 | state->f3_pf_data_2=state->f3_pf_data+0x0400; | |
| 585 | state->f3_pf_data_3=state->f3_pf_data+0x0800; | |
| 586 | state->f3_pf_data_4=state->f3_pf_data+0x0c00; | |
| 667 | 587 | |
| 668 | width_mask=0x1ff; | |
| 669 | twidth_mask=0x1f; | |
| 670 | twidth_mask_bit=5; | |
| 588 | state->width_mask=0x1ff; | |
| 589 | state->twidth_mask=0x1f; | |
| 590 | state->twidth_mask_bit=5; | |
| 671 | 591 | } |
| 672 | 592 | |
| 673 | spriteram32_buffered = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 674 | spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); | |
| 675 | sprite_end = spritelist; | |
| 676 | vram_layer = tilemap_create(machine, get_tile_info_vram,tilemap_scan_rows,8,8,64,64); | |
| 677 | pixel_layer = tilemap_create(machine, get_tile_info_pixel,tilemap_scan_cols,8,8,64,32); | |
| 678 | pf_line_inf = auto_alloc_array(machine, struct f3_playfield_line_inf, 5); | |
| 679 | sa_line_inf = auto_alloc_array(machine, struct f3_spritealpha_line_inf, 1); | |
| 593 | state->spriteram32_buffered = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 594 | state->spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); | |
| 595 | state->sprite_end = state->spritelist; | |
| 596 | state->vram_layer = tilemap_create(machine, get_tile_info_vram,tilemap_scan_rows,8,8,64,64); | |
| 597 | state->pixel_layer = tilemap_create(machine, get_tile_info_pixel,tilemap_scan_cols,8,8,64,32); | |
| 598 | state->pf_line_inf = auto_alloc_array(machine, struct f3_playfield_line_inf, 5); | |
| 599 | state->sa_line_inf = auto_alloc_array(machine, struct f3_spritealpha_line_inf, 1); | |
| 680 | 600 | width = machine->primary_screen->width(); |
| 681 | 601 | height = machine->primary_screen->height(); |
| 682 | pri_alp_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8 ); | |
| 683 | tile_opaque_sp = auto_alloc_array(machine, UINT8, machine->gfx[2]->total_elements); | |
| 602 | state->pri_alp_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8 ); | |
| 603 | state->tile_opaque_sp = auto_alloc_array(machine, UINT8, machine->gfx[2]->total_elements); | |
| 684 | 604 | for (i=0; i<4; i++) |
| 685 | tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine->gfx[1]->total_elements); | |
| 605 | state->tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine->gfx[1]->total_elements); | |
| 686 | 606 | |
| 687 | tilemap_set_transparent_pen(pf1_tilemap,0); | |
| 688 | tilemap_set_transparent_pen(pf2_tilemap,0); | |
| 689 | tilemap_set_transparent_pen(pf3_tilemap,0); | |
| 690 | tilemap_set_transparent_pen(pf4_tilemap,0); | |
| 691 | tilemap_set_transparent_pen(vram_layer,0); | |
| 692 | tilemap_set_transparent_pen(pixel_layer,0); | |
| 607 | tilemap_set_transparent_pen(state->pf1_tilemap,0); | |
| 608 | tilemap_set_transparent_pen(state->pf2_tilemap,0); | |
| 609 | tilemap_set_transparent_pen(state->pf3_tilemap,0); | |
| 610 | tilemap_set_transparent_pen(state->pf4_tilemap,0); | |
| 611 | tilemap_set_transparent_pen(state->vram_layer,0); | |
| 612 | tilemap_set_transparent_pen(state->pixel_layer,0); | |
| 693 | 613 | |
| 694 | 614 | /* Palettes have 4 bpp indexes despite up to 6 bpp data. The unused */ |
| 695 | 615 | /* top bits in the gfx data are cleared later. */ |
| 696 | 616 | machine->gfx[1]->color_granularity=16; |
| 697 | 617 | machine->gfx[2]->color_granularity=16; |
| 698 | 618 | |
| 699 | flipscreen = 0; | |
| 700 | memset(spriteram32_buffered,0,state->spriteram_size); | |
| 619 | state->flipscreen = 0; | |
| 620 | memset(state->spriteram32_buffered,0,state->spriteram_size); | |
| 701 | 621 | memset(state->spriteram,0,state->spriteram_size); |
| 702 | 622 | |
| 703 | state_save_register_global_array(machine, f3_control_0); | |
| 704 | state_save_register_global_array(machine, f3_control_1); | |
| 623 | state_save_register_global_array(machine, state->f3_control_0); | |
| 624 | state_save_register_global_array(machine, state->f3_control_1); | |
| 705 | 625 | |
| 706 | gfx_element_set_source(machine->gfx[0], (UINT8 *)f3_vram); | |
| 707 | gfx_element_set_source(machine->gfx[3], (UINT8 *)f3_pivot_ram); | |
| 626 | gfx_element_set_source(machine->gfx[0], (UINT8 *)state->f3_vram); | |
| 627 | gfx_element_set_source(machine->gfx[3], (UINT8 *)state->f3_pivot_ram); | |
| 708 | 628 | |
| 709 | f3_skip_this_frame=0; | |
| 629 | state->f3_skip_this_frame=0; | |
| 710 | 630 | |
| 711 | sprite_lag=f3_game_config->sprite_lag; | |
| 631 | state->sprite_lag=state->f3_game_config->sprite_lag; | |
| 712 | 632 | |
| 713 | init_alpha_blend_func(); | |
| 633 | init_alpha_blend_func(machine); | |
| 714 | 634 | |
| 715 | 635 | { |
| 716 | 636 | const gfx_element *sprite_gfx = machine->gfx[2]; |
| r10886 | r10887 | |
| 730 | 650 | } |
| 731 | 651 | dp += sprite_gfx->line_modulo; |
| 732 | 652 | } |
| 733 | if(chk_trans_or_opa==1) tile_opaque_sp[c]=1; | |
| 734 | else tile_opaque_sp[c]=0; | |
| 653 | if(chk_trans_or_opa==1) state->tile_opaque_sp[c]=1; | |
| 654 | else state->tile_opaque_sp[c]=0; | |
| 735 | 655 | } |
| 736 | 656 | } |
| 737 | 657 | |
| r10886 | r10887 | |
| 762 | 682 | } |
| 763 | 683 | dp += pf_gfx->line_modulo; |
| 764 | 684 | } |
| 765 | tile_opaque_pf[extra_planes][c]=chk_trans_or_opa; | |
| 685 | state->tile_opaque_pf[extra_planes][c]=chk_trans_or_opa; | |
| 766 | 686 | } |
| 767 | 687 | } |
| 768 | 688 | } |
| r10886 | r10887 | |
| 772 | 692 | |
| 773 | 693 | WRITE32_HANDLER( f3_pf_data_w ) |
| 774 | 694 | { |
| 775 | COMBINE_DATA(&f3_pf_data[offset]); | |
| 695 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 696 | COMBINE_DATA(&state->f3_pf_data[offset]); | |
| 776 | 697 | |
| 777 | if (f3_game_config->extend) { | |
| 778 | if (offset<0x800) tilemap_mark_tile_dirty(pf1_tilemap,offset-0x0000); | |
| 779 | else if (offset<0x1000) tilemap_mark_tile_dirty(pf2_tilemap,offset-0x0800); | |
| 780 | else if (offset<0x1800) tilemap_mark_tile_dirty(pf3_tilemap,offset-0x1000); | |
| 781 | else if (offset<0x2000) tilemap_mark_tile_dirty(pf4_tilemap,offset-0x1800); | |
| 698 | if (state->f3_game_config->extend) { | |
| 699 | if (offset<0x800) tilemap_mark_tile_dirty(state->pf1_tilemap,offset-0x0000); | |
| 700 | else if (offset<0x1000) tilemap_mark_tile_dirty(state->pf2_tilemap,offset-0x0800); | |
| 701 | else if (offset<0x1800) tilemap_mark_tile_dirty(state->pf3_tilemap,offset-0x1000); | |
| 702 | else if (offset<0x2000) tilemap_mark_tile_dirty(state->pf4_tilemap,offset-0x1800); | |
| 782 | 703 | } else { |
| 783 | if (offset<0x400) tilemap_mark_tile_dirty(pf1_tilemap,offset-0x0000); | |
| 784 | else if (offset<0x800) tilemap_mark_tile_dirty(pf2_tilemap,offset-0x0400); | |
| 785 | else if (offset<0xc00) tilemap_mark_tile_dirty(pf3_tilemap,offset-0x0800); | |
| 786 | else if (offset<0x1000) tilemap_mark_tile_dirty(pf4_tilemap,offset-0xc00); | |
| 704 | if (offset<0x400) tilemap_mark_tile_dirty(state->pf1_tilemap,offset-0x0000); | |
| 705 | else if (offset<0x800) tilemap_mark_tile_dirty(state->pf2_tilemap,offset-0x0400); | |
| 706 | else if (offset<0xc00) tilemap_mark_tile_dirty(state->pf3_tilemap,offset-0x0800); | |
| 707 | else if (offset<0x1000) tilemap_mark_tile_dirty(state->pf4_tilemap,offset-0xc00); | |
| 787 | 708 | } |
| 788 | 709 | } |
| 789 | 710 | |
| 790 | 711 | WRITE32_HANDLER( f3_control_0_w ) |
| 791 | 712 | { |
| 792 | COMBINE_DATA(&f3_control_0[offset]); | |
| 713 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 714 | COMBINE_DATA(&state->f3_control_0[offset]); | |
| 793 | 715 | } |
| 794 | 716 | |
| 795 | 717 | WRITE32_HANDLER( f3_control_1_w ) |
| 796 | 718 | { |
| 797 | COMBINE_DATA(&f3_control_1[offset]); | |
| 719 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 720 | COMBINE_DATA(&state->f3_control_1[offset]); | |
| 798 | 721 | } |
| 799 | 722 | |
| 800 | 723 | WRITE32_HANDLER( f3_videoram_w ) |
| r10886 | r10887 | |
| 804 | 727 | int tile,col_off; |
| 805 | 728 | COMBINE_DATA(&videoram[offset]); |
| 806 | 729 | |
| 807 | tilemap_mark_tile_dirty(vram_layer,offset<<1); | |
| 808 | tilemap_mark_tile_dirty(vram_layer,(offset<<1)+1); | |
| 730 | tilemap_mark_tile_dirty(state->vram_layer,offset<<1); | |
| 731 | tilemap_mark_tile_dirty(state->vram_layer,(offset<<1)+1); | |
| 809 | 732 | |
| 810 | 733 | if (offset>0x3ff) offset-=0x400; |
| 811 | 734 | |
| 812 | 735 | tile=offset<<1; |
| 813 | 736 | col_off=((tile&0x3f)*32)+((tile&0xfc0)>>6); |
| 814 | 737 | |
| 815 | tilemap_mark_tile_dirty(pixel_layer,col_off); | |
| 816 | tilemap_mark_tile_dirty(pixel_layer,col_off+32); | |
| 738 | tilemap_mark_tile_dirty(state->pixel_layer,col_off); | |
| 739 | tilemap_mark_tile_dirty(state->pixel_layer,col_off+32); | |
| 817 | 740 | } |
| 818 | 741 | |
| 819 | 742 | WRITE32_HANDLER( f3_vram_w ) |
| 820 | 743 | { |
| 821 | COMBINE_DATA(&f3_vram[offset]); | |
| 744 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 745 | COMBINE_DATA(&state->f3_vram[offset]); | |
| 822 | 746 | gfx_element_mark_dirty(space->machine->gfx[0], offset/8); |
| 823 | 747 | } |
| 824 | 748 | |
| 825 | 749 | WRITE32_HANDLER( f3_pivot_w ) |
| 826 | 750 | { |
| 827 | COMBINE_DATA(&f3_pivot_ram[offset]); | |
| 751 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 752 | COMBINE_DATA(&state->f3_pivot_ram[offset]); | |
| 828 | 753 | gfx_element_mark_dirty(space->machine->gfx[3], offset/8); |
| 829 | 754 | } |
| 830 | 755 | |
| 831 | 756 | WRITE32_HANDLER( f3_lineram_w ) |
| 832 | 757 | { |
| 758 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 833 | 759 | /* DariusGX has an interesting bug at the start of Round D - the clearing of lineram |
| 834 | 760 | (0xa000->0x0xa7ff) overflows into priority RAM (0xb000) and creates garbage priority |
| 835 | 761 | values. I'm not sure what the real machine would do with these values, and this |
| 836 | 762 | emulation certainly doesn't like it, so I've chosen to catch the bug here, and prevent |
| 837 | 763 | the trashing of priority ram. If anyone has information on what the real machine does, |
| 838 | 764 | please let me know! */ |
| 839 | if (f3_game==DARIUSG) { | |
| 840 | if (f3_skip_this_frame) | |
| 765 | if (state->f3_game==DARIUSG) { | |
| 766 | if (state->f3_skip_this_frame) | |
| 841 | 767 | return; |
| 842 | 768 | if (offset==0xb000/4 && data==0x003f0000) { |
| 843 | f3_skip_this_frame=1; | |
| 769 | state->f3_skip_this_frame=1; | |
| 844 | 770 | return; |
| 845 | 771 | } |
| 846 | 772 | } |
| 847 | 773 | |
| 848 | COMBINE_DATA(&f3_line_ram[offset]); | |
| 774 | COMBINE_DATA(&state->f3_line_ram[offset]); | |
| 849 | 775 | } |
| 850 | 776 | |
| 851 | 777 | WRITE32_HANDLER( f3_palette_24bit_w ) |
| 852 | 778 | { |
| 779 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 853 | 780 | int r,g,b; |
| 854 | 781 | |
| 855 | 782 | COMBINE_DATA(&space->machine->generic.paletteram.u32[offset]); |
| 856 | 783 | |
| 857 | 784 | /* 12 bit palette games - there has to be a palette select bit somewhere */ |
| 858 | if (f3_game==SPCINVDX || f3_game==RIDINGF || f3_game==ARABIANM || f3_game==RINGRAGE) { | |
| 785 | if (state->f3_game==SPCINVDX || state->f3_game==RIDINGF || state->f3_game==ARABIANM || state->f3_game==RINGRAGE) { | |
| 859 | 786 | b = 15 * ((space->machine->generic.paletteram.u32[offset] >> 4) & 0xf); |
| 860 | 787 | g = 15 * ((space->machine->generic.paletteram.u32[offset] >> 8) & 0xf); |
| 861 | 788 | r = 15 * ((space->machine->generic.paletteram.u32[offset] >> 12) & 0xf); |
| 862 | 789 | } |
| 863 | 790 | |
| 864 | 791 | /* This is weird - why are only the sprites and VRAM palettes 21 bit? */ |
| 865 | else if (f3_game==CLEOPATR) { | |
| 792 | else if (state->f3_game==CLEOPATR) { | |
| 866 | 793 | if (offset<0x100 || offset>0x1000) { |
| 867 | 794 | r = ((space->machine->generic.paletteram.u32[offset] >>16) & 0x7f)<<1; |
| 868 | 795 | g = ((space->machine->generic.paletteram.u32[offset] >> 8) & 0x7f)<<1; |
| r10886 | r10887 | |
| 875 | 802 | } |
| 876 | 803 | |
| 877 | 804 | /* Another weird couple - perhaps this is alpha blending related? */ |
| 878 | else if (f3_game==TWINQIX || f3_game==RECALH) { | |
| 805 | else if (state->f3_game==TWINQIX || state->f3_game==RECALH) { | |
| 879 | 806 | if (offset>0x1c00) { |
| 880 | 807 | r = ((space->machine->generic.paletteram.u32[offset] >>16) & 0x7f)<<1; |
| 881 | 808 | g = ((space->machine->generic.paletteram.u32[offset] >> 8) & 0x7f)<<1; |
| r10886 | r10887 | |
| 908 | 835 | d = level+1; \ |
| 909 | 836 | } |
| 910 | 837 | |
| 911 | INLINE void f3_alpha_set_level( | |
| 838 | INLINE void f3_alpha_set_level(taito_f3_state *state) | |
| 912 | 839 | { |
| 913 | // SET_ALPHA_LEVEL(alpha_s_1_1, f3_alpha_level_2ad) | |
| 914 | SET_ALPHA_LEVEL(alpha_s_1_1, 255-f3_alpha_level_2as) | |
| 915 | // SET_ALPHA_LEVEL(alpha_s_1_2, f3_alpha_level_2bd) | |
| 916 | SET_ALPHA_LEVEL(alpha_s_1_2, 255-f3_alpha_level_2bs) | |
| 917 | SET_ALPHA_LEVEL(alpha_s_1_4, f3_alpha_level_3ad) | |
| 918 | // SET_ALPHA_LEVEL(alpha_s_1_5, f3_alpha_level_3ad*f3_alpha_level_2ad/255) | |
| 919 | SET_ALPHA_LEVEL(alpha_s_1_5, f3_alpha_level_3ad*(255-f3_alpha_level_2as)/255) | |
| 920 | // SET_ALPHA_LEVEL(alpha_s_1_6, f3_alpha_level_3ad*f3_alpha_level_2bd/255) | |
| 921 | SET_ALPHA_LEVEL(alpha_s_1_6, f3_alpha_level_3ad*(255-f3_alpha_level_2bs)/255) | |
| 922 | SET_ALPHA_LEVEL(alpha_s_1_8, f3_alpha_level_3bd) | |
| 923 | // SET_ALPHA_LEVEL(alpha_s_1_9, f3_alpha_level_3bd*f3_alpha_level_2ad/255) | |
| 924 | SET_ALPHA_LEVEL(alpha_s_1_9, f3_alpha_level_3bd*(255-f3_alpha_level_2as)/255) | |
| 925 | // SET_ALPHA_LEVEL(alpha_s_1_a, f3_alpha_level_3bd*f3_alpha_level_2bd/255) | |
| 926 | SET_ALPHA_LEVEL(alpha_s_1_a, f3_alpha_level_3bd*(255-f3_alpha_level_2bs)/255) | |
| 840 | // SET_ALPHA_LEVEL(state->alpha_s_1_1, state->f3_alpha_level_2ad) | |
| 841 | SET_ALPHA_LEVEL(state->alpha_s_1_1, 255-state->f3_alpha_level_2as) | |
| 842 | // SET_ALPHA_LEVEL(state->alpha_s_1_2, state->f3_alpha_level_2bd) | |
| 843 | SET_ALPHA_LEVEL(state->alpha_s_1_2, 255-state->f3_alpha_level_2bs) | |
| 844 | SET_ALPHA_LEVEL(state->alpha_s_1_4, state->f3_alpha_level_3ad) | |
| 845 | // SET_ALPHA_LEVEL(state->alpha_s_1_5, state->f3_alpha_level_3ad*state->f3_alpha_level_2ad/255) | |
| 846 | SET_ALPHA_LEVEL(state->alpha_s_1_5, state->f3_alpha_level_3ad*(255-state->f3_alpha_level_2as)/255) | |
| 847 | // SET_ALPHA_LEVEL(state->alpha_s_1_6, state->f3_alpha_level_3ad*state->f3_alpha_level_2bd/255) | |
| 848 | SET_ALPHA_LEVEL(state->alpha_s_1_6, state->f3_alpha_level_3ad*(255-state->f3_alpha_level_2bs)/255) | |
| 849 | SET_ALPHA_LEVEL(state->alpha_s_1_8, state->f3_alpha_level_3bd) | |
| 850 | // SET_ALPHA_LEVEL(state->alpha_s_1_9, state->f3_alpha_level_3bd*state->f3_alpha_level_2ad/255) | |
| 851 | SET_ALPHA_LEVEL(state->alpha_s_1_9, state->f3_alpha_level_3bd*(255-state->f3_alpha_level_2as)/255) | |
| 852 | // SET_ALPHA_LEVEL(state->alpha_s_1_a, state->f3_alpha_level_3bd*state->f3_alpha_level_2bd/255) | |
| 853 | SET_ALPHA_LEVEL(state->alpha_s_1_a, state->f3_alpha_level_3bd*(255-state->f3_alpha_level_2bs)/255) | |
| 927 | 854 | |
| 928 | SET_ALPHA_LEVEL(alpha_s_2a_0, f3_alpha_level_2as) | |
| 929 | SET_ALPHA_LEVEL(alpha_s_2a_4, f3_alpha_level_2as*f3_alpha_level_3ad/255) | |
| 930 | SET_ALPHA_LEVEL(alpha_s_2a_8, f3_alpha_level_2as*f3_alpha_level_3bd/255) | |
| 855 | SET_ALPHA_LEVEL(state->alpha_s_2a_0, state->f3_alpha_level_2as) | |
| 856 | SET_ALPHA_LEVEL(state->alpha_s_2a_4, state->f3_alpha_level_2as*state->f3_alpha_level_3ad/255) | |
| 857 | SET_ALPHA_LEVEL(state->alpha_s_2a_8, state->f3_alpha_level_2as*state->f3_alpha_level_3bd/255) | |
| 931 | 858 | |
| 932 | SET_ALPHA_LEVEL(alpha_s_2b_0, f3_alpha_level_2bs) | |
| 933 | SET_ALPHA_LEVEL(alpha_s_2b_4, f3_alpha_level_2bs*f3_alpha_level_3ad/255) | |
| 934 | SET_ALPHA_LEVEL(alpha_s_2b_8, f3_alpha_level_2bs*f3_alpha_level_3bd/255) | |
| 859 | SET_ALPHA_LEVEL(state->alpha_s_2b_0, state->f3_alpha_level_2bs) | |
| 860 | SET_ALPHA_LEVEL(state->alpha_s_2b_4, state->f3_alpha_level_2bs*state->f3_alpha_level_3ad/255) | |
| 861 | SET_ALPHA_LEVEL(state->alpha_s_2b_8, state->f3_alpha_level_2bs*state->f3_alpha_level_3bd/255) | |
| 935 | 862 | |
| 936 | SET_ALPHA_LEVEL(alpha_s_3a_0, f3_alpha_level_3as) | |
| 937 | SET_ALPHA_LEVEL(alpha_s_3a_1, f3_alpha_level_3as*f3_alpha_level_2ad/255) | |
| 938 | SET_ALPHA_LEVEL(alpha_s_3a_2, f3_alpha_level_3as*f3_alpha_level_2bd/255) | |
| 863 | SET_ALPHA_LEVEL(state->alpha_s_3a_0, state->f3_alpha_level_3as) | |
| 864 | SET_ALPHA_LEVEL(state->alpha_s_3a_1, state->f3_alpha_level_3as*state->f3_alpha_level_2ad/255) | |
| 865 | SET_ALPHA_LEVEL(state->alpha_s_3a_2, state->f3_alpha_level_3as*state->f3_alpha_level_2bd/255) | |
| 939 | 866 | |
| 940 | SET_ALPHA_LEVEL(alpha_s_3b_0, f3_alpha_level_3bs) | |
| 941 | SET_ALPHA_LEVEL(alpha_s_3b_1, f3_alpha_level_3bs*f3_alpha_level_2ad/255) | |
| 942 | SET_ALPHA_LEVEL(alpha_s_3b_2, f3_alpha_level_3bs*f3_alpha_level_2bd/255) | |
| 867 | SET_ALPHA_LEVEL(state->alpha_s_3b_0, state->f3_alpha_level_3bs) | |
| 868 | SET_ALPHA_LEVEL(state->alpha_s_3b_1, state->f3_alpha_level_3bs*state->f3_alpha_level_2ad/255) | |
| 869 | SET_ALPHA_LEVEL(state->alpha_s_3b_2, state->f3_alpha_level_3bs*state->f3_alpha_level_2bd/255) | |
| 943 | 870 | } |
| 944 | 871 | #undef SET_ALPHA_LEVEL |
| 945 | 872 | |
| r10886 | r10887 | |
| 951 | 878 | |
| 952 | 879 | |
| 953 | 880 | |
| 954 | INLINE void f3_alpha_blend32_s( int alphas, UINT32 s ) | |
| 881 | INLINE void f3_alpha_blend32_s( taito_f3_state *state, int alphas, UINT32 s ) | |
| 955 | 882 | { |
| 956 | 883 | UINT8 *sc = (UINT8 *)&s; |
| 957 | UINT8 *dc = (UINT8 *)&dval; | |
| 884 | UINT8 *dc = (UINT8 *)&state->dval; | |
| 958 | 885 | dc[COLOR1] = (alphas * sc[COLOR1]) >> 8; |
| 959 | 886 | dc[COLOR2] = (alphas * sc[COLOR2]) >> 8; |
| 960 | 887 | dc[COLOR3] = (alphas * sc[COLOR3]) >> 8; |
| 961 | 888 | } |
| 962 | 889 | |
| 963 | INLINE void f3_alpha_blend32_d( int alphas, UINT32 s ) | |
| 890 | INLINE void f3_alpha_blend32_d( taito_f3_state *state, int alphas, UINT32 s ) | |
| 964 | 891 | { |
| 965 | 892 | UINT8 *sc = (UINT8 *)&s; |
| 966 | UINT8 *dc = (UINT8 *)&dval; | |
| 967 | dc[COLOR1] = add_sat[dc[COLOR1]][(alphas * sc[COLOR1]) >> 8]; | |
| 968 | dc[COLOR2] = add_sat[dc[COLOR2]][(alphas * sc[COLOR2]) >> 8]; | |
| 969 | dc[COLOR3] = add_sat[dc[COLOR3]][(alphas * sc[COLOR3]) >> 8]; | |
| 893 | UINT8 *dc = (UINT8 *)&state->dval; | |
| 894 | dc[COLOR1] = state->add_sat[dc[COLOR1]][(alphas * sc[COLOR1]) >> 8]; | |
| 895 | dc[COLOR2] = state->add_sat[dc[COLOR2]][(alphas * sc[COLOR2]) >> 8]; | |
| 896 | dc[COLOR3] = state->add_sat[dc[COLOR3]][(alphas * sc[COLOR3]) >> 8]; | |
| 970 | 897 | } |
| 971 | 898 | |
| 972 | 899 | /*============================================================================*/ |
| 973 | 900 | |
| 974 | INLINE void f3_alpha_blend_1_1( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_1,s);} | |
| 975 | INLINE void f3_alpha_blend_1_2( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_2,s);} | |
| 976 | INLINE void f3_alpha_blend_1_4( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_4,s);} | |
| 977 | INLINE void f3_alpha_blend_1_5( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_5,s);} | |
| 978 | INLINE void f3_alpha_blend_1_6( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_6,s);} | |
| 979 | INLINE void f3_alpha_blend_1_8( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_8,s);} | |
| 980 | INLINE void f3_alpha_blend_1_9( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_9,s);} | |
| 981 | INLINE void f3_alpha_blend_1_a( UINT32 s ){f3_alpha_blend32_d(alpha_s_1_a,s);} | |
| 901 | INLINE void f3_alpha_blend_1_1( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_1,s);} | |
| 902 | INLINE void f3_alpha_blend_1_2( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_2,s);} | |
| 903 | INLINE void f3_alpha_blend_1_4( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_4,s);} | |
| 904 | INLINE void f3_alpha_blend_1_5( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_5,s);} | |
| 905 | INLINE void f3_alpha_blend_1_6( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_6,s);} | |
| 906 | INLINE void f3_alpha_blend_1_8( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_8,s);} | |
| 907 | INLINE void f3_alpha_blend_1_9( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_9,s);} | |
| 908 | INLINE void f3_alpha_blend_1_a( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_1_a,s);} | |
| 982 | 909 | |
| 983 | INLINE void f3_alpha_blend_2a_0( UINT32 s ){f3_alpha_blend32_s(alpha_s_2a_0,s);} | |
| 984 | INLINE void f3_alpha_blend_2a_4( UINT32 s ){f3_alpha_blend32_d(alpha_s_2a_4,s);} | |
| 985 | INLINE void f3_alpha_blend_2a_8( UINT32 s ){f3_alpha_blend32_d(alpha_s_2a_8,s);} | |
| 910 | INLINE void f3_alpha_blend_2a_0( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_s(state, state->alpha_s_2a_0,s);} | |
| 911 | INLINE void f3_alpha_blend_2a_4( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_2a_4,s);} | |
| 912 | INLINE void f3_alpha_blend_2a_8( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_2a_8,s);} | |
| 986 | 913 | |
| 987 | INLINE void f3_alpha_blend_2b_0( UINT32 s ){f3_alpha_blend32_s(alpha_s_2b_0,s);} | |
| 988 | INLINE void f3_alpha_blend_2b_4( UINT32 s ){f3_alpha_blend32_d(alpha_s_2b_4,s);} | |
| 989 | INLINE void f3_alpha_blend_2b_8( UINT32 s ){f3_alpha_blend32_d(alpha_s_2b_8,s);} | |
| 914 | INLINE void f3_alpha_blend_2b_0( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_s(state, state->alpha_s_2b_0,s);} | |
| 915 | INLINE void f3_alpha_blend_2b_4( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_2b_4,s);} | |
| 916 | INLINE void f3_alpha_blend_2b_8( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_2b_8,s);} | |
| 990 | 917 | |
| 991 | INLINE void f3_alpha_blend_3a_0( UINT32 s ){f3_alpha_blend32_s(alpha_s_3a_0,s);} | |
| 992 | INLINE void f3_alpha_blend_3a_1( UINT32 s ){f3_alpha_blend32_d(alpha_s_3a_1,s);} | |
| 993 | INLINE void f3_alpha_blend_3a_2( UINT32 s ){f3_alpha_blend32_d(alpha_s_3a_2,s);} | |
| 918 | INLINE void f3_alpha_blend_3a_0( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_s(state, state->alpha_s_3a_0,s);} | |
| 919 | INLINE void f3_alpha_blend_3a_1( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_3a_1,s);} | |
| 920 | INLINE void f3_alpha_blend_3a_2( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_3a_2,s);} | |
| 994 | 921 | |
| 995 | INLINE void f3_alpha_blend_3b_0( UINT32 s ){f3_alpha_blend32_s(alpha_s_3b_0,s);} | |
| 996 | INLINE void f3_alpha_blend_3b_1( UINT32 s ){f3_alpha_blend32_d(alpha_s_3b_1,s);} | |
| 997 | INLINE void f3_alpha_blend_3b_2( UINT32 s ){f3_alpha_blend32_d(alpha_s_3b_2,s);} | |
| 922 | INLINE void f3_alpha_blend_3b_0( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_s(state, state->alpha_s_3b_0,s);} | |
| 923 | INLINE void f3_alpha_blend_3b_1( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_3b_1,s);} | |
| 924 | INLINE void f3_alpha_blend_3b_2( taito_f3_state *state, UINT32 s ){f3_alpha_blend32_d(state, state->alpha_s_3b_2,s);} | |
| 998 | 925 | |
| 999 | 926 | /*============================================================================*/ |
| 1000 | 927 | |
| 1001 | static int dpix_1_noalpha(UINT32 s_pix) {dval = s_pix; return 1;} | |
| 1002 | static int dpix_ret1(UINT32 s_pix) {return 1;} | |
| 1003 | static int dpix_ret0(UINT32 s_pix) {return 0;} | |
| 1004 | static int dpix_1_1(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_1(s_pix); return 1;} | |
| 1005 | static int dpix_1_2(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_2(s_pix); return 1;} | |
| 1006 | static int dpix_1_4(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_4(s_pix); return 1;} | |
| 1007 | static int dpix_1_5(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_5(s_pix); return 1;} | |
| 1008 | static int dpix_1_6(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_6(s_pix); return 1;} | |
| 1009 | static int dpix_1_8(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_8(s_pix); return 1;} | |
| 1010 | static int dpix_1_9(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_9(s_pix); return 1;} | |
| 1011 | static int dpix_1_a(UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_a(s_pix); return 1;} | |
| 928 | static int dpix_1_noalpha(taito_f3_state *state, UINT32 s_pix) {state->dval = s_pix; return 1;} | |
| 929 | static int dpix_ret1(taito_f3_state *state, UINT32 s_pix) {return 1;} | |
| 930 | static int dpix_ret0(taito_f3_state *state, UINT32 s_pix) {return 0;} | |
| 931 | static int dpix_1_1(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_1(state, s_pix); return 1;} | |
| 932 | static int dpix_1_2(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_2(state, s_pix); return 1;} | |
| 933 | static int dpix_1_4(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_4(state, s_pix); return 1;} | |
| 934 | static int dpix_1_5(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_5(state, s_pix); return 1;} | |
| 935 | static int dpix_1_6(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_6(state, s_pix); return 1;} | |
| 936 | static int dpix_1_8(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_8(state, s_pix); return 1;} | |
| 937 | static int dpix_1_9(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_9(state, s_pix); return 1;} | |
| 938 | static int dpix_1_a(taito_f3_state *state, UINT32 s_pix) {if(s_pix) f3_alpha_blend_1_a(state, s_pix); return 1;} | |
| 1012 | 939 | |
| 1013 | static int dpix_2a_0(UINT32 s_pix) | |
| 940 | static int dpix_2a_0(taito_f3_state *state, UINT32 s_pix) | |
| 1014 | 941 | { |
| 1015 | if(s_pix) f3_alpha_blend_2a_0(s_pix); | |
| 1016 | else dval = 0; | |
| 1017 | if(pdest_2a) {pval |= pdest_2a;return 0;} | |
| 942 | if(s_pix) f3_alpha_blend_2a_0(state, s_pix); | |
| 943 | else state->dval = 0; | |
| 944 | if(state->pdest_2a) {state->pval |= state->pdest_2a;return 0;} | |
| 1018 | 945 | return 1; |
| 1019 | 946 | } |
| 1020 | static int dpix_2a_4(UINT32 s_pix) | |
| 947 | static int dpix_2a_4(taito_f3_state *state, UINT32 s_pix) | |
| 1021 | 948 | { |
| 1022 | if(s_pix) f3_alpha_blend_2a_4(s_pix); | |
| 1023 | if(pdest_2a) {pval |= pdest_2a;return 0;} | |
| 949 | if(s_pix) f3_alpha_blend_2a_4(state, s_pix); | |
| 950 | if(state->pdest_2a) {state->pval |= state->pdest_2a;return 0;} | |
| 1024 | 951 | return 1; |
| 1025 | 952 | } |
| 1026 | static int dpix_2a_8(UINT32 s_pix) | |
| 953 | static int dpix_2a_8(taito_f3_state *state, UINT32 s_pix) | |
| 1027 | 954 | { |
| 1028 | if(s_pix) f3_alpha_blend_2a_8(s_pix); | |
| 1029 | if(pdest_2a) {pval |= pdest_2a;return 0;} | |
| 955 | if(s_pix) f3_alpha_blend_2a_8(state, s_pix); | |
| 956 | if(state->pdest_2a) {state->pval |= state->pdest_2a;return 0;} | |
| 1030 | 957 | return 1; |
| 1031 | 958 | } |
| 1032 | 959 | |
| 1033 | static int dpix_3a_0(UINT32 s_pix) | |
| 960 | static int dpix_3a_0(taito_f3_state *state, UINT32 s_pix) | |
| 1034 | 961 | { |
| 1035 | if(s_pix) f3_alpha_blend_3a_0(s_pix); | |
| 1036 | else dval = 0; | |
| 1037 | if(pdest_3a) {pval |= pdest_3a;return 0;} | |
| 962 | if(s_pix) f3_alpha_blend_3a_0(state, s_pix); | |
| 963 | else state->dval = 0; | |
| 964 | if(state->pdest_3a) {state->pval |= state->pdest_3a;return 0;} | |
| 1038 | 965 | return 1; |
| 1039 | 966 | } |
| 1040 | static int dpix_3a_1(UINT32 s_pix) | |
| 967 | static int dpix_3a_1(taito_f3_state *state, UINT32 s_pix) | |
| 1041 | 968 | { |
| 1042 | if(s_pix) f3_alpha_blend_3a_1(s_pix); | |
| 1043 | if(pdest_3a) {pval |= pdest_3a;return 0;} | |
| 969 | if(s_pix) f3_alpha_blend_3a_1(state, s_pix); | |
| 970 | if(state->pdest_3a) {state->pval |= state->pdest_3a;return 0;} | |
| 1044 | 971 | return 1; |
| 1045 | 972 | } |
| 1046 | static int dpix_3a_2(UINT32 s_pix) | |
| 973 | static int dpix_3a_2(taito_f3_state *state, UINT32 s_pix) | |
| 1047 | 974 | { |
| 1048 | if(s_pix) f3_alpha_blend_3a_2(s_pix); | |
| 1049 | if(pdest_3a) {pval |= pdest_3a;return 0;} | |
| 975 | if(s_pix) f3_alpha_blend_3a_2(state, s_pix); | |
| 976 | if(state->pdest_3a) {state->pval |= state->pdest_3a;return 0;} | |
| 1050 | 977 | return 1; |
| 1051 | 978 | } |
| 1052 | 979 | |
| 1053 | static int dpix_2b_0(UINT32 s_pix) | |
| 980 | static int dpix_2b_0(taito_f3_state *state, UINT32 s_pix) | |
| 1054 | 981 | { |
| 1055 | if(s_pix) f3_alpha_blend_2b_0(s_pix); | |
| 1056 | else dval = 0; | |
| 1057 | if(pdest_2b) {pval |= pdest_2b;return 0;} | |
| 982 | if(s_pix) f3_alpha_blend_2b_0(state, s_pix); | |
| 983 | else state->dval = 0; | |
| 984 | if(state->pdest_2b) {state->pval |= state->pdest_2b;return 0;} | |
| 1058 | 985 | return 1; |
| 1059 | 986 | } |
| 1060 | static int dpix_2b_4(UINT32 s_pix) | |
| 987 | static int dpix_2b_4(taito_f3_state *state, UINT32 s_pix) | |
| 1061 | 988 | { |
| 1062 | if(s_pix) f3_alpha_blend_2b_4(s_pix); | |
| 1063 | if(pdest_2b) {pval |= pdest_2b;return 0;} | |
| 989 | if(s_pix) f3_alpha_blend_2b_4(state, s_pix); | |
| 990 | if(state->pdest_2b) {state->pval |= state->pdest_2b;return 0;} | |
| 1064 | 991 | return 1; |
| 1065 | 992 | } |
| 1066 | static int dpix_2b_8(UINT32 s_pix) | |
| 993 | static int dpix_2b_8(taito_f3_state *state, UINT32 s_pix) | |
| 1067 | 994 | { |
| 1068 | if(s_pix) f3_alpha_blend_2b_8(s_pix); | |
| 1069 | if(pdest_2b) {pval |= pdest_2b;return 0;} | |
| 995 | if(s_pix) f3_alpha_blend_2b_8(state, s_pix); | |
| 996 | if(state->pdest_2b) {state->pval |= state->pdest_2b;return 0;} | |
| 1070 | 997 | return 1; |
| 1071 | 998 | } |
| 1072 | 999 | |
| 1073 | static int dpix_3b_0(UINT32 s_pix) | |
| 1000 | static int dpix_3b_0(taito_f3_state *state, UINT32 s_pix) | |
| 1074 | 1001 | { |
| 1075 | if(s_pix) f3_alpha_blend_3b_0(s_pix); | |
| 1076 | else dval = 0; | |
| 1077 | if(pdest_3b) {pval |= pdest_3b;return 0;} | |
| 1002 | if(s_pix) f3_alpha_blend_3b_0(state, s_pix); | |
| 1003 | else state->dval = 0; | |
| 1004 | if(state->pdest_3b) {state->pval |= state->pdest_3b;return 0;} | |
| 1078 | 1005 | return 1; |
| 1079 | 1006 | } |
| 1080 | static int dpix_3b_1(UINT32 s_pix) | |
| 1007 | static int dpix_3b_1(taito_f3_state *state, UINT32 s_pix) | |
| 1081 | 1008 | { |
| 1082 | if(s_pix) f3_alpha_blend_3b_1(s_pix); | |
| 1083 | if(pdest_3b) {pval |= pdest_3b;return 0;} | |
| 1009 | if(s_pix) f3_alpha_blend_3b_1(state, s_pix); | |
| 1010 | if(state->pdest_3b) {state->pval |= state->pdest_3b;return 0;} | |
| 1084 | 1011 | return 1; |
| 1085 | 1012 | } |
| 1086 | static int dpix_3b_2(UINT32 s_pix) | |
| 1013 | static int dpix_3b_2(taito_f3_state *state, UINT32 s_pix) | |
| 1087 | 1014 | { |
| 1088 | if(s_pix) f3_alpha_blend_3b_2(s_pix); | |
| 1089 | if(pdest_3b) {pval |= pdest_3b;return 0;} | |
| 1015 | if(s_pix) f3_alpha_blend_3b_2(state, s_pix); | |
| 1016 | if(state->pdest_3b) {state->pval |= state->pdest_3b;return 0;} | |
| 1090 | 1017 | return 1; |
| 1091 | 1018 | } |
| 1092 | 1019 | |
| 1093 | static int dpix_2_0(UINT32 s_pix) | |
| 1020 | static int dpix_2_0(taito_f3_state *state, UINT32 s_pix) | |
| 1094 | 1021 | { |
| 1095 | UINT8 tr2=tval&1; | |
| 1022 | UINT8 tr2=state->tval&1; | |
| 1096 | 1023 | if(s_pix) |
| 1097 | 1024 | { |
| 1098 | if(tr2==tr_2b) {f3_alpha_blend_2b_0(s_pix);if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1099 | else if(tr2==tr_2a) {f3_alpha_blend_2a_0(s_pix);if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1025 | if(tr2==state->tr_2b) {f3_alpha_blend_2b_0(state, s_pix);if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1026 | else if(tr2==state->tr_2a) {f3_alpha_blend_2a_0(state, s_pix);if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1100 | 1027 | } |
| 1101 | 1028 | else |
| 1102 | 1029 | { |
| 1103 | if(tr2==tr_2b) {dval = 0;if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1104 | else if(tr2==tr_2a) {dval = 0;if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1030 | if(tr2==state->tr_2b) {state->dval = 0;if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1031 | else if(tr2==state->tr_2a) {state->dval = 0;if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1105 | 1032 | } |
| 1106 | 1033 | return 0; |
| 1107 | 1034 | } |
| 1108 | static int dpix_2_4(UINT32 s_pix) | |
| 1035 | static int dpix_2_4(taito_f3_state *state, UINT32 s_pix) | |
| 1109 | 1036 | { |
| 1110 | UINT8 tr2=tval&1; | |
| 1037 | UINT8 tr2=state->tval&1; | |
| 1111 | 1038 | if(s_pix) |
| 1112 | 1039 | { |
| 1113 | if(tr2==tr_2b) {f3_alpha_blend_2b_4(s_pix);if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1114 | else if(tr2==tr_2a) {f3_alpha_blend_2a_4(s_pix);if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1040 | if(tr2==state->tr_2b) {f3_alpha_blend_2b_4(state, s_pix);if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1041 | else if(tr2==state->tr_2a) {f3_alpha_blend_2a_4(state, s_pix);if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1115 | 1042 | } |
| 1116 | 1043 | else |
| 1117 | 1044 | { |
| 1118 | if(tr2==tr_2b) {if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1119 | else if(tr2==tr_2a) {if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1045 | if(tr2==state->tr_2b) {if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1046 | else if(tr2==state->tr_2a) {if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1120 | 1047 | } |
| 1121 | 1048 | return 0; |
| 1122 | 1049 | } |
| 1123 | static int dpix_2_8(UINT32 s_pix) | |
| 1050 | static int dpix_2_8(taito_f3_state *state, UINT32 s_pix) | |
| 1124 | 1051 | { |
| 1125 | UINT8 tr2=tval&1; | |
| 1052 | UINT8 tr2=state->tval&1; | |
| 1126 | 1053 | if(s_pix) |
| 1127 | 1054 | { |
| 1128 | if(tr2==tr_2b) {f3_alpha_blend_2b_8(s_pix);if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1129 | else if(tr2==tr_2a) {f3_alpha_blend_2a_8(s_pix);if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1055 | if(tr2==state->tr_2b) {f3_alpha_blend_2b_8(state, s_pix);if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1056 | else if(tr2==state->tr_2a) {f3_alpha_blend_2a_8(state, s_pix);if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1130 | 1057 | } |
| 1131 | 1058 | else |
| 1132 | 1059 | { |
| 1133 | if(tr2==tr_2b) {if(pdest_2b) pval |= pdest_2b;else return 1;} | |
| 1134 | else if(tr2==tr_2a) {if(pdest_2a) pval |= pdest_2a;else return 1;} | |
| 1060 | if(tr2==state->tr_2b) {if(state->pdest_2b) state->pval |= state->pdest_2b;else return 1;} | |
| 1061 | else if(tr2==state->tr_2a) {if(state->pdest_2a) state->pval |= state->pdest_2a;else return 1;} | |
| 1135 | 1062 | } |
| 1136 | 1063 | return 0; |
| 1137 | 1064 | } |
| 1138 | 1065 | |
| 1139 | static int dpix_3_0(UINT32 s_pix) | |
| 1066 | static int dpix_3_0(taito_f3_state *state, UINT32 s_pix) | |
| 1140 | 1067 | { |
| 1141 | UINT8 tr2=tval&1; | |
| 1068 | UINT8 tr2=state->tval&1; | |
| 1142 | 1069 | if(s_pix) |
| 1143 | 1070 | { |
| 1144 | if(tr2==tr_3b) {f3_alpha_blend_3b_0(s_pix);if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1145 | else if(tr2==tr_3a) {f3_alpha_blend_3a_0(s_pix);if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1071 | if(tr2==state->tr_3b) {f3_alpha_blend_3b_0(state, s_pix);if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1072 | else if(tr2==state->tr_3a) {f3_alpha_blend_3a_0(state, s_pix);if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1146 | 1073 | } |
| 1147 | 1074 | else |
| 1148 | 1075 | { |
| 1149 | if(tr2==tr_3b) {dval = 0;if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1150 | else if(tr2==tr_3a) {dval = 0;if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1076 | if(tr2==state->tr_3b) {state->dval = 0;if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1077 | else if(tr2==state->tr_3a) {state->dval = 0;if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1151 | 1078 | } |
| 1152 | 1079 | return 0; |
| 1153 | 1080 | } |
| 1154 | static int dpix_3_1(UINT32 s_pix) | |
| 1081 | static int dpix_3_1(taito_f3_state *state, UINT32 s_pix) | |
| 1155 | 1082 | { |
| 1156 | UINT8 tr2=tval&1; | |
| 1083 | UINT8 tr2=state->tval&1; | |
| 1157 | 1084 | if(s_pix) |
| 1158 | 1085 | { |
| 1159 | if(tr2==tr_3b) {f3_alpha_blend_3b_1(s_pix);if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1160 | else if(tr2==tr_3a) {f3_alpha_blend_3a_1(s_pix);if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1086 | if(tr2==state->tr_3b) {f3_alpha_blend_3b_1(state, s_pix);if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1087 | else if(tr2==state->tr_3a) {f3_alpha_blend_3a_1(state, s_pix);if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1161 | 1088 | } |
| 1162 | 1089 | else |
| 1163 | 1090 | { |
| 1164 | if(tr2==tr_3b) {if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1165 | else if(tr2==tr_3a) {if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1091 | if(tr2==state->tr_3b) {if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1092 | else if(tr2==state->tr_3a) {if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1166 | 1093 | } |
| 1167 | 1094 | return 0; |
| 1168 | 1095 | } |
| 1169 | static int dpix_3_2(UINT32 s_pix) | |
| 1096 | static int dpix_3_2(taito_f3_state *state, UINT32 s_pix) | |
| 1170 | 1097 | { |
| 1171 | UINT8 tr2=tval&1; | |
| 1098 | UINT8 tr2=state->tval&1; | |
| 1172 | 1099 | if(s_pix) |
| 1173 | 1100 | { |
| 1174 | if(tr2==tr_3b) {f3_alpha_blend_3b_2(s_pix);if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1175 | else if(tr2==tr_3a) {f3_alpha_blend_3a_2(s_pix);if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1101 | if(tr2==state->tr_3b) {f3_alpha_blend_3b_2(state, s_pix);if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1102 | else if(tr2==state->tr_3a) {f3_alpha_blend_3a_2(state, s_pix);if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1176 | 1103 | } |
| 1177 | 1104 | else |
| 1178 | 1105 | { |
| 1179 | if(tr2==tr_3b) {if(pdest_3b) pval |= pdest_3b;else return 1;} | |
| 1180 | else if(tr2==tr_3a) {if(pdest_3a) pval |= pdest_3a;else return 1;} | |
| 1106 | if(tr2==state->tr_3b) {if(state->pdest_3b) state->pval |= state->pdest_3b;else return 1;} | |
| 1107 | else if(tr2==state->tr_3a) {if(state->pdest_3a) state->pval |= state->pdest_3a;else return 1;} | |
| 1181 | 1108 | } |
| 1182 | 1109 | return 0; |
| 1183 | 1110 | } |
| 1184 | 1111 | |
| 1185 | INLINE void dpix_1_sprite(UINT32 s_pix) | |
| 1112 | INLINE void dpix_1_sprite(taito_f3_state *state, UINT32 s_pix) | |
| 1186 | 1113 | { |
| 1187 | 1114 | if(s_pix) |
| 1188 | 1115 | { |
| 1189 | UINT8 p1 = pval&0xf0; | |
| 1190 | if (p1==0x10) f3_alpha_blend_1_1(s_pix); | |
| 1191 | else if(p1==0x20) f3_alpha_blend_1_2(s_pix); | |
| 1192 | else if(p1==0x40) f3_alpha_blend_1_4(s_pix); | |
| 1193 | else if(p1==0x50) f3_alpha_blend_1_5(s_pix); | |
| 1194 | else if(p1==0x60) f3_alpha_blend_1_6(s_pix); | |
| 1195 | else if(p1==0x80) f3_alpha_blend_1_8(s_pix); | |
| 1196 | else if(p1==0x90) f3_alpha_blend_1_9(s_pix); | |
| 1197 | else if(p1==0xa0) f3_alpha_blend_1_a(s_pix); | |
| 1116 | UINT8 p1 = state->pval&0xf0; | |
| 1117 | if (p1==0x10) f3_alpha_blend_1_1(state, s_pix); | |
| 1118 | else if(p1==0x20) f3_alpha_blend_1_2(state, s_pix); | |
| 1119 | else if(p1==0x40) f3_alpha_blend_1_4(state, s_pix); | |
| 1120 | else if(p1==0x50) f3_alpha_blend_1_5(state, s_pix); | |
| 1121 | else if(p1==0x60) f3_alpha_blend_1_6(state, s_pix); | |
| 1122 | else if(p1==0x80) f3_alpha_blend_1_8(state, s_pix); | |
| 1123 | else if(p1==0x90) f3_alpha_blend_1_9(state, s_pix); | |
| 1124 | else if(p1==0xa0) f3_alpha_blend_1_a(state, s_pix); | |
| 1198 | 1125 | } |
| 1199 | 1126 | } |
| 1200 | 1127 | |
| 1201 | INLINE void dpix_bg(UINT32 bgcolor) | |
| 1128 | INLINE void dpix_bg(taito_f3_state *state, UINT32 bgcolor) | |
| 1202 | 1129 | { |
| 1203 | UINT8 p1 = pval&0xf0; | |
| 1204 | if(!p1) dval = bgcolor; | |
| 1205 | else if(p1==0x10) f3_alpha_blend_1_1(bgcolor); | |
| 1206 | else if(p1==0x20) f3_alpha_blend_1_2(bgcolor); | |
| 1207 | else if(p1==0x40) f3_alpha_blend_1_4(bgcolor); | |
| 1208 | else if(p1==0x50) f3_alpha_blend_1_5(bgcolor); | |
| 1209 | else if(p1==0x60) f3_alpha_blend_1_6(bgcolor); | |
| 1210 | else if(p1==0x80) f3_alpha_blend_1_8(bgcolor); | |
| 1211 | else if(p1==0x90) f3_alpha_blend_1_9(bgcolor); | |
| 1212 | else if(p1==0xa0) f3_alpha_blend_1_a(bgcolor); | |
| 1130 | UINT8 p1 = state->pval&0xf0; | |
| 1131 | if(!p1) state->dval = bgcolor; | |
| 1132 | else if(p1==0x10) f3_alpha_blend_1_1(state, bgcolor); | |
| 1133 | else if(p1==0x20) f3_alpha_blend_1_2(state, bgcolor); | |
| 1134 | else if(p1==0x40) f3_alpha_blend_1_4(state, bgcolor); | |
| 1135 | else if(p1==0x50) f3_alpha_blend_1_5(state, bgcolor); | |
| 1136 | else if(p1==0x60) f3_alpha_blend_1_6(state, bgcolor); | |
| 1137 | else if(p1==0x80) f3_alpha_blend_1_8(state, bgcolor); | |
| 1138 | else if(p1==0x90) f3_alpha_blend_1_9(state, bgcolor); | |
| 1139 | else if(p1==0xa0) f3_alpha_blend_1_a(state, bgcolor); | |
| 1213 | 1140 | } |
| 1214 | 1141 | |
| 1215 | 1142 | /******************************************************************************/ |
| 1216 | 1143 | |
| 1217 | static void init_alpha_blend_func( | |
| 1144 | static void init_alpha_blend_func(running_machine *machine) | |
| 1218 | 1145 | { |
| 1146 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 1219 | 1147 | int i,j; |
| 1220 | 1148 | |
| 1221 | dpix_n[0][0x0]=dpix_1_noalpha; | |
| 1222 | dpix_n[0][0x1]=dpix_1_noalpha; | |
| 1223 | dpix_n[0][0x2]=dpix_1_noalpha; | |
| 1224 | dpix_n[0][0x3]=dpix_1_noalpha; | |
| 1225 | dpix_n[0][0x4]=dpix_1_noalpha; | |
| 1226 | dpix_n[0][0x5]=dpix_1_noalpha; | |
| 1227 | dpix_n[0][0x6]=dpix_1_noalpha; | |
| 1228 | dpix_n[0][0x7]=dpix_1_noalpha; | |
| 1229 | dpix_n[0][0x8]=dpix_1_noalpha; | |
| 1230 | dpix_n[0][0x9]=dpix_1_noalpha; | |
| 1231 | dpix_n[0][0xa]=dpix_1_noalpha; | |
| 1232 | dpix_n[0][0xb]=dpix_1_noalpha; | |
| 1233 | dpix_n[0][0xc]=dpix_1_noalpha; | |
| 1234 | dpix_n[0][0xd]=dpix_1_noalpha; | |
| 1235 | dpix_n[0][0xe]=dpix_1_noalpha; | |
| 1236 | dpix_n[0][0xf]=dpix_1_noalpha; | |
| 1149 | state->dpix_n[0][0x0]=dpix_1_noalpha; | |
| 1150 | state->dpix_n[0][0x1]=dpix_1_noalpha; | |
| 1151 | state->dpix_n[0][0x2]=dpix_1_noalpha; | |
| 1152 | state->dpix_n[0][0x3]=dpix_1_noalpha; | |
| 1153 | state->dpix_n[0][0x4]=dpix_1_noalpha; | |
| 1154 | state->dpix_n[0][0x5]=dpix_1_noalpha; | |
| 1155 | state->dpix_n[0][0x6]=dpix_1_noalpha; | |
| 1156 | state->dpix_n[0][0x7]=dpix_1_noalpha; | |
| 1157 | state->dpix_n[0][0x8]=dpix_1_noalpha; | |
| 1158 | state->dpix_n[0][0x9]=dpix_1_noalpha; | |
| 1159 | state->dpix_n[0][0xa]=dpix_1_noalpha; | |
| 1160 | state->dpix_n[0][0xb]=dpix_1_noalpha; | |
| 1161 | state->dpix_n[0][0xc]=dpix_1_noalpha; | |
| 1162 | state->dpix_n[0][0xd]=dpix_1_noalpha; | |
| 1163 | state->dpix_n[0][0xe]=dpix_1_noalpha; | |
| 1164 | state->dpix_n[0][0xf]=dpix_1_noalpha; | |
| 1237 | 1165 | |
| 1238 | dpix_n[1][0x0]=dpix_1_noalpha; | |
| 1239 | dpix_n[1][0x1]=dpix_1_1; | |
| 1240 | dpix_n[1][0x2]=dpix_1_2; | |
| 1241 | dpix_n[1][0x3]=dpix_ret1; | |
| 1242 | dpix_n[1][0x4]=dpix_1_4; | |
| 1243 | dpix_n[1][0x5]=dpix_1_5; | |
| 1244 | dpix_n[1][0x6]=dpix_1_6; | |
| 1245 | dpix_n[1][0x7]=dpix_ret1; | |
| 1246 | dpix_n[1][0x8]=dpix_1_8; | |
| 1247 | dpix_n[1][0x9]=dpix_1_9; | |
| 1248 | dpix_n[1][0xa]=dpix_1_a; | |
| 1249 | dpix_n[1][0xb]=dpix_ret1; | |
| 1250 | dpix_n[1][0xc]=dpix_ret1; | |
| 1251 | dpix_n[1][0xd]=dpix_ret1; | |
| 1252 | dpix_n[1][0xe]=dpix_ret1; | |
| 1253 | dpix_n[1][0xf]=dpix_ret1; | |
| 1166 | state->dpix_n[1][0x0]=dpix_1_noalpha; | |
| 1167 | state->dpix_n[1][0x1]=dpix_1_1; | |
| 1168 | state->dpix_n[1][0x2]=dpix_1_2; | |
| 1169 | state->dpix_n[1][0x3]=dpix_ret1; | |
| 1170 | state->dpix_n[1][0x4]=dpix_1_4; | |
| 1171 | state->dpix_n[1][0x5]=dpix_1_5; | |
| 1172 | state->dpix_n[1][0x6]=dpix_1_6; | |
| 1173 | state->dpix_n[1][0x7]=dpix_ret1; | |
| 1174 | state->dpix_n[1][0x8]=dpix_1_8; | |
| 1175 | state->dpix_n[1][0x9]=dpix_1_9; | |
| 1176 | state->dpix_n[1][0xa]=dpix_1_a; | |
| 1177 | state->dpix_n[1][0xb]=dpix_ret1; | |
| 1178 | state->dpix_n[1][0xc]=dpix_ret1; | |
| 1179 | state->dpix_n[1][0xd]=dpix_ret1; | |
| 1180 | state->dpix_n[1][0xe]=dpix_ret1; | |
| 1181 | state->dpix_n[1][0xf]=dpix_ret1; | |
| 1254 | 1182 | |
| 1255 | dpix_n[2][0x0]=dpix_2a_0; | |
| 1256 | dpix_n[2][0x1]=dpix_ret0; | |
| 1257 | dpix_n[2][0x2]=dpix_ret0; | |
| 1258 | dpix_n[2][0x3]=dpix_ret0; | |
| 1259 | dpix_n[2][0x4]=dpix_2a_4; | |
| 1260 | dpix_n[2][0x5]=dpix_ret0; | |
| 1261 | dpix_n[2][0x6]=dpix_ret0; | |
| 1262 | dpix_n[2][0x7]=dpix_ret0; | |
| 1263 | dpix_n[2][0x8]=dpix_2a_8; | |
| 1264 | dpix_n[2][0x9]=dpix_ret0; | |
| 1265 | dpix_n[2][0xa]=dpix_ret0; | |
| 1266 | dpix_n[2][0xb]=dpix_ret0; | |
| 1267 | dpix_n[2][0xc]=dpix_ret0; | |
| 1268 | dpix_n[2][0xd]=dpix_ret0; | |
| 1269 | dpix_n[2][0xe]=dpix_ret0; | |
| 1270 | dpix_n[2][0xf]=dpix_ret0; | |
| 1183 | state->dpix_n[2][0x0]=dpix_2a_0; | |
| 1184 | state->dpix_n[2][0x1]=dpix_ret0; | |
| 1185 | state->dpix_n[2][0x2]=dpix_ret0; | |
| 1186 | state->dpix_n[2][0x3]=dpix_ret0; | |
| 1187 | state->dpix_n[2][0x4]=dpix_2a_4; | |
| 1188 | state->dpix_n[2][0x5]=dpix_ret0; | |
| 1189 | state->dpix_n[2][0x6]=dpix_ret0; | |
| 1190 | state->dpix_n[2][0x7]=dpix_ret0; | |
| 1191 | state->dpix_n[2][0x8]=dpix_2a_8; | |
| 1192 | state->dpix_n[2][0x9]=dpix_ret0; | |
| 1193 | state->dpix_n[2][0xa]=dpix_ret0; | |
| 1194 | state->dpix_n[2][0xb]=dpix_ret0; | |
| 1195 | state->dpix_n[2][0xc]=dpix_ret0; | |
| 1196 | state->dpix_n[2][0xd]=dpix_ret0; | |
| 1197 | state->dpix_n[2][0xe]=dpix_ret0; | |
| 1198 | state->dpix_n[2][0xf]=dpix_ret0; | |
| 1271 | 1199 | |
| 1272 | dpix_n[3][0x0]=dpix_3a_0; | |
| 1273 | dpix_n[3][0x1]=dpix_3a_1; | |
| 1274 | dpix_n[3][0x2]=dpix_3a_2; | |
| 1275 | dpix_n[3][0x3]=dpix_ret0; | |
| 1276 | dpix_n[3][0x4]=dpix_ret0; | |
| 1277 | dpix_n[3][0x5]=dpix_ret0; | |
| 1278 | dpix_n[3][0x6]=dpix_ret0; | |
| 1279 | dpix_n[3][0x7]=dpix_ret0; | |
| 1280 | dpix_n[3][0x8]=dpix_ret0; | |
| 1281 | dpix_n[3][0x9]=dpix_ret0; | |
| 1282 | dpix_n[3][0xa]=dpix_ret0; | |
| 1283 | dpix_n[3][0xb]=dpix_ret0; | |
| 1284 | dpix_n[3][0xc]=dpix_ret0; | |
| 1285 | dpix_n[3][0xd]=dpix_ret0; | |
| 1286 | dpix_n[3][0xe]=dpix_ret0; | |
| 1287 | dpix_n[3][0xf]=dpix_ret0; | |
| 1200 | state->dpix_n[3][0x0]=dpix_3a_0; | |
| 1201 | state->dpix_n[3][0x1]=dpix_3a_1; | |
| 1202 | state->dpix_n[3][0x2]=dpix_3a_2; | |
| 1203 | state->dpix_n[3][0x3]=dpix_ret0; | |
| 1204 | state->dpix_n[3][0x4]=dpix_ret0; | |
| 1205 | state->dpix_n[3][0x5]=dpix_ret0; | |
| 1206 | state->dpix_n[3][0x6]=dpix_ret0; | |
| 1207 | state->dpix_n[3][0x7]=dpix_ret0; | |
| 1208 | state->dpix_n[3][0x8]=dpix_ret0; | |
| 1209 | state->dpix_n[3][0x9]=dpix_ret0; | |
| 1210 | state->dpix_n[3][0xa]=dpix_ret0; | |
| 1211 | state->dpix_n[3][0xb]=dpix_ret0; | |
| 1212 | state->dpix_n[3][0xc]=dpix_ret0; | |
| 1213 | state->dpix_n[3][0xd]=dpix_ret0; | |
| 1214 | state->dpix_n[3][0xe]=dpix_ret0; | |
| 1215 | state->dpix_n[3][0xf]=dpix_ret0; | |
| 1288 | 1216 | |
| 1289 | dpix_n[4][0x0]=dpix_2b_0; | |
| 1290 | dpix_n[4][0x1]=dpix_ret0; | |
| 1291 | dpix_n[4][0x2]=dpix_ret0; | |
| 1292 | dpix_n[4][0x3]=dpix_ret0; | |
| 1293 | dpix_n[4][0x4]=dpix_2b_4; | |
| 1294 | dpix_n[4][0x5]=dpix_ret0; | |
| 1295 | dpix_n[4][0x6]=dpix_ret0; | |
| 1296 | dpix_n[4][0x7]=dpix_ret0; | |
| 1297 | dpix_n[4][0x8]=dpix_2b_8; | |
| 1298 | dpix_n[4][0x9]=dpix_ret0; | |
| 1299 | dpix_n[4][0xa]=dpix_ret0; | |
| 1300 | dpix_n[4][0xb]=dpix_ret0; | |
| 1301 | dpix_n[4][0xc]=dpix_ret0; | |
| 1302 | dpix_n[4][0xd]=dpix_ret0; | |
| 1303 | dpix_n[4][0xe]=dpix_ret0; | |
| 1304 | dpix_n[4][0xf]=dpix_ret0; | |
| 1217 | state->dpix_n[4][0x0]=dpix_2b_0; | |
| 1218 | state->dpix_n[4][0x1]=dpix_ret0; | |
| 1219 | state->dpix_n[4][0x2]=dpix_ret0; | |
| 1220 | state->dpix_n[4][0x3]=dpix_ret0; | |
| 1221 | state->dpix_n[4][0x4]=dpix_2b_4; | |
| 1222 | state->dpix_n[4][0x5]=dpix_ret0; | |
| 1223 | state->dpix_n[4][0x6]=dpix_ret0; | |
| 1224 | state->dpix_n[4][0x7]=dpix_ret0; | |
| 1225 | state->dpix_n[4][0x8]=dpix_2b_8; | |
| 1226 | state->dpix_n[4][0x9]=dpix_ret0; | |
| 1227 | state->dpix_n[4][0xa]=dpix_ret0; | |
| 1228 | state->dpix_n[4][0xb]=dpix_ret0; | |
| 1229 | state->dpix_n[4][0xc]=dpix_ret0; | |
| 1230 | state->dpix_n[4][0xd]=dpix_ret0; | |
| 1231 | state->dpix_n[4][0xe]=dpix_ret0; | |
| 1232 | state->dpix_n[4][0xf]=dpix_ret0; | |
| 1305 | 1233 | |
| 1306 | dpix_n[5][0x0]=dpix_3b_0; | |
| 1307 | dpix_n[5][0x1]=dpix_3b_1; | |
| 1308 | dpix_n[5][0x2]=dpix_3b_2; | |
| 1309 | dpix_n[5][0x3]=dpix_ret0; | |
| 1310 | dpix_n[5][0x4]=dpix_ret0; | |
| 1311 | dpix_n[5][0x5]=dpix_ret0; | |
| 1312 | dpix_n[5][0x6]=dpix_ret0; | |
| 1313 | dpix_n[5][0x7]=dpix_ret0; | |
| 1314 | dpix_n[5][0x8]=dpix_ret0; | |
| 1315 | dpix_n[5][0x9]=dpix_ret0; | |
| 1316 | dpix_n[5][0xa]=dpix_ret0; | |
| 1317 | dpix_n[5][0xb]=dpix_ret0; | |
| 1318 | dpix_n[5][0xc]=dpix_ret0; | |
| 1319 | dpix_n[5][0xd]=dpix_ret0; | |
| 1320 | dpix_n[5][0xe]=dpix_ret0; | |
| 1321 | dpix_n[5][0xf]=dpix_ret0; | |
| 1234 | state->dpix_n[5][0x0]=dpix_3b_0; | |
| 1235 | state->dpix_n[5][0x1]=dpix_3b_1; | |
| 1236 | state->dpix_n[5][0x2]=dpix_3b_2; | |
| 1237 | state->dpix_n[5][0x3]=dpix_ret0; | |
| 1238 | state->dpix_n[5][0x4]=dpix_ret0; | |
| 1239 | state->dpix_n[5][0x5]=dpix_ret0; | |
| 1240 | state->dpix_n[5][0x6]=dpix_ret0; | |
| 1241 | state->dpix_n[5][0x7]=dpix_ret0; | |
| 1242 | state->dpix_n[5][0x8]=dpix_ret0; | |
| 1243 | state->dpix_n[5][0x9]=dpix_ret0; | |
| 1244 | state->dpix_n[5][0xa]=dpix_ret0; | |
| 1245 | state->dpix_n[5][0xb]=dpix_ret0; | |
| 1246 | state->dpix_n[5][0xc]=dpix_ret0; | |
| 1247 | state->dpix_n[5][0xd]=dpix_ret0; | |
| 1248 | state->dpix_n[5][0xe]=dpix_ret0; | |
| 1249 | state->dpix_n[5][0xf]=dpix_ret0; | |
| 1322 | 1250 | |
| 1323 | dpix_n[6][0x0]=dpix_2_0; | |
| 1324 | dpix_n[6][0x1]=dpix_ret0; | |
| 1325 | dpix_n[6][0x2]=dpix_ret0; | |
| 1326 | dpix_n[6][0x3]=dpix_ret0; | |
| 1327 | dpix_n[6][0x4]=dpix_2_4; | |
| 1328 | dpix_n[6][0x5]=dpix_ret0; | |
| 1329 | dpix_n[6][0x6]=dpix_ret0; | |
| 1330 | dpix_n[6][0x7]=dpix_ret0; | |
| 1331 | dpix_n[6][0x8]=dpix_2_8; | |
| 1332 | dpix_n[6][0x9]=dpix_ret0; | |
| 1333 | dpix_n[6][0xa]=dpix_ret0; | |
| 1334 | dpix_n[6][0xb]=dpix_ret0; | |
| 1335 | dpix_n[6][0xc]=dpix_ret0; | |
| 1336 | dpix_n[6][0xd]=dpix_ret0; | |
| 1337 | dpix_n[6][0xe]=dpix_ret0; | |
| 1338 | dpix_n[6][0xf]=dpix_ret0; | |
| 1251 | state->dpix_n[6][0x0]=dpix_2_0; | |
| 1252 | state->dpix_n[6][0x1]=dpix_ret0; | |
| 1253 | state->dpix_n[6][0x2]=dpix_ret0; | |
| 1254 | state->dpix_n[6][0x3]=dpix_ret0; | |
| 1255 | state->dpix_n[6][0x4]=dpix_2_4; | |
| 1256 | state->dpix_n[6][0x5]=dpix_ret0; | |
| 1257 | state->dpix_n[6][0x6]=dpix_ret0; | |
| 1258 | state->dpix_n[6][0x7]=dpix_ret0; | |
| 1259 | state->dpix_n[6][0x8]=dpix_2_8; | |
| 1260 | state->dpix_n[6][0x9]=dpix_ret0; | |
| 1261 | state->dpix_n[6][0xa]=dpix_ret0; | |
| 1262 | state->dpix_n[6][0xb]=dpix_ret0; | |
| 1263 | state->dpix_n[6][0xc]=dpix_ret0; | |
| 1264 | state->dpix_n[6][0xd]=dpix_ret0; | |
| 1265 | state->dpix_n[6][0xe]=dpix_ret0; | |
| 1266 | state->dpix_n[6][0xf]=dpix_ret0; | |
| 1339 | 1267 | |
| 1340 | dpix_n[7][0x0]=dpix_3_0; | |
| 1341 | dpix_n[7][0x1]=dpix_3_1; | |
| 1342 | dpix_n[7][0x2]=dpix_3_2; | |
| 1343 | dpix_n[7][0x3]=dpix_ret0; | |
| 1344 | dpix_n[7][0x4]=dpix_ret0; | |
| 1345 | dpix_n[7][0x5]=dpix_ret0; | |
| 1346 | dpix_n[7][0x6]=dpix_ret0; | |
| 1347 | dpix_n[7][0x7]=dpix_ret0; | |
| 1348 | dpix_n[7][0x8]=dpix_ret0; | |
| 1349 | dpix_n[7][0x9]=dpix_ret0; | |
| 1350 | dpix_n[7][0xa]=dpix_ret0; | |
| 1351 | dpix_n[7][0xb]=dpix_ret0; | |
| 1352 | dpix_n[7][0xc]=dpix_ret0; | |
| 1353 | dpix_n[7][0xd]=dpix_ret0; | |
| 1354 | dpix_n[7][0xe]=dpix_ret0; | |
| 1355 | dpix_n[7][0xf]=dpix_ret0; | |
| 1268 | state->dpix_n[7][0x0]=dpix_3_0; | |
| 1269 | state->dpix_n[7][0x1]=dpix_3_1; | |
| 1270 | state->dpix_n[7][0x2]=dpix_3_2; | |
| 1271 | state->dpix_n[7][0x3]=dpix_ret0; | |
| 1272 | state->dpix_n[7][0x4]=dpix_ret0; | |
| 1273 | state->dpix_n[7][0x5]=dpix_ret0; | |
| 1274 | state->dpix_n[7][0x6]=dpix_ret0; | |
| 1275 | state->dpix_n[7][0x7]=dpix_ret0; | |
| 1276 | state->dpix_n[7][0x8]=dpix_ret0; | |
| 1277 | state->dpix_n[7][0x9]=dpix_ret0; | |
| 1278 | state->dpix_n[7][0xa]=dpix_ret0; | |
| 1279 | state->dpix_n[7][0xb]=dpix_ret0; | |
| 1280 | state->dpix_n[7][0xc]=dpix_ret0; | |
| 1281 | state->dpix_n[7][0xd]=dpix_ret0; | |
| 1282 | state->dpix_n[7][0xe]=dpix_ret0; | |
| 1283 | state->dpix_n[7][0xf]=dpix_ret0; | |
| 1356 | 1284 | |
| 1357 | 1285 | for(i=0;i<256;i++) |
| 1358 | 1286 | for(j=0;j<256;j++) |
| 1359 | add_sat[i][j] = (i + j < 256) ? i + j : 255; | |
| 1287 | state->add_sat[i][j] = (i + j < 256) ? i + j : 255; | |
| 1360 | 1288 | } |
| 1361 | 1289 | |
| 1362 | 1290 | /******************************************************************************/ |
| r10886 | r10887 | |
| 1364 | 1292 | #define GET_PIXMAP_POINTER(pf_num) \ |
| 1365 | 1293 | { \ |
| 1366 | 1294 | const struct f3_playfield_line_inf *line_tmp=line_t[pf_num]; \ |
| 1367 | src##pf_num=line_tmp->src[y]; \ | |
| 1368 | src_s##pf_num=line_tmp->src_s[y]; \ | |
| 1369 | src_e##pf_num=line_tmp->src_e[y]; \ | |
| 1370 | tsrc##pf_num=line_tmp->tsrc[y]; \ | |
| 1371 | tsrc_s##pf_num=line_tmp->tsrc_s[y]; \ | |
| 1372 | x_count##pf_num=line_tmp->x_count[y]; \ | |
| 1373 | x_zoom##pf_num=line_tmp->x_zoom[y]; \ | |
| 1374 | clip_al##pf_num=line_tmp->clip0[y]&0xffff; \ | |
| 1375 | clip_ar##pf_num=line_tmp->clip0[y]>>16; \ | |
| 1376 | clip_bl##pf_num=line_tmp->clip1[y]&0xffff; \ | |
| 1377 | clip_br##pf_num=line_tmp->clip1[y]>>16; \ | |
| 1295 | state->src##pf_num=line_tmp->src[y]; \ | |
| 1296 | state->src_s##pf_num=line_tmp->src_s[y]; \ | |
| 1297 | state->src_e##pf_num=line_tmp->src_e[y]; \ | |
| 1298 | state->tsrc##pf_num=line_tmp->tsrc[y]; \ | |
| 1299 | state->tsrc_s##pf_num=line_tmp->tsrc_s[y]; \ | |
| 1300 | state->x_count##pf_num=line_tmp->x_count[y]; \ | |
| 1301 | state->x_zoom##pf_num=line_tmp->x_zoom[y]; \ | |
| 1302 | state->clip_al##pf_num=line_tmp->clip0[y]&0xffff; \ | |
| 1303 | state->clip_ar##pf_num=line_tmp->clip0[y]>>16; \ | |
| 1304 | state->clip_bl##pf_num=line_tmp->clip1[y]&0xffff; \ | |
| 1305 | state->clip_br##pf_num=line_tmp->clip1[y]>>16; \ | |
| 1378 | 1306 | } |
| 1379 | 1307 | |
| 1380 | 1308 | #define CULC_PIXMAP_POINTER(pf_num) \ |
| 1381 | 1309 | { \ |
| 1382 | x_count##pf_num += x_zoom##pf_num; \ | |
| 1383 | if(x_count##pf_num>>16) \ | |
| 1310 | state->x_count##pf_num += state->x_zoom##pf_num; \ | |
| 1311 | if(state->x_count##pf_num>>16) \ | |
| 1384 | 1312 | { \ |
| 1385 | x_count##pf_num &= 0xffff; \ | |
| 1386 | src##pf_num++; \ | |
| 1387 | tsrc##pf_num++; \ | |
| 1388 | if(src##pf_num==src_e##pf_num) {src##pf_num=src_s##pf_num; tsrc##pf_num=tsrc_s##pf_num;} \ | |
| 1313 | state->x_count##pf_num &= 0xffff; \ | |
| 1314 | state->src##pf_num++; \ | |
| 1315 | state->tsrc##pf_num++; \ | |
| 1316 | if(state->src##pf_num==state->src_e##pf_num) {state->src##pf_num=state->src_s##pf_num; state->tsrc##pf_num=state->tsrc_s##pf_num;} \ | |
| 1389 | 1317 | } \ |
| 1390 | 1318 | } |
| 1391 | 1319 | |
| 1392 | 1320 | #define UPDATE_PIXMAP_SP(pf_num) \ |
| 1393 | 1321 | if(cx>=clip_als && cx<clip_ars && !(cx>=clip_bls && cx<clip_brs)) \ |
| 1394 | 1322 | { \ |
| 1395 | sprite_pri=sprite[pf_num]&pval; \ | |
| 1323 | sprite_pri=sprite[pf_num]&state->pval; \ | |
| 1396 | 1324 | if(sprite_pri) \ |
| 1397 | 1325 | { \ |
| 1398 | 1326 | if(sprite[pf_num]&0x100) break; \ |
| 1399 | if(!dpix_sp[sprite_pri]) \ | |
| 1327 | if(!state->dpix_sp[sprite_pri]) \ | |
| 1400 | 1328 | { \ |
| 1401 | if(!(pval&0xf0)) break; \ | |
| 1402 | else {dpix_1_sprite(*dsti);*dsti=dval;break;} \ | |
| 1329 | if(!(state->pval&0xf0)) break; \ | |
| 1330 | else {dpix_1_sprite(state, *dsti);*dsti=state->dval;break;} \ | |
| 1403 | 1331 | } \ |
| 1404 | if(dpix_sp[sprite_pri][pval>>4](*dsti)) {*dsti=dval;break;} \ | |
| 1332 | if(state->dpix_sp[sprite_pri][state->pval>>4](state, *dsti)) {*dsti=state->dval;break;} \ | |
| 1405 | 1333 | } \ |
| 1406 | 1334 | } |
| 1407 | 1335 | |
| 1408 | 1336 | #define UPDATE_PIXMAP_LP(pf_num) \ |
| 1409 | if (cx>=clip_al##pf_num && cx<clip_ar##pf_num && !(cx>=clip_bl##pf_num && cx<clip_br##pf_num)) \ | |
| 1337 | if (cx>=state->clip_al##pf_num && cx<state->clip_ar##pf_num && !(cx>=state->clip_bl##pf_num && cx<state->clip_br##pf_num)) \ | |
| 1410 | 1338 | { \ |
| 1411 | tval=*tsrc##pf_num; \ | |
| 1412 | if(tval&0xf0) \ | |
| 1413 | if(dpix_lp[pf_num][pval>>4](clut[*src##pf_num])) {*dsti=dval;break;} \ | |
| 1339 | state->tval=*state->tsrc##pf_num; \ | |
| 1340 | if(state->tval&0xf0) \ | |
| 1341 | if(state->dpix_lp[pf_num][state->pval>>4](state, clut[*state->src##pf_num])) {*dsti=state->dval;break;} \ | |
| 1414 | 1342 | } |
| 1415 | 1343 | |
| 1416 | 1344 | |
| r10886 | r10887 | |
| 1423 | 1351 | UINT32 orient, |
| 1424 | 1352 | int skip_layer_num) |
| 1425 | 1353 | { |
| 1354 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 1426 | 1355 | const pen_t *clut = &machine->pens[0]; |
| 1427 | 1356 | UINT32 bgcolor=clut[0]; |
| 1428 | 1357 | int length; |
| 1429 | 1358 | |
| 1430 | 1359 | const int x=46; |
| 1431 | 1360 | |
| 1432 | static UINT16 *src0=0,*src_s0=0,*src_e0=0,clip_al0=0,clip_ar0=0,clip_bl0=0,clip_br0=0; | |
| 1433 | static UINT8 *tsrc0=0,*tsrc_s0=0; | |
| 1434 | static UINT32 x_count0=0,x_zoom0=0; | |
| 1435 | 1361 | |
| 1436 | static UINT16 *src1=0,*src_s1=0,*src_e1=0,clip_al1=0,clip_ar1=0,clip_bl1=0,clip_br1=0; | |
| 1437 | static UINT8 *tsrc1=0,*tsrc_s1=0; | |
| 1438 | static UINT32 x_count1=0,x_zoom1=0; | |
| 1439 | 1362 | |
| 1440 | static UINT16 *src2=0,*src_s2=0,*src_e2=0,clip_al2=0,clip_ar2=0,clip_bl2=0,clip_br2=0; | |
| 1441 | static UINT8 *tsrc2=0,*tsrc_s2=0; | |
| 1442 | static UINT32 x_count2=0,x_zoom2=0; | |
| 1443 | 1363 | |
| 1444 | static UINT16 *src3=0,*src_s3=0,*src_e3=0,clip_al3=0,clip_ar3=0,clip_bl3=0,clip_br3=0; | |
| 1445 | static UINT8 *tsrc3=0,*tsrc_s3=0; | |
| 1446 | static UINT32 x_count3=0,x_zoom3=0; | |
| 1447 | 1364 | |
| 1448 | static UINT16 *src4=0,*src_s4=0,*src_e4=0,clip_al4=0,clip_ar4=0,clip_bl4=0,clip_br4=0; | |
| 1449 | static UINT8 *tsrc4=0,*tsrc_s4=0; | |
| 1450 | static UINT32 x_count4=0,x_zoom4=0; | |
| 1451 | 1365 | |
| 1452 | 1366 | UINT16 clip_als=0, clip_ars=0, clip_bls=0, clip_brs=0; |
| 1453 | 1367 | |
| r10886 | r10887 | |
| 1463 | 1377 | yadv = -yadv; |
| 1464 | 1378 | } |
| 1465 | 1379 | |
| 1466 | dstp0 = BITMAP_ADDR8(pri_alp_bitmap, ty, x); | |
| 1380 | dstp0 = BITMAP_ADDR8(state->pri_alp_bitmap, ty, x); | |
| 1467 | 1381 | |
| 1468 | pdest_2a = f3_alpha_level_2ad ? 0x10 : 0; | |
| 1469 | pdest_2b = f3_alpha_level_2bd ? 0x20 : 0; | |
| 1470 | tr_2a =(f3_alpha_level_2as==0 && f3_alpha_level_2ad==255) ? -1 : 0; | |
| 1471 | tr_2b =(f3_alpha_level_2bs==0 && f3_alpha_level_2bd==255) ? -1 : 1; | |
| 1472 | pdest_3a = f3_alpha_level_3ad ? 0x40 : 0; | |
| 1473 | pdest_3b = f3_alpha_level_3bd ? 0x80 : 0; | |
| 1474 | tr_3a =(f3_alpha_level_3as==0 && f3_alpha_level_3ad==255) ? -1 : 0; | |
| 1475 | tr_3b =(f3_alpha_level_3bs==0 && f3_alpha_level_3bd==255) ? -1 : 1; | |
| 1382 | state->pdest_2a = state->f3_alpha_level_2ad ? 0x10 : 0; | |
| 1383 | state->pdest_2b = state->f3_alpha_level_2bd ? 0x20 : 0; | |
| 1384 | state->tr_2a =(state->f3_alpha_level_2as==0 && state->f3_alpha_level_2ad==255) ? -1 : 0; | |
| 1385 | state->tr_2b =(state->f3_alpha_level_2bs==0 && state->f3_alpha_level_2bd==255) ? -1 : 1; | |
| 1386 | state->pdest_3a = state->f3_alpha_level_3ad ? 0x40 : 0; | |
| 1387 | state->pdest_3b = state->f3_alpha_level_3bd ? 0x80 : 0; | |
| 1388 | state->tr_3a =(state->f3_alpha_level_3as==0 && state->f3_alpha_level_3ad==255) ? -1 : 0; | |
| 1389 | state->tr_3b =(state->f3_alpha_level_3bs==0 && state->f3_alpha_level_3bd==255) ? -1 : 1; | |
| 1476 | 1390 | |
| 1477 | 1391 | { |
| 1478 | 1392 | UINT32 *dsti0,*dsti; |
| r10886 | r10887 | |
| 1481 | 1395 | { |
| 1482 | 1396 | int cx=0; |
| 1483 | 1397 | |
| 1484 | clip_als=sa_line_inf->sprite_clip0[y]&0xffff; | |
| 1485 | clip_ars=sa_line_inf->sprite_clip0[y]>>16; | |
| 1486 | clip_bls=sa_line_inf->sprite_clip1[y]&0xffff; | |
| 1487 | clip_brs=sa_line_inf->sprite_clip1[y]>>16; | |
| 1398 | clip_als=state->sa_line_inf[0].sprite_clip0[y]&0xffff; | |
| 1399 | clip_ars=state->sa_line_inf[0].sprite_clip0[y]>>16; | |
| 1400 | clip_bls=state->sa_line_inf[0].sprite_clip1[y]&0xffff; | |
| 1401 | clip_brs=state->sa_line_inf[0].sprite_clip1[y]>>16; | |
| 1488 | 1402 | |
| 1489 | 1403 | length=xsize; |
| 1490 | 1404 | dsti = dsti0; |
| r10886 | r10887 | |
| 1501 | 1415 | |
| 1502 | 1416 | while (1) |
| 1503 | 1417 | { |
| 1504 | pval=*dstp; | |
| 1505 | if (pval!=0xff) | |
| 1418 | state->pval=*dstp; | |
| 1419 | if (state->pval!=0xff) | |
| 1506 | 1420 | { |
| 1507 | 1421 | UINT8 sprite_pri; |
| 1508 | 1422 | switch(skip_layer_num) |
| r10886 | r10887 | |
| 1513 | 1427 | case 3: UPDATE_PIXMAP_SP(3) UPDATE_PIXMAP_LP(3) |
| 1514 | 1428 | case 4: UPDATE_PIXMAP_SP(4) UPDATE_PIXMAP_LP(4) |
| 1515 | 1429 | case 5: UPDATE_PIXMAP_SP(5) |
| 1516 | if(!bgcolor) {if(!(pval&0xf0)) {*dsti=0;break;}} | |
| 1517 | else dpix_bg(bgcolor); | |
| 1518 | *dsti=dval; | |
| 1430 | if(!bgcolor) {if(!(state->pval&0xf0)) {*dsti=0;break;}} | |
| 1431 | else dpix_bg(state, bgcolor); | |
| 1432 | *dsti=state->dval; | |
| 1519 | 1433 | } |
| 1520 | 1434 | } |
| 1521 | 1435 | |
| r10886 | r10887 | |
| 1564 | 1478 | UINT32 x_index_fx,UINT32 y_index, |
| 1565 | 1479 | UINT32 *f3_pf_data_n) |
| 1566 | 1480 | { |
| 1481 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 1567 | 1482 | UINT32 *pf_base; |
| 1568 | 1483 | int i,trans_all,tile_index,tile_num; |
| 1569 | 1484 | int alpha_type,alpha_mode; |
| r10886 | r10887 | |
| 1579 | 1494 | tile_num=(((line_t->x_zoom[line]*320+(x_index_fx & 0xffff)+0xffff)>>16)+(tile_index%16)+15)/16; |
| 1580 | 1495 | tile_index/=16; |
| 1581 | 1496 | |
| 1582 | if (flipscreen) | |
| 1497 | if (state->flipscreen) | |
| 1583 | 1498 | { |
| 1584 | pf_base=f3_pf_data_n+((31-(y_index/16))<<twidth_mask_bit); | |
| 1585 | tile_index=(twidth_mask-tile_index)-tile_num+1; | |
| 1499 | pf_base=f3_pf_data_n+((31-(y_index/16))<<state->twidth_mask_bit); | |
| 1500 | tile_index=(state->twidth_mask-tile_index)-tile_num+1; | |
| 1586 | 1501 | } |
| 1587 | else pf_base=f3_pf_data_n+((y_index/16)<<twidth_mask_bit); | |
| 1502 | else pf_base=f3_pf_data_n+((y_index/16)<<state->twidth_mask_bit); | |
| 1588 | 1503 | |
| 1589 | 1504 | |
| 1590 | 1505 | trans_all=1; |
| r10886 | r10887 | |
| 1592 | 1507 | alpha_type=0; |
| 1593 | 1508 | for(i=0;i<tile_num;i++) |
| 1594 | 1509 | { |
| 1595 | UINT32 tile=pf_base[(tile_index)&twidth_mask]; | |
| 1510 | UINT32 tile=pf_base[(tile_index)&state->twidth_mask]; | |
| 1596 | 1511 | UINT8 extra_planes = (tile>>(16+10)) & 3; |
| 1597 | 1512 | if(tile&0xffff) |
| 1598 | 1513 | { |
| 1599 | 1514 | trans_all=0; |
| 1600 | 1515 | if(opaque_all) |
| 1601 | 1516 | { |
| 1602 | if(tile_opaque_pf[extra_planes][(tile&0xffff)%total_elements]!=1) opaque_all=0; | |
| 1517 | if(state->tile_opaque_pf[extra_planes][(tile&0xffff)%total_elements]!=1) opaque_all=0; | |
| 1603 | 1518 | } |
| 1604 | 1519 | |
| 1605 | 1520 | if(alpha_mode==1) |
| r10886 | r10887 | |
| 1634 | 1549 | |
| 1635 | 1550 | /******************************************************************************/ |
| 1636 | 1551 | |
| 1637 | static void calculate_clip(int y, UINT16 pri, UINT32* clip0, UINT32* clip1, int* line_enable) | |
| 1552 | static void calculate_clip(taito_f3_state *state, int y, UINT16 pri, UINT32* clip0, UINT32* clip1, int* line_enable) | |
| 1638 | 1553 | { |
| 1639 | const struct f3_spritealpha_line_inf *sa_line_t=&sa_line_inf[0]; | |
| 1554 | const struct f3_spritealpha_line_inf *sa_line_t=&state->sa_line_inf[0]; | |
| 1640 | 1555 | |
| 1641 | 1556 | switch (pri) |
| 1642 | 1557 | { |
| r10886 | r10887 | |
| 1738 | 1653 | } |
| 1739 | 1654 | } |
| 1740 | 1655 | |
| 1741 | static void get_spritealphaclip_info( | |
| 1656 | static void get_spritealphaclip_info(taito_f3_state *state) | |
| 1742 | 1657 | { |
| 1743 | struct f3_spritealpha_line_inf *line_t=&sa_line_inf[0]; | |
| 1658 | struct f3_spritealpha_line_inf *line_t=&state->sa_line_inf[0]; | |
| 1744 | 1659 | |
| 1745 | 1660 | int y,y_end,y_inc; |
| 1746 | 1661 | |
| r10886 | r10887 | |
| 1752 | 1667 | int alpha_level=0; |
| 1753 | 1668 | UINT16 sprite_alpha=0; |
| 1754 | 1669 | |
| 1755 | if (flipscreen) | |
| 1670 | if (state->flipscreen) | |
| 1756 | 1671 | { |
| 1757 | 1672 | spri_base=0x77fe; |
| 1758 | 1673 | clip_base_low=0x51fe; |
| r10886 | r10887 | |
| 1779 | 1694 | /* The zoom, column and row values can latch according to control ram */ |
| 1780 | 1695 | if (y&1) |
| 1781 | 1696 | { |
| 1782 | if (f3_line_ram[0x080+(y>>1)]&1) | |
| 1783 | clip0_low=(f3_line_ram[clip_base_low/4]>> 0)&0xffff; | |
| 1784 | if (f3_line_ram[0x000+(y>>1)]&4) | |
| 1785 | clip0_high=(f3_line_ram[clip_base_high/4]>> 0)&0xffff; | |
| 1786 | if (f3_line_ram[0x080+(y>>1)]&2) | |
| 1787 | clip1_low=(f3_line_ram[(clip_base_low+0x200)/4]>> 0)&0xffff; | |
| 1697 | if (state->f3_line_ram[0x080+(y>>1)]&1) | |
| 1698 | clip0_low=(state->f3_line_ram[clip_base_low/4]>> 0)&0xffff; | |
| 1699 | if (state->f3_line_ram[0x000+(y>>1)]&4) | |
| 1700 | clip0_high=(state->f3_line_ram[clip_base_high/4]>> 0)&0xffff; | |
| 1701 | if (state->f3_line_ram[0x080+(y>>1)]&2) | |
| 1702 | clip1_low=(state->f3_line_ram[(clip_base_low+0x200)/4]>> 0)&0xffff; | |
| 1788 | 1703 | |
| 1789 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x8) | |
| 1790 | spri=f3_line_ram[spri_base/4]&0xffff; | |
| 1791 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x4) | |
| 1792 | sprite_clip=f3_line_ram[(spri_base-0x200)/4]&0xffff; | |
| 1793 | if (f3_line_ram[(0x0400/4)+(y>>1)]&0x1) | |
| 1794 | sprite_alpha=f3_line_ram[(spri_base-0x1600)/4]&0xffff; | |
| 1795 | if (f3_line_ram[(0x0400/4)+(y>>1)]&0x2) | |
| 1796 | alpha_level=f3_line_ram[(spri_base-0x1400)/4]&0xffff; | |
| 1704 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x8) | |
| 1705 | spri=state->f3_line_ram[spri_base/4]&0xffff; | |
| 1706 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x4) | |
| 1707 | sprite_clip=state->f3_line_ram[(spri_base-0x200)/4]&0xffff; | |
| 1708 | if (state->f3_line_ram[(0x0400/4)+(y>>1)]&0x1) | |
| 1709 | sprite_alpha=state->f3_line_ram[(spri_base-0x1600)/4]&0xffff; | |
| 1710 | if (state->f3_line_ram[(0x0400/4)+(y>>1)]&0x2) | |
| 1711 | alpha_level=state->f3_line_ram[(spri_base-0x1400)/4]&0xffff; | |
| 1797 | 1712 | } |
| 1798 | 1713 | else |
| 1799 | 1714 | { |
| 1800 | if (f3_line_ram[0x080+(y>>1)]&0x10000) | |
| 1801 | clip0_low=(f3_line_ram[clip_base_low/4]>>16)&0xffff; | |
| 1802 | if (f3_line_ram[0x000+(y>>1)]&0x40000) | |
| 1803 | clip0_high=(f3_line_ram[clip_base_high/4]>>16)&0xffff; | |
| 1804 | if (f3_line_ram[0x080+(y>>1)]&0x20000) | |
| 1805 | clip1_low=(f3_line_ram[(clip_base_low+0x200)/4]>>16)&0xffff; | |
| 1715 | if (state->f3_line_ram[0x080+(y>>1)]&0x10000) | |
| 1716 | clip0_low=(state->f3_line_ram[clip_base_low/4]>>16)&0xffff; | |
| 1717 | if (state->f3_line_ram[0x000+(y>>1)]&0x40000) | |
| 1718 | clip0_high=(state->f3_line_ram[clip_base_high/4]>>16)&0xffff; | |
| 1719 | if (state->f3_line_ram[0x080+(y>>1)]&0x20000) | |
| 1720 | clip1_low=(state->f3_line_ram[(clip_base_low+0x200)/4]>>16)&0xffff; | |
| 1806 | 1721 | |
| 1807 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x80000) | |
| 1808 | spri=f3_line_ram[spri_base/4]>>16; | |
| 1809 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x40000) | |
| 1810 | sprite_clip=f3_line_ram[(spri_base-0x200)/4]>>16; | |
| 1811 | if (f3_line_ram[(0x0400/4)+(y>>1)]&0x10000) | |
| 1812 | sprite_alpha=f3_line_ram[(spri_base-0x1600)/4]>>16; | |
| 1813 | if (f3_line_ram[(0x0400/4)+(y>>1)]&0x20000) | |
| 1814 | alpha_level=f3_line_ram[(spri_base-0x1400)/4]>>16; | |
| 1722 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x80000) | |
| 1723 | spri=state->f3_line_ram[spri_base/4]>>16; | |
| 1724 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x40000) | |
| 1725 | sprite_clip=state->f3_line_ram[(spri_base-0x200)/4]>>16; | |
| 1726 | if (state->f3_line_ram[(0x0400/4)+(y>>1)]&0x10000) | |
| 1727 | sprite_alpha=state->f3_line_ram[(spri_base-0x1600)/4]>>16; | |
| 1728 | if (state->f3_line_ram[(0x0400/4)+(y>>1)]&0x20000) | |
| 1729 | alpha_level=state->f3_line_ram[(spri_base-0x1400)/4]>>16; | |
| 1815 | 1730 | } |
| 1816 | 1731 | |
| 1817 | 1732 | line_t->alpha_level[y]=alpha_level; |
| r10886 | r10887 | |
| 1835 | 1750 | else if (sprite_clip&0x33) |
| 1836 | 1751 | { |
| 1837 | 1752 | int line_enable=1; |
| 1838 | calculate_clip(y, ((sprite_clip&0x33)<<4), &line_t->sprite_clip0[y], &line_t->sprite_clip1[y], &line_enable); | |
| 1753 | calculate_clip(state, y, ((sprite_clip&0x33)<<4), &line_t->sprite_clip0[y], &line_t->sprite_clip1[y], &line_enable); | |
| 1839 | 1754 | if (line_enable==0) |
| 1840 | 1755 | line_t->sprite_clip0[y]=0x7fff7fff; |
| 1841 | 1756 | } |
| r10886 | r10887 | |
| 1855 | 1770 | /* sx and sy are 16.16 fixed point numbers */ |
| 1856 | 1771 | static void get_line_ram_info(running_machine *machine, tilemap_t *tmap, int sx, int sy, int pos, UINT32 *f3_pf_data_n) |
| 1857 | 1772 | { |
| 1858 | struct f3_playfield_line_inf *line_t=&pf_line_inf[pos]; | |
| 1773 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 1774 | struct f3_playfield_line_inf *line_t=&state->pf_line_inf[pos]; | |
| 1859 | 1775 | const bitmap_t *srcbitmap; |
| 1860 | 1776 | const bitmap_t *flagsbitmap; |
| 1861 | 1777 | |
| r10886 | r10887 | |
| 1875 | 1791 | |
| 1876 | 1792 | sx+=((46<<16)); |
| 1877 | 1793 | |
| 1878 | if (flipscreen) | |
| 1794 | if (state->flipscreen) | |
| 1879 | 1795 | { |
| 1880 | 1796 | line_base=0xa1fe + (pos*0x200); |
| 1881 | 1797 | zoom_base=0x81fe;// + (pos*0x200); |
| r10886 | r10887 | |
| 1886 | 1802 | y_end=-1; |
| 1887 | 1803 | y_inc=-1; |
| 1888 | 1804 | |
| 1889 | if (f3_game_config->extend) sx=-sx+((188-512)<<16); else sx=-sx+(188<<16); /* Adjust for flipped scroll position */ | |
| 1805 | if (state->f3_game_config->extend) sx=-sx+((188-512)<<16); else sx=-sx+(188<<16); /* Adjust for flipped scroll position */ | |
| 1890 | 1806 | y_index_fx=-sy-(256<<16); /* Adjust for flipped scroll position */ |
| 1891 | 1807 | } |
| 1892 | 1808 | else |
| r10886 | r10887 | |
| 1909 | 1825 | /* The zoom, column and row values can latch according to control ram */ |
| 1910 | 1826 | if (y&1) |
| 1911 | 1827 | { |
| 1912 | if (f3_line_ram[0x300+(y>>1)]&bit_select1) | |
| 1913 | x_offset=(f3_line_ram[line_base/4]&0xffff)<<10; | |
| 1914 | if (f3_line_ram[0x380+(y>>1)]&bit_select1) | |
| 1915 | pri=f3_line_ram[pri_base/4]&0xffff; | |
| 1828 | if (state->f3_line_ram[0x300+(y>>1)]&bit_select1) | |
| 1829 | x_offset=(state->f3_line_ram[line_base/4]&0xffff)<<10; | |
| 1830 | if (state->f3_line_ram[0x380+(y>>1)]&bit_select1) | |
| 1831 | pri=state->f3_line_ram[pri_base/4]&0xffff; | |
| 1916 | 1832 | |
| 1917 | 1833 | // Zoom for playfields 1 & 3 is interleaved, as is the latch select |
| 1918 | 1834 | switch (pos) |
| 1919 | 1835 | { |
| 1920 | 1836 | case 0: |
| 1921 | if (f3_line_ram[0x200+(y>>1)]&bit_select1) | |
| 1922 | line_zoom=f3_line_ram[(zoom_base+0x000)/4]&0xffff; | |
| 1837 | if (state->f3_line_ram[0x200+(y>>1)]&bit_select1) | |
| 1838 | line_zoom=state->f3_line_ram[(zoom_base+0x000)/4]&0xffff; | |
| 1923 | 1839 | break; |
| 1924 | 1840 | case 1: |
| 1925 | if (f3_line_ram[0x200+(y>>1)]&0x2) | |
| 1926 | line_zoom=((f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); | |
| 1927 | if (f3_line_ram[0x200+(y>>1)]&0x8) | |
| 1928 | line_zoom=((f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); | |
| 1841 | if (state->f3_line_ram[0x200+(y>>1)]&0x2) | |
| 1842 | line_zoom=((state->f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); | |
| 1843 | if (state->f3_line_ram[0x200+(y>>1)]&0x8) | |
| 1844 | line_zoom=((state->f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); | |
| 1929 | 1845 | break; |
| 1930 | 1846 | case 2: |
| 1931 | if (f3_line_ram[0x200+(y>>1)]&bit_select1) | |
| 1932 | line_zoom=f3_line_ram[(zoom_base+0x400)/4]&0xffff; | |
| 1847 | if (state->f3_line_ram[0x200+(y>>1)]&bit_select1) | |
| 1848 | line_zoom=state->f3_line_ram[(zoom_base+0x400)/4]&0xffff; | |
| 1933 | 1849 | break; |
| 1934 | 1850 | case 3: |
| 1935 | if (f3_line_ram[0x200+(y>>1)]&0x8) | |
| 1936 | line_zoom=((f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); | |
| 1937 | if (f3_line_ram[0x200+(y>>1)]&0x2) | |
| 1938 | line_zoom=((f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); | |
| 1851 | if (state->f3_line_ram[0x200+(y>>1)]&0x8) | |
| 1852 | line_zoom=((state->f3_line_ram[(zoom_base+0x600)/4]&0xffff)&0xff00) | (line_zoom&0x00ff); | |
| 1853 | if (state->f3_line_ram[0x200+(y>>1)]&0x2) | |
| 1854 | line_zoom=((state->f3_line_ram[(zoom_base+0x200)/4]&0xffff)&0x00ff) | (line_zoom&0xff00); | |
| 1939 | 1855 | break; |
| 1940 | 1856 | default: |
| 1941 | 1857 | break; |
| 1942 | 1858 | } |
| 1943 | 1859 | |
| 1944 | 1860 | // Column scroll only affects playfields 2 & 3 |
| 1945 | if (pos>=2 && f3_line_ram[0x000+(y>>1)]&bit_select1) | |
| 1946 | colscroll=(f3_line_ram[col_base/4]>> 0)&0x3ff; | |
| 1861 | if (pos>=2 && state->f3_line_ram[0x000+(y>>1)]&bit_select1) | |
| 1862 | colscroll=(state->f3_line_ram[col_base/4]>> 0)&0x3ff; | |
| 1947 | 1863 | } |
| 1948 | 1864 | else |
| 1949 | 1865 | { |
| 1950 | if (f3_line_ram[0x300+(y>>1)]&bit_select0) | |
| 1951 | x_offset=(f3_line_ram[line_base/4]&0xffff0000)>>6; | |
| 1866 | if (state->f3_line_ram[0x300+(y>>1)]&bit_select0) | |
| 1867 | x_offset=(state->f3_line_ram[line_base/4]&0xffff0000)>>6; | |
| 1952 | 1868 | |
| 1953 | if (f3_line_ram[0x380+(y>>1)]&bit_select0) | |
| 1954 | pri=(f3_line_ram[pri_base/4]>>16)&0xffff; | |
| 1869 | if (state->f3_line_ram[0x380+(y>>1)]&bit_select0) | |
| 1870 | pri=(state->f3_line_ram[pri_base/4]>>16)&0xffff; | |
| 1955 | 1871 | |
| 1956 | 1872 | // Zoom for playfields 1 & 3 is interleaved, as is the latch select |
| 1957 | 1873 | switch (pos) |
| 1958 | 1874 | { |
| 1959 | 1875 | case 0: |
| 1960 | if (f3_line_ram[0x200+(y>>1)]&bit_select0) | |
| 1961 | line_zoom=f3_line_ram[(zoom_base+0x000)/4]>>16; | |
| 1876 | if (state->f3_line_ram[0x200+(y>>1)]&bit_select0) | |
| 1877 | line_zoom=state->f3_line_ram[(zoom_base+0x000)/4]>>16; | |
| 1962 | 1878 | break; |
| 1963 | 1879 | case 1: |
| 1964 | if (f3_line_ram[0x200+(y>>1)]&0x20000) | |
| 1965 | line_zoom=((f3_line_ram[(zoom_base+0x200)/4]>>16)&0xff00) | (line_zoom&0x00ff); | |
| 1966 | if (f3_line_ram[0x200+(y>>1)]&0x80000) | |
| 1967 | line_zoom=((f3_line_ram[(zoom_base+0x600)/4]>>16)&0x00ff) | (line_zoom&0xff00); | |
| 1880 | if (state->f3_line_ram[0x200+(y>>1)]&0x20000) | |
| 1881 | line_zoom=((state->f3_line_ram[(zoom_base+0x200)/4]>>16)&0xff00) | (line_zoom&0x00ff); | |
| 1882 | if (state->f3_line_ram[0x200+(y>>1)]&0x80000) | |
| 1883 | line_zoom=((state->f3_line_ram[(zoom_base+0x600)/4]>>16)&0x00ff) | (line_zoom&0xff00); | |
| 1968 | 1884 | break; |
| 1969 | 1885 | case 2: |
| 1970 | if (f3_line_ram[0x200+(y>>1)]&bit_select0) | |
| 1971 | line_zoom=f3_line_ram[(zoom_base+0x400)/4]>>16; | |
| 1886 | if (state->f3_line_ram[0x200+(y>>1)]&bit_select0) | |
| 1887 | line_zoom=state->f3_line_ram[(zoom_base+0x400)/4]>>16; | |
| 1972 | 1888 | break; |
| 1973 | 1889 | case 3: |
| 1974 | if (f3_line_ram[0x200+(y>>1)]&0x80000) | |
| 1975 | line_zoom=((f3_line_ram[(zoom_base+0x600)/4]>>16)&0xff00) | (line_zoom&0x00ff); | |
| 1976 | if (f3_line_ram[0x200+(y>>1)]&0x20000) | |
| 1977 | line_zoom=((f3_line_ram[(zoom_base+0x200)/4]>>16)&0x00ff) | (line_zoom&0xff00); | |
| 1890 | if (state->f3_line_ram[0x200+(y>>1)]&0x80000) | |
| 1891 | line_zoom=((state->f3_line_ram[(zoom_base+0x600)/4]>>16)&0xff00) | (line_zoom&0x00ff); | |
| 1892 | if (state->f3_line_ram[0x200+(y>>1)]&0x20000) | |
| 1893 | line_zoom=((state->f3_line_ram[(zoom_base+0x200)/4]>>16)&0x00ff) | (line_zoom&0xff00); | |
| 1978 | 1894 | break; |
| 1979 | 1895 | default: |
| 1980 | 1896 | break; |
| 1981 | 1897 | } |
| 1982 | 1898 | |
| 1983 | 1899 | // Column scroll only affects playfields 2 & 3 |
| 1984 | if (pos>=2 && f3_line_ram[0x000+(y>>1)]&bit_select0) | |
| 1985 | colscroll=(f3_line_ram[col_base/4]>>16)&0x3ff; | |
| 1900 | if (pos>=2 && state->f3_line_ram[0x000+(y>>1)]&bit_select0) | |
| 1901 | colscroll=(state->f3_line_ram[col_base/4]>>16)&0x3ff; | |
| 1986 | 1902 | } |
| 1987 | 1903 | |
| 1988 | if (!pri || (!flipscreen && y<24) || (flipscreen && y>231) || | |
| 1904 | if (!pri || (!state->flipscreen && y<24) || (state->flipscreen && y>231) || | |
| 1989 | 1905 | (pri&0xc000)==0xc000 || !(pri&0x2000)/**/) |
| 1990 | 1906 | line_enable=0; |
| 1991 | 1907 | else if(pri&0x4000) //alpha1 |
| r10886 | r10887 | |
| 2013 | 1929 | else if (pri&0x0330) |
| 2014 | 1930 | { |
| 2015 | 1931 | //fast path todo - remove line enable |
| 2016 | calculate_clip(y, pri&0x0330, &line_t->clip0[y], &line_t->clip1[y], &line_enable); | |
| 1932 | calculate_clip(state, y, pri&0x0330, &line_t->clip0[y], &line_t->clip1[y], &line_enable); | |
| 2017 | 1933 | } |
| 2018 | 1934 | else |
| 2019 | 1935 | { |
| r10886 | r10887 | |
| 2048 | 1964 | UINT16 *src_s; |
| 2049 | 1965 | UINT8 *tsrc_s; |
| 2050 | 1966 | |
| 2051 | x_index_fx = (sx+_x_offset[y]-(10*0x10000)+(10*line_t->x_zoom[y]))&((width_mask<<16)|0xffff); | |
| 1967 | x_index_fx = (sx+_x_offset[y]-(10*0x10000)+(10*line_t->x_zoom[y]))&((state->width_mask<<16)|0xffff); | |
| 2052 | 1968 | y_index = ((y_index_fx>>16)+_colscroll[y])&0x1ff; |
| 2053 | 1969 | |
| 2054 | 1970 | /* check tile status */ |
| r10886 | r10887 | |
| 2061 | 1977 | /* set pixmap index */ |
| 2062 | 1978 | line_t->x_count[y]=x_index_fx & 0xffff; // Fractional part |
| 2063 | 1979 | line_t->src_s[y]=src_s=BITMAP_ADDR16(srcbitmap, y_index, 0); |
| 2064 | line_t->src_e[y]=&src_s[width_mask+1]; | |
| 1980 | line_t->src_e[y]=&src_s[state->width_mask+1]; | |
| 2065 | 1981 | line_t->src[y]=&src_s[x_index_fx>>16]; |
| 2066 | 1982 | |
| 2067 | 1983 | line_t->tsrc_s[y]=tsrc_s=BITMAP_ADDR8(flagsbitmap, y_index, 0); |
| r10886 | r10887 | |
| 2073 | 1989 | } |
| 2074 | 1990 | } |
| 2075 | 1991 | |
| 2076 | static void get_vram_info(tilemap_t *vram_tilemap, tilemap_t *pixel_tilemap, int sx, int sy) | |
| 1992 | static void get_vram_info(running_machine *machine, tilemap_t *vram_tilemap, tilemap_t *pixel_tilemap, int sx, int sy) | |
| 2077 | 1993 | { |
| 2078 | const struct f3_spritealpha_line_inf *sprite_alpha_line_t=&sa_line_inf[0]; | |
| 2079 | struct f3_playfield_line_inf *line_t=&pf_line_inf[4]; | |
| 1994 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 1995 | const struct f3_spritealpha_line_inf *sprite_alpha_line_t=&state->sa_line_inf[0]; | |
| 1996 | struct f3_playfield_line_inf *line_t=&state->pf_line_inf[4]; | |
| 2080 | 1997 | const bitmap_t *srcbitmap_pixel, *srcbitmap_vram; |
| 2081 | 1998 | const bitmap_t *flagsbitmap_pixel, *flagsbitmap_vram; |
| 2082 | 1999 | |
| r10886 | r10887 | |
| 2089 | 2006 | |
| 2090 | 2007 | const int vram_width_mask=0x1ff; |
| 2091 | 2008 | |
| 2092 | if (flipscreen) | |
| 2009 | if (state->flipscreen) | |
| 2093 | 2010 | { |
| 2094 | 2011 | pri_base =0x73fe; |
| 2095 | 2012 | inc=-2; |
| r10886 | r10887 | |
| 2113 | 2030 | /* The zoom, column and row values can latch according to control ram */ |
| 2114 | 2031 | if (y&1) |
| 2115 | 2032 | { |
| 2116 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x2) | |
| 2117 | pri=(f3_line_ram[pri_base/4]&0xffff); | |
| 2033 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x2) | |
| 2034 | pri=(state->f3_line_ram[pri_base/4]&0xffff); | |
| 2118 | 2035 | } |
| 2119 | 2036 | else |
| 2120 | 2037 | { |
| 2121 | if (f3_line_ram[(0x0600/4)+(y>>1)]&0x20000) | |
| 2122 | pri=(f3_line_ram[pri_base/4]&0xffff0000)>>16; | |
| 2038 | if (state->f3_line_ram[(0x0600/4)+(y>>1)]&0x20000) | |
| 2039 | pri=(state->f3_line_ram[pri_base/4]&0xffff0000)>>16; | |
| 2123 | 2040 | } |
| 2124 | 2041 | |
| 2125 | if (!pri || (!flipscreen && y<24) || (flipscreen && y>231) || | |
| 2042 | if (!pri || (!state->flipscreen && y<24) || (state->flipscreen && y>231) || | |
| 2126 | 2043 | (pri&0xc000)==0xc000 || !(pri&0x2000)/**/) |
| 2127 | 2044 | line_enable=0; |
| 2128 | 2045 | else if(pri&0x4000) //alpha1 |
| r10886 | r10887 | |
| 2140 | 2057 | else if (pri&0x0330) |
| 2141 | 2058 | { |
| 2142 | 2059 | //fast path todo - remove line enable |
| 2143 | calculate_clip(y, pri&0x0330, &line_t->clip0[y], &line_t->clip1[y], &line_enable); | |
| 2060 | calculate_clip(state, y, pri&0x0330, &line_t->clip0[y], &line_t->clip1[y], &line_enable); | |
| 2144 | 2061 | } |
| 2145 | 2062 | else |
| 2146 | 2063 | { |
| r10886 | r10887 | |
| 2203 | 2120 | |
| 2204 | 2121 | static void scanline_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 2205 | 2122 | { |
| 2123 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 2206 | 2124 | int i,j,y,ys,ye; |
| 2207 | 2125 | int y_start,y_end,y_start_next,y_end_next; |
| 2208 | 2126 | UINT8 draw_line[256]; |
| r10886 | r10887 | |
| 2210 | 2128 | |
| 2211 | 2129 | UINT32 rot=0; |
| 2212 | 2130 | |
| 2213 | if (flipscreen) | |
| 2131 | if (state->flipscreen) | |
| 2214 | 2132 | { |
| 2215 | 2133 | rot=ORIENTATION_FLIP_Y; |
| 2216 | 2134 | ys=0; |
| r10886 | r10887 | |
| 2236 | 2154 | int spri; |
| 2237 | 2155 | int alpha; |
| 2238 | 2156 | int layer_tmp[5]; |
| 2239 | ||
| 2157 | struct f3_playfield_line_inf *pf_line_inf = state->pf_line_inf; | |
| 2158 | struct f3_spritealpha_line_inf *sa_line_inf = state->sa_line_inf; | |
| 2240 | 2159 | int count_skip_layer=0; |
| 2241 | 2160 | int sprite[6]={0,0,0,0,0,0}; |
| 2242 | 2161 | const struct f3_playfield_line_inf *line_t[5]; |
| r10886 | r10887 | |
| 2311 | 2230 | (sprite_alpha&0xff) != 0xff ) |
| 2312 | 2231 | { |
| 2313 | 2232 | /* set alpha level */ |
| 2314 | if(alpha_level!=alpha_level_last) | |
| 2233 | if(alpha_level!=state->alpha_level_last) | |
| 2315 | 2234 | { |
| 2316 | 2235 | int al_s,al_d; |
| 2317 | 2236 | int a=alpha_level; |
| r10886 | r10887 | |
| 2325 | 2244 | al_d = ( (15-b)*256) / 8; |
| 2326 | 2245 | if(al_s>255) al_s = 255; |
| 2327 | 2246 | if(al_d>255) al_d = 255; |
| 2328 | f3_alpha_level_3as = al_s; | |
| 2329 | f3_alpha_level_3ad = al_d; | |
| 2330 | f3_alpha_level_2as = al_d; | |
| 2331 | f3_alpha_level_2ad = al_s; | |
| 2247 | state->f3_alpha_level_3as = al_s; | |
| 2248 | state->f3_alpha_level_3ad = al_d; | |
| 2249 | state->f3_alpha_level_2as = al_d; | |
| 2250 | state->f3_alpha_level_2ad = al_s; | |
| 2332 | 2251 | |
| 2333 | 2252 | al_s = ( (15-c)*256) / 8; |
| 2334 | 2253 | al_d = ( (15-a)*256) / 8; |
| 2335 | 2254 | if(al_s>255) al_s = 255; |
| 2336 | 2255 | if(al_d>255) al_d = 255; |
| 2337 | f3_alpha_level_3bs = al_s; | |
| 2338 | f3_alpha_level_3bd = al_d; | |
| 2339 | f3_alpha_level_2bs = al_d; | |
| 2340 | f3_alpha_level_2bd = al_s; | |
| 2256 | state->f3_alpha_level_3bs = al_s; | |
| 2257 | state->f3_alpha_level_3bd = al_d; | |
| 2258 | state->f3_alpha_level_2bs = al_d; | |
| 2259 | state->f3_alpha_level_2bd = al_s; | |
| 2341 | 2260 | |
| 2342 | f3_alpha_set_level(); | |
| 2343 | alpha_level_last=alpha_level; | |
| 2261 | f3_alpha_set_level(state); | |
| 2262 | state->alpha_level_last=alpha_level; | |
| 2344 | 2263 | } |
| 2345 | 2264 | |
| 2346 | 2265 | /* set sprite alpha mode */ |
| 2347 | 2266 | sprite_alpha_check=0; |
| 2348 | 2267 | sprite_alpha_all_2a=1; |
| 2349 | dpix_sp[1]=0; | |
| 2350 | dpix_sp[2]=0; | |
| 2351 | dpix_sp[4]=0; | |
| 2352 | dpix_sp[8]=0; | |
| 2268 | state->dpix_sp[1]=0; | |
| 2269 | state->dpix_sp[2]=0; | |
| 2270 | state->dpix_sp[4]=0; | |
| 2271 | state->dpix_sp[8]=0; | |
| 2353 | 2272 | for(i=0;i<4;i++) /* i = sprite priority offset */ |
| 2354 | 2273 | { |
| 2355 | 2274 | UINT8 sprite_alpha_mode=(sprite_alpha>>(i*2))&3; |
| 2356 | 2275 | UINT8 sftbit=1<<i; |
| 2357 | if(sprite_pri_usage&sftbit) | |
| 2276 | if(state->sprite_pri_usage&sftbit) | |
| 2358 | 2277 | { |
| 2359 | 2278 | if(sprite_alpha_mode==1) |
| 2360 | 2279 | { |
| 2361 | if(f3_alpha_level_2as==0 && f3_alpha_level_2ad==255) | |
| 2362 | sprite_pri_usage&=~sftbit; // Disable sprite priority block | |
| 2280 | if(state->f3_alpha_level_2as==0 && state->f3_alpha_level_2ad==255) | |
| 2281 | state->sprite_pri_usage&=~sftbit; // Disable sprite priority block | |
| 2363 | 2282 | else |
| 2364 | 2283 | { |
| 2365 | dpix_sp[sftbit]=dpix_n[2]; | |
| 2284 | state->dpix_sp[sftbit]=state->dpix_n[2]; | |
| 2366 | 2285 | sprite_alpha_check|=sftbit; |
| 2367 | 2286 | } |
| 2368 | 2287 | } |
| r10886 | r10887 | |
| 2370 | 2289 | { |
| 2371 | 2290 | if(sprite_alpha&0xff00) |
| 2372 | 2291 | { |
| 2373 | if(f3_alpha_level_3as==0 && f3_alpha_level_3ad==255) sprite_pri_usage&=~sftbit; | |
| 2292 | if(state->f3_alpha_level_3as==0 && state->f3_alpha_level_3ad==255) state->sprite_pri_usage&=~sftbit; | |
| 2374 | 2293 | else |
| 2375 | 2294 | { |
| 2376 | dpix_sp[sftbit]=dpix_n[3]; | |
| 2295 | state->dpix_sp[sftbit]=state->dpix_n[3]; | |
| 2377 | 2296 | sprite_alpha_check|=sftbit; |
| 2378 | 2297 | sprite_alpha_all_2a=0; |
| 2379 | 2298 | } |
| 2380 | 2299 | } |
| 2381 | 2300 | else |
| 2382 | 2301 | { |
| 2383 | if(f3_alpha_level_3bs==0 && f3_alpha_level_3bd==255) sprite_pri_usage&=~sftbit; | |
| 2302 | if(state->f3_alpha_level_3bs==0 && state->f3_alpha_level_3bd==255) state->sprite_pri_usage&=~sftbit; | |
| 2384 | 2303 | else |
| 2385 | 2304 | { |
| 2386 | dpix_sp[sftbit]=dpix_n[5]; | |
| 2305 | state->dpix_sp[sftbit]=state->dpix_n[5]; | |
| 2387 | 2306 | sprite_alpha_check|=sftbit; |
| 2388 | 2307 | sprite_alpha_all_2a=0; |
| 2389 | 2308 | } |
| r10886 | r10887 | |
| 2402 | 2321 | { |
| 2403 | 2322 | if(alpha_type==1) |
| 2404 | 2323 | { |
| 2405 | /* if (f3_alpha_level_2as==0 && f3_alpha_level_2ad==255) | |
| 2324 | /* if (state->f3_alpha_level_2as==0 && state->f3_alpha_level_2ad==255) | |
| 2406 | 2325 | * alpha_mode[i]=3; alpha_mode_flag[i] |= 0x80;} |
| 2407 | 2326 | * will display continue screen in gseeker (mt 00026) */ |
| 2408 | if (f3_alpha_level_2as==0 && f3_alpha_level_2ad==255) alpha_mode[i]=0; | |
| 2409 | else if(f3_alpha_level_2as==255 && f3_alpha_level_2ad==0 ) alpha_mode[i]=1; | |
| 2327 | if (state->f3_alpha_level_2as==0 && state->f3_alpha_level_2ad==255) alpha_mode[i]=0; | |
| 2328 | else if(state->f3_alpha_level_2as==255 && state->f3_alpha_level_2ad==0 ) alpha_mode[i]=1; | |
| 2410 | 2329 | } |
| 2411 | 2330 | else if(alpha_type==2) |
| 2412 | 2331 | { |
| 2413 | if (f3_alpha_level_2bs==0 && f3_alpha_level_2bd==255) alpha_mode[i]=0; | |
| 2414 | else if(f3_alpha_level_2as==255 && f3_alpha_level_2ad==0 && | |
| 2415 | f3_alpha_level_2bs==255 && f3_alpha_level_2bd==0 ) alpha_mode[i]=1; | |
| 2332 | if (state->f3_alpha_level_2bs==0 && state->f3_alpha_level_2bd==255) alpha_mode[i]=0; | |
| 2333 | else if(state->f3_alpha_level_2as==255 && state->f3_alpha_level_2ad==0 && | |
| 2334 | state->f3_alpha_level_2bs==255 && state->f3_alpha_level_2bd==0 ) alpha_mode[i]=1; | |
| 2416 | 2335 | } |
| 2417 | 2336 | else if(alpha_type==3) |
| 2418 | 2337 | { |
| 2419 | if (f3_alpha_level_2as==0 && f3_alpha_level_2ad==255 && | |
| 2420 | f3_alpha_level_2bs==0 && f3_alpha_level_2bd==255) alpha_mode[i]=0; | |
| 2421 | else if(f3_alpha_level_2as==255 && f3_alpha_level_2ad==0 && | |
| 2422 | f3_alpha_level_2bs==255 && f3_alpha_level_2bd==0 ) alpha_mode[i]=1; | |
| 2338 | if (state->f3_alpha_level_2as==0 && state->f3_alpha_level_2ad==255 && | |
| 2339 | state->f3_alpha_level_2bs==0 && state->f3_alpha_level_2bd==255) alpha_mode[i]=0; | |
| 2340 | else if(state->f3_alpha_level_2as==255 && state->f3_alpha_level_2ad==0 && | |
| 2341 | state->f3_alpha_level_2bs==255 && state->f3_alpha_level_2bd==0 ) alpha_mode[i]=1; | |
| 2423 | 2342 | } |
| 2424 | 2343 | } |
| 2425 | 2344 | else if(alpha_mode[i]==3) |
| 2426 | 2345 | { |
| 2427 | 2346 | if(alpha_type==1) |
| 2428 | 2347 | { |
| 2429 | if (f3_alpha_level_3as==0 && f3_alpha_level_3ad==255) alpha_mode[i]=0; | |
| 2430 | else if(f3_alpha_level_3as==255 && f3_alpha_level_3ad==0 ) alpha_mode[i]=1; | |
| 2348 | if (state->f3_alpha_level_3as==0 && state->f3_alpha_level_3ad==255) alpha_mode[i]=0; | |
| 2349 | else if(state->f3_alpha_level_3as==255 && state->f3_alpha_level_3ad==0 ) alpha_mode[i]=1; | |
| 2431 | 2350 | } |
| 2432 | 2351 | else if(alpha_type==2) |
| 2433 | 2352 | { |
| 2434 | if (f3_alpha_level_3bs==0 && f3_alpha_level_3bd==255) alpha_mode[i]=0; | |
| 2435 | else if(f3_alpha_level_3as==255 && f3_alpha_level_3ad==0 && | |
| 2436 | f3_alpha_level_3bs==255 && f3_alpha_level_3bd==0 ) alpha_mode[i]=1; | |
| 2353 | if (state->f3_alpha_level_3bs==0 && state->f3_alpha_level_3bd==255) alpha_mode[i]=0; | |
| 2354 | else if(state->f3_alpha_level_3as==255 && state->f3_alpha_level_3ad==0 && | |
| 2355 | state->f3_alpha_level_3bs==255 && state->f3_alpha_level_3bd==0 ) alpha_mode[i]=1; | |
| 2437 | 2356 | } |
| 2438 | 2357 | else if(alpha_type==3) |
| 2439 | 2358 | { |
| 2440 | if (f3_alpha_level_3as==0 && f3_alpha_level_3ad==255 && | |
| 2441 | f3_alpha_level_3bs==0 && f3_alpha_level_3bd==255) alpha_mode[i]=0; | |
| 2442 | else if(f3_alpha_level_3as==255 && f3_alpha_level_3ad==0 && | |
| 2443 | f3_alpha_level_3bs==255 && f3_alpha_level_3bd==0 ) alpha_mode[i]=1; | |
| 2359 | if (state->f3_alpha_level_3as==0 && state->f3_alpha_level_3ad==255 && | |
| 2360 | state->f3_alpha_level_3bs==0 && state->f3_alpha_level_3bd==255) alpha_mode[i]=0; | |
| 2361 | else if(state->f3_alpha_level_3as==255 && state->f3_alpha_level_3ad==0 && | |
| 2362 | state->f3_alpha_level_3bs==255 && state->f3_alpha_level_3bd==0 ) alpha_mode[i]=1; | |
| 2444 | 2363 | } |
| 2445 | 2364 | } |
| 2446 | 2365 | } |
| r10886 | r10887 | |
| 2453 | 2372 | sprite_alpha_all_2a ) |
| 2454 | 2373 | { |
| 2455 | 2374 | int alpha_type = (alpha_mode_flag[0] | alpha_mode_flag[1] | alpha_mode_flag[2] | alpha_mode_flag[3])&0x30; |
| 2456 | if( (alpha_type==0x10 && f3_alpha_level_2as==255) || | |
| 2457 | (alpha_type==0x20 && f3_alpha_level_2as==255 && f3_alpha_level_2bs==255) || | |
| 2458 | (alpha_type==0x30 && f3_alpha_level_2as==255 && f3_alpha_level_2bs==255) ) | |
| 2375 | if( (alpha_type==0x10 && state->f3_alpha_level_2as==255) || | |
| 2376 | (alpha_type==0x20 && state->f3_alpha_level_2as==255 && state->f3_alpha_level_2bs==255) || | |
| 2377 | (alpha_type==0x30 && state->f3_alpha_level_2as==255 && state->f3_alpha_level_2bs==255) ) | |
| 2459 | 2378 | { |
| 2460 | 2379 | if(alpha_mode[0]>1) alpha_mode[0]=1; |
| 2461 | 2380 | if(alpha_mode[1]>1) alpha_mode[1]=1; |
| r10886 | r10887 | |
| 2463 | 2382 | if(alpha_mode[3]>1) alpha_mode[3]=1; |
| 2464 | 2383 | if(alpha_mode[4]>1) alpha_mode[4]=1; |
| 2465 | 2384 | sprite_alpha_check=0; |
| 2466 | dpix_sp[1]=0; | |
| 2467 | dpix_sp[2]=0; | |
| 2468 | dpix_sp[4]=0; | |
| 2469 | dpix_sp[8]=0; | |
| 2385 | state->dpix_sp[1]=0; | |
| 2386 | state->dpix_sp[2]=0; | |
| 2387 | state->dpix_sp[4]=0; | |
| 2388 | state->dpix_sp[8]=0; | |
| 2470 | 2389 | } |
| 2471 | 2390 | } |
| 2472 | 2391 | } |
| 2473 | 2392 | else |
| 2474 | 2393 | { |
| 2475 | 2394 | sprite_alpha_check=0; |
| 2476 | dpix_sp[1]=0; | |
| 2477 | dpix_sp[2]=0; | |
| 2478 | dpix_sp[4]=0; | |
| 2479 | dpix_sp[8]=0; | |
| 2395 | state->dpix_sp[1]=0; | |
| 2396 | state->dpix_sp[2]=0; | |
| 2397 | state->dpix_sp[4]=0; | |
| 2398 | state->dpix_sp[8]=0; | |
| 2480 | 2399 | } |
| 2481 | 2400 | |
| 2482 | 2401 | |
| r10886 | r10887 | |
| 2547 | 2466 | for(i=0;i<4;i++) /* i = sprite priority offset */ |
| 2548 | 2467 | { |
| 2549 | 2468 | int sp,sflg=1<<i; |
| 2550 | if(!(sprite_pri_usage & sflg)) continue; | |
| 2469 | if(!(state->sprite_pri_usage & sflg)) continue; | |
| 2551 | 2470 | sp=pri_sp[i]; |
| 2552 | 2471 | |
| 2553 | 2472 | /* |
| r10886 | r10887 | |
| 2557 | 2476 | DARIUSG (ZONE V' BOSS) ---> playfield |
| 2558 | 2477 | */ |
| 2559 | 2478 | |
| 2560 | if (f3_game == BUBSYMPH ) sp++; //BUBSYMPH (title) | |
| 2561 | if (f3_game == GSEEKER ) sp++; //GSEEKER (plane leaving hangar) | |
| 2479 | if (state->f3_game == BUBSYMPH ) sp++; //BUBSYMPH (title) | |
| 2480 | if (state->f3_game == GSEEKER ) sp++; //GSEEKER (plane leaving hangar) | |
| 2562 | 2481 | |
| 2563 | 2482 | if( sp>l0) sprite[0]|=sflg; |
| 2564 | 2483 | else if(sp<=l0 && sp>l1) sprite[1]|=sflg; |
| r10886 | r10887 | |
| 2583 | 2502 | if(alpha_mode[pos]>1) |
| 2584 | 2503 | { |
| 2585 | 2504 | int alpha_type=(((alpha_mode_flag[pos]>>4)&3)-1)*2; |
| 2586 | dpix_lp[i]=dpix_n[alpha_mode[pos]+alpha_type]; | |
| 2505 | state->dpix_lp[i]=state->dpix_n[alpha_mode[pos]+alpha_type]; | |
| 2587 | 2506 | alpha=1; |
| 2588 | 2507 | } |
| 2589 | 2508 | else |
| 2590 | 2509 | { |
| 2591 | if(alpha) dpix_lp[i]=dpix_n[1]; | |
| 2592 | else dpix_lp[i]=dpix_n[0]; | |
| 2510 | if(alpha) state->dpix_lp[i]=state->dpix_n[1]; | |
| 2511 | else state->dpix_lp[i]=state->dpix_n[0]; | |
| 2593 | 2512 | } |
| 2594 | 2513 | } |
| 2595 | 2514 | if(sprite[5]&sprite_alpha_check) alpha=1; |
| r10886 | r10887 | |
| 2603 | 2522 | /******************************************************************************/ |
| 2604 | 2523 | |
| 2605 | 2524 | #define PSET_T \ |
| 2606 | c = *source & sprite_pen_mask; \ | |
| 2525 | c = *source & state->sprite_pen_mask; \ | |
| 2607 | 2526 | if(c) \ |
| 2608 | 2527 | { \ |
| 2609 | 2528 | p=*pri; \ |
| r10886 | r10887 | |
| 2618 | 2537 | p=*pri; \ |
| 2619 | 2538 | if(!p || p==0xff) \ |
| 2620 | 2539 | { \ |
| 2621 | *dest = pal[*source & sprite_pen_mask]; \ | |
| 2540 | *dest = pal[*source & state->sprite_pen_mask]; \ | |
| 2622 | 2541 | *pri = pri_dst; \ |
| 2623 | 2542 | } |
| 2624 | 2543 | |
| r10886 | r10887 | |
| 2635 | 2554 | int sx,int sy, |
| 2636 | 2555 | UINT8 pri_dst) |
| 2637 | 2556 | { |
| 2557 | taito_f3_state *state = gfx->machine->driver_data<taito_f3_state>(); | |
| 2638 | 2558 | rectangle myclip; |
| 2639 | 2559 | |
| 2640 | 2560 | pri_dst=1<<pri_dst; |
| r10886 | r10887 | |
| 2724 | 2644 | // if (dest_bmp->bpp == 32) |
| 2725 | 2645 | { |
| 2726 | 2646 | int y=ey-sy; |
| 2727 | int x=(ex-sx-1)|(tile_opaque_sp[code % gfx->total_elements]<<4); | |
| 2647 | int x=(ex-sx-1)|(state->tile_opaque_sp[code % gfx->total_elements]<<4); | |
| 2728 | 2648 | const UINT8 *source0 = code_base + y_index * 16 + x_index_base; |
| 2729 | 2649 | UINT32 *dest0 = BITMAP_ADDR32(dest_bmp, sy, sx); |
| 2730 | UINT8 *pri0 = BITMAP_ADDR8(pri_alp_bitmap, sy, sx); | |
| 2650 | UINT8 *pri0 = BITMAP_ADDR8(state->pri_alp_bitmap, sy, sx); | |
| 2731 | 2651 | int yadv = dest_bmp->rowpixels; |
| 2732 | 2652 | dy=dy*16; |
| 2733 | 2653 | while(1) |
| r10886 | r10887 | |
| 2799 | 2719 | int scalex, int scaley, |
| 2800 | 2720 | UINT8 pri_dst) |
| 2801 | 2721 | { |
| 2722 | taito_f3_state *state = gfx->machine->driver_data<taito_f3_state>(); | |
| 2802 | 2723 | rectangle myclip; |
| 2803 | 2724 | |
| 2804 | 2725 | pri_dst=1<<pri_dst; |
| r10886 | r10887 | |
| 2892 | 2813 | { |
| 2893 | 2814 | const UINT8 *source = code_base + (y_index>>16) * 16; |
| 2894 | 2815 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 2895 | UINT8 *pri = BITMAP_ADDR8(pri_alp_bitmap, y, 0); | |
| 2816 | UINT8 *pri = BITMAP_ADDR8(state->pri_alp_bitmap, y, 0); | |
| 2896 | 2817 | |
| 2897 | 2818 | int x, x_index = x_index_base; |
| 2898 | 2819 | for( x=sx; x<ex; x++ ) |
| 2899 | 2820 | { |
| 2900 | int c = source[x_index>>16] & sprite_pen_mask; | |
| 2821 | int c = source[x_index>>16] & state->sprite_pen_mask; | |
| 2901 | 2822 | if(c) |
| 2902 | 2823 | { |
| 2903 | 2824 | UINT8 p=pri[x]; |
| r10886 | r10887 | |
| 2927 | 2848 | |
| 2928 | 2849 | static void get_sprite_info(running_machine *machine, const UINT32 *spriteram32_ptr) |
| 2929 | 2850 | { |
| 2851 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 2930 | 2852 | const rectangle &visarea = machine->primary_screen->visible_area(); |
| 2931 | 2853 | const int min_x=visarea.min_x,max_x=visarea.max_x; |
| 2932 | 2854 | const int min_y=visarea.min_y,max_y=visarea.max_y; |
| r10886 | r10887 | |
| 2941 | 2863 | |
| 2942 | 2864 | int x_addition_left = 8, y_addition_left = 8; |
| 2943 | 2865 | |
| 2944 | struct tempsprite *sprite_ptr = spritelist; | |
| 2866 | struct tempsprite *sprite_ptr = state->spritelist; | |
| 2945 | 2867 | |
| 2946 | 2868 | int total_sprites=0; |
| 2947 | 2869 | |
| r10886 | r10887 | |
| 2968 | 2890 | /* Check if special command bit is set */ |
| 2969 | 2891 | if (spriteram32_ptr[current_offs+1] & 0x8000) { |
| 2970 | 2892 | UINT32 cntrl=(spriteram32_ptr[current_offs+2])&0xffff; |
| 2971 | flipscreen=cntrl&0x2000; | |
| 2893 | state->flipscreen=cntrl&0x2000; | |
| 2972 | 2894 | |
| 2973 | 2895 | /* cntrl&0x1000 = disabled? (From F2 driver, doesn't seem used anywhere) |
| 2974 | 2896 | cntrl&0x0010 = ??? |
| 2975 | 2897 | cntrl&0x0020 = ??? |
| 2976 | 2898 | */ |
| 2977 | 2899 | |
| 2978 | sprite_extra_planes = (cntrl & 0x0300) >> 8; // 0 = 4bpp, 1 = 5bpp, 2 = unused?, 3 = 6bpp | |
| 2979 | sprite_pen_mask = (sprite_extra_planes << 4) | 0x0f; | |
| 2900 | state->sprite_extra_planes = (cntrl & 0x0300) >> 8; // 0 = 4bpp, 1 = 5bpp, 2 = unused?, 3 = 6bpp | |
| 2901 | state->sprite_pen_mask = (state->sprite_extra_planes << 4) | 0x0f; | |
| 2980 | 2902 | |
| 2981 | 2903 | /* Sprite bank select */ |
| 2982 | 2904 | if (cntrl&1) { |
| r10886 | r10887 | |
| 3017 | 2939 | /* These games either don't set the XY control bits properly (68020 bug?), or |
| 3018 | 2940 | have some different mode from the others */ |
| 3019 | 2941 | #ifdef DARIUSG_KLUDGE |
| 3020 | if (f3_game==DARIUSG || f3_game==GEKIRIDO || f3_game==CLEOPATR || f3_game==RECALH) | |
| 2942 | if (state->f3_game==DARIUSG || state->f3_game==GEKIRIDO || state->f3_game==CLEOPATR || state->f3_game==RECALH) | |
| 3021 | 2943 | multi=spritecont&0xf0; |
| 3022 | 2944 | #endif |
| 3023 | 2945 | |
| r10886 | r10887 | |
| 3028 | 2950 | else color=(spriteram32_ptr[current_offs+2]>>16)&0xff; |
| 3029 | 2951 | |
| 3030 | 2952 | #ifdef DARIUSG_KLUDGE |
| 3031 | if (f3_game==DARIUSG || f3_game==GEKIRIDO || f3_game==CLEOPATR || f3_game==RECALH) { | |
| 2953 | if (state->f3_game==DARIUSG || state->f3_game==GEKIRIDO || state->f3_game==CLEOPATR || state->f3_game==RECALH) { | |
| 3032 | 2954 | /* Adjust X Position */ |
| 3033 | 2955 | if ((spritecont & 0x40) == 0) { |
| 3034 | 2956 | if (spritecont & 0x4) { |
| r10886 | r10887 | |
| 3156 | 3078 | if (!sprite) continue; |
| 3157 | 3079 | if (!x_addition || !y_addition) continue; |
| 3158 | 3080 | |
| 3159 | if (flipscreen) | |
| 3081 | if (state->flipscreen) | |
| 3160 | 3082 | { |
| 3161 | 3083 | int tx,ty; |
| 3162 | 3084 | |
| r10886 | r10887 | |
| 3187 | 3109 | sprite_ptr++; |
| 3188 | 3110 | total_sprites++; |
| 3189 | 3111 | } |
| 3190 | sprite_end = sprite_ptr; | |
| 3112 | state->sprite_end = sprite_ptr; | |
| 3191 | 3113 | } |
| 3192 | 3114 | #undef CALC_ZOOM |
| 3193 | 3115 | |
| 3194 | 3116 | |
| 3195 | 3117 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 3196 | 3118 | { |
| 3119 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3197 | 3120 | const struct tempsprite *sprite_ptr; |
| 3198 | 3121 | const gfx_element *sprite_gfx = machine->gfx[2]; |
| 3199 | 3122 | |
| 3200 | sprite_ptr = sprite_end; | |
| 3201 | sprite_pri_usage=0; | |
| 3123 | sprite_ptr = state->sprite_end; | |
| 3124 | state->sprite_pri_usage=0; | |
| 3202 | 3125 | |
| 3203 | 3126 | // if sprites use more than 4bpp, the bottom bits of the color code must be masked out. |
| 3204 | 3127 | // This fixes (at least) stage 1 battle ships and attract mode explosions in Ray Force. |
| 3205 | 3128 | |
| 3206 | while (sprite_ptr != spritelist) | |
| 3129 | while (sprite_ptr != state->spritelist) | |
| 3207 | 3130 | { |
| 3208 | 3131 | int pri; |
| 3209 | 3132 | sprite_ptr--; |
| 3210 | 3133 | |
| 3211 | 3134 | pri=sprite_ptr->pri; |
| 3212 | sprite_pri_usage|=1<<pri; | |
| 3135 | state->sprite_pri_usage|=1<<pri; | |
| 3213 | 3136 | |
| 3214 | 3137 | if(sprite_ptr->zoomx==16 && sprite_ptr->zoomy==16) |
| 3215 | 3138 | f3_drawgfx( |
| 3216 | 3139 | bitmap,cliprect,sprite_gfx, |
| 3217 | 3140 | sprite_ptr->code, |
| 3218 | sprite_ptr->color & (~sprite_extra_planes), | |
| 3141 | sprite_ptr->color & (~state->sprite_extra_planes), | |
| 3219 | 3142 | sprite_ptr->flipx,sprite_ptr->flipy, |
| 3220 | 3143 | sprite_ptr->x,sprite_ptr->y, |
| 3221 | 3144 | pri); |
| r10886 | r10887 | |
| 3223 | 3146 | f3_drawgfxzoom( |
| 3224 | 3147 | bitmap,cliprect,sprite_gfx, |
| 3225 | 3148 | sprite_ptr->code, |
| 3226 | sprite_ptr->color & (~sprite_extra_planes), | |
| 3149 | sprite_ptr->color & (~state->sprite_extra_planes), | |
| 3227 | 3150 | sprite_ptr->flipx,sprite_ptr->flipy, |
| 3228 | 3151 | sprite_ptr->x,sprite_ptr->y, |
| 3229 | 3152 | sprite_ptr->zoomx,sprite_ptr->zoomy, |
| r10886 | r10887 | |
| 3238 | 3161 | taito_f3_state *state = screen->machine->driver_data<taito_f3_state>(); |
| 3239 | 3162 | UINT32 sy_fix[5],sx_fix[5]; |
| 3240 | 3163 | |
| 3241 | f3_skip_this_frame=0; | |
| 3242 | tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 3164 | state->f3_skip_this_frame=0; | |
| 3165 | tilemap_set_flip_all(screen->machine,state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 3243 | 3166 | |
| 3244 | 3167 | /* Setup scroll */ |
| 3245 | sy_fix[0]=((f3_control_0[2]&0xffff0000)>> 7) + (1<<16); | |
| 3246 | sy_fix[1]=((f3_control_0[2]&0x0000ffff)<< 9) + (1<<16); | |
| 3247 | sy_fix[2]=((f3_control_0[3]&0xffff0000)>> 7) + (1<<16); | |
| 3248 | sy_fix[3]=((f3_control_0[3]&0x0000ffff)<< 9) + (1<<16); | |
| 3249 | sx_fix[0]=((f3_control_0[0]&0xffc00000)>> 6) - (6<<16); | |
| 3250 | sx_fix[1]=((f3_control_0[0]&0x0000ffc0)<<10) - (10<<16); | |
| 3251 | sx_fix[2]=((f3_control_0[1]&0xffc00000)>> 6) - (14<<16); | |
| 3252 | sx_fix[3]=((f3_control_0[1]&0x0000ffc0)<<10) - (18<<16); | |
| 3253 | sx_fix[4]=-(f3_control_1[2]>>16)+41; | |
| 3254 | sy_fix[4]=-(f3_control_1[2]&0x1ff); | |
| 3168 | sy_fix[0]=((state->f3_control_0[2]&0xffff0000)>> 7) + (1<<16); | |
| 3169 | sy_fix[1]=((state->f3_control_0[2]&0x0000ffff)<< 9) + (1<<16); | |
| 3170 | sy_fix[2]=((state->f3_control_0[3]&0xffff0000)>> 7) + (1<<16); | |
| 3171 | sy_fix[3]=((state->f3_control_0[3]&0x0000ffff)<< 9) + (1<<16); | |
| 3172 | sx_fix[0]=((state->f3_control_0[0]&0xffc00000)>> 6) - (6<<16); | |
| 3173 | sx_fix[1]=((state->f3_control_0[0]&0x0000ffc0)<<10) - (10<<16); | |
| 3174 | sx_fix[2]=((state->f3_control_0[1]&0xffc00000)>> 6) - (14<<16); | |
| 3175 | sx_fix[3]=((state->f3_control_0[1]&0x0000ffc0)<<10) - (18<<16); | |
| 3176 | sx_fix[4]=-(state->f3_control_1[2]>>16)+41; | |
| 3177 | sy_fix[4]=-(state->f3_control_1[2]&0x1ff); | |
| 3255 | 3178 | |
| 3256 | sx_fix[0]-=((f3_control_0[0]&0x003f0000)>> 6)+0x0400-0x10000; | |
| 3257 | sx_fix[1]-=((f3_control_0[0]&0x0000003f)<<10)+0x0400-0x10000; | |
| 3258 | sx_fix[2]-=((f3_control_0[1]&0x003f0000)>> 6)+0x0400-0x10000; | |
| 3259 | sx_fix[3]-=((f3_control_0[1]&0x0000003f)<<10)+0x0400-0x10000; | |
| 3179 | sx_fix[0]-=((state->f3_control_0[0]&0x003f0000)>> 6)+0x0400-0x10000; | |
| 3180 | sx_fix[1]-=((state->f3_control_0[0]&0x0000003f)<<10)+0x0400-0x10000; | |
| 3181 | sx_fix[2]-=((state->f3_control_0[1]&0x003f0000)>> 6)+0x0400-0x10000; | |
| 3182 | sx_fix[3]-=((state->f3_control_0[1]&0x0000003f)<<10)+0x0400-0x10000; | |
| 3260 | 3183 | |
| 3261 | if (flipscreen) | |
| 3184 | if (state->flipscreen) | |
| 3262 | 3185 | { |
| 3263 | 3186 | sy_fix[0]= 0x3000000-sy_fix[0]; |
| 3264 | 3187 | sy_fix[1]= 0x3000000-sy_fix[1]; |
| r10886 | r10887 | |
| 3272 | 3195 | sy_fix[4]=-sy_fix[4]; |
| 3273 | 3196 | } |
| 3274 | 3197 | |
| 3275 | bitmap_fill(pri_alp_bitmap,cliprect,0); | |
| 3198 | bitmap_fill(state->pri_alp_bitmap,cliprect,0); | |
| 3276 | 3199 | |
| 3277 | 3200 | /* sprites */ |
| 3278 | if (sprite_lag==0) | |
| 3201 | if (state->sprite_lag==0) | |
| 3279 | 3202 | get_sprite_info(screen->machine, state->spriteram); |
| 3280 | 3203 | |
| 3281 | 3204 | /* Update sprite buffer */ |
| 3282 | 3205 | draw_sprites(screen->machine, bitmap,cliprect); |
| 3283 | 3206 | |
| 3284 | 3207 | /* Parse sprite, alpha & clipping parts of lineram */ |
| 3285 | get_spritealphaclip_info(); | |
| 3208 | get_spritealphaclip_info(state); | |
| 3286 | 3209 | |
| 3287 | 3210 | /* Parse playfield effects */ |
| 3288 | get_line_ram_info(screen->machine, pf1_tilemap,sx_fix[0],sy_fix[0],0,f3_pf_data_1); | |
| 3289 | get_line_ram_info(screen->machine, pf2_tilemap,sx_fix[1],sy_fix[1],1,f3_pf_data_2); | |
| 3290 | get_line_ram_info(screen->machine, pf3_tilemap,sx_fix[2],sy_fix[2],2,f3_pf_data_3); | |
| 3291 | get_line_ram_info(screen->machine, pf4_tilemap,sx_fix[3],sy_fix[3],3,f3_pf_data_4); | |
| 3292 | get_vram_info(vram_layer,pixel_layer,sx_fix[4],sy_fix[4]); | |
| 3211 | get_line_ram_info(screen->machine, state->pf1_tilemap,sx_fix[0],sy_fix[0],0,state->f3_pf_data_1); | |
| 3212 | get_line_ram_info(screen->machine, state->pf2_tilemap,sx_fix[1],sy_fix[1],1,state->f3_pf_data_2); | |
| 3213 | get_line_ram_info(screen->machine, state->pf3_tilemap,sx_fix[2],sy_fix[2],2,state->f3_pf_data_3); | |
| 3214 | get_line_ram_info(screen->machine, state->pf4_tilemap,sx_fix[3],sy_fix[3],3,state->f3_pf_data_4); | |
| 3215 | get_vram_info(screen->machine, state->vram_layer,state->pixel_layer,sx_fix[4],sy_fix[4]); | |
| 3293 | 3216 | |
| 3294 | 3217 | /* Draw final framebuffer */ |
| 3295 | 3218 | scanline_draw(screen->machine, bitmap,cliprect); |
| r10886 | r10887 | |
|---|---|---|
| 194 | 194 | #include "emu.h" |
| 195 | 195 | #include "includes/megasys1.h" |
| 196 | 196 | |
| 197 | /* Variables defined here, that have to be shared: */ | |
| 198 | UINT16 *megasys1_scrollram[3]; | |
| 199 | UINT16 *megasys1_objectram, *megasys1_vregs, *megasys1_ram; | |
| 200 | ||
| 201 | static int megasys1_scrollx[3], megasys1_scrolly[3]; | |
| 202 | static int megasys1_active_layers; | |
| 203 | static int megasys1_bits_per_color_code; | |
| 204 | ||
| 205 | static int megasys1_scroll_flag[3]; | |
| 206 | static int megasys1_sprite_bank; | |
| 207 | static int megasys1_screen_flag, megasys1_sprite_flag; | |
| 208 | static int megasys1_8x8_scroll_factor[3], megasys1_16x16_scroll_factor[3]; | |
| 209 | ||
| 210 | static tilemap_t *megasys1_tmap[3]; | |
| 211 | static tilemap_t *megasys1_tilemap[3][2][4]; | |
| 212 | ||
| 213 | /* Variables defined in driver: */ | |
| 214 | static int hardware_type_z; | |
| 215 | ||
| 216 | 197 | static void create_tilemaps(running_machine *machine); |
| 217 | 198 | |
| 218 | static UINT16 *megasys1_buffer_objectram,*megasys1_buffer2_objectram,*megasys1_buffer_spriteram16,*megasys1_buffer2_spriteram16; | |
| 219 | 199 | |
| 220 | ||
| 221 | ||
| 222 | 200 | #ifdef MAME_DEBUG |
| 223 | 201 | |
| 224 | 202 | #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ |
| r10886 | r10887 | |
| 247 | 225 | megasys1_state *state = machine->driver_data<megasys1_state>(); |
| 248 | 226 | int i; |
| 249 | 227 | |
| 250 | state->spriteram = & | |
| 228 | state->spriteram = & | |
| 251 | 229 | |
| 252 | megasys1_buffer_objectram = auto_alloc_array(machine, UINT16, 0x2000); | |
| 253 | megasys1_buffer_spriteram16 = auto_alloc_array(machine, UINT16, 0x2000); | |
| 254 | megasys1_buffer2_objectram = auto_alloc_array(machine, UINT16, 0x2000); | |
| 255 | megasys1_buffer2_spriteram16 = auto_alloc_array(machine, UINT16, 0x2000); | |
| 230 | state->buffer_objectram = auto_alloc_array(machine, UINT16, 0x2000); | |
| 231 | state->buffer_spriteram16 = auto_alloc_array(machine, UINT16, 0x2000); | |
| 232 | state->buffer2_objectram = auto_alloc_array(machine, UINT16, 0x2000); | |
| 233 | state->buffer2_spriteram16 = auto_alloc_array(machine, UINT16, 0x2000); | |
| 256 | 234 | |
| 257 | 235 | create_tilemaps(machine); |
| 258 | megasys1_tmap[0] = megasys1_tilemap[0][0][0]; | |
| 259 | megasys1_tmap[1] = megasys1_tilemap[1][0][0]; | |
| 260 | megasys1_tmap[2] = megasys1_tilemap[2][0][0]; | |
| 236 | state->tmap[0] = state->tilemap[0][0][0]; | |
| 237 | state->tmap[1] = state->tilemap[1][0][0]; | |
| 238 | state->tmap[2] = state->tilemap[2][0][0]; | |
| 261 | 239 | |
| 262 | | |
| 240 | | |
| 263 | 241 | |
| 264 | 242 | for (i = 0; i < 3; i ++) |
| 265 | 243 | { |
| 266 | | |
| 244 | st | |
| 267 | 245 | } |
| 268 | 246 | |
| 269 | | |
| 247 | | |
| 270 | 248 | |
| 271 | 249 | /* |
| 272 | 250 | The tile code of a specific layer is multiplied for a constant |
| r10886 | r10887 | |
| 285 | 263 | for each layer and hardwired to 1x or 4x for both tile sizes |
| 286 | 264 | */ |
| 287 | 265 | |
| 288 | megasys1_8x8_scroll_factor[0] = 1; megasys1_16x16_scroll_factor[0] = 4; | |
| 289 | megasys1_8x8_scroll_factor[1] = 1; megasys1_16x16_scroll_factor[1] = 4; | |
| 290 | megasys1_8x8_scroll_factor[2] = 1; megasys1_16x16_scroll_factor[2] = 4; | |
| 266 | state->_8x8_scroll_factor[0] = 1; state->_16x16_scroll_factor[0] = 4; | |
| 267 | state->_8x8_scroll_factor[1] = 1; state->_16x16_scroll_factor[1] = 4; | |
| 268 | state->_8x8_scroll_factor[2] = 1; state->_16x16_scroll_factor[2] = 4; | |
| 291 | 269 | |
| 292 | 270 | if (strcmp(machine->gamedrv->name, "soldamj") == 0) |
| 293 | 271 | { |
| 294 | | |
| 272 | | |
| 295 | 273 | } |
| 296 | 274 | |
| 297 | hardware_type_z = 0; | |
| 275 | state->hardware_type_z = 0; | |
| 298 | 276 | if (strcmp(machine->gamedrv->name, "lomakai") == 0 || |
| 299 | 277 | strcmp(machine->gamedrv->name, "makaiden") == 0) |
| 300 | hardware_type_z = 1; | |
| 278 | state->hardware_type_z = 1; | |
| 301 | 279 | } |
| 302 | 280 | |
| 303 | 281 | /*************************************************************************** |
| r10886 | r10887 | |
| 313 | 291 | #define TILES_PER_PAGE_Y (0x20) |
| 314 | 292 | #define TILES_PER_PAGE (TILES_PER_PAGE_X * TILES_PER_PAGE_Y) |
| 315 | 293 | |
| 316 | INLINE void scrollram_w( | |
| 294 | INLINE void scrollram_w(address_space *space, offs_t offset, UINT16 data, UINT16 mem_mask, int which) | |
| 317 | 295 | { |
| 318 | COMBINE_DATA(&megasys1_scrollram[which][offset]); | |
| 319 | if (offset < 0x40000/2 && megasys1_tmap[which]) | |
| 296 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 297 | COMBINE_DATA(&state->scrollram[which][offset]); | |
| 298 | if (offset < 0x40000/2 && state->tmap[which]) | |
| 320 | 299 | { |
| 321 | if ( | |
| 300 | if ( | |
| 322 | 301 | { |
| 323 | tilemap_mark_tile_dirty( | |
| 302 | tilemap_mark_tile_dirty( | |
| 324 | 303 | } |
| 325 | 304 | else |
| 326 | 305 | { |
| 327 | tilemap_mark_tile_dirty(megasys1_tmap[which], offset*4 + 0); | |
| 328 | tilemap_mark_tile_dirty(megasys1_tmap[which], offset*4 + 1); | |
| 329 | tilemap_mark_tile_dirty(megasys1_tmap[which], offset*4 + 2); | |
| 330 | tilemap_mark_tile_dirty(megasys1_tmap[which], offset*4 + 3); | |
| 306 | tilemap_mark_tile_dirty(state->tmap[which], offset*4 + 0); | |
| 307 | tilemap_mark_tile_dirty(state->tmap[which], offset*4 + 1); | |
| 308 | tilemap_mark_tile_dirty(state->tmap[which], offset*4 + 2); | |
| 309 | tilemap_mark_tile_dirty(state->tmap[which], offset*4 + 3); | |
| 331 | 310 | } |
| 332 | 311 | } |
| 333 | 312 | } |
| 334 | 313 | |
| 335 | WRITE16_HANDLER( megasys1_scrollram_0_w ) { scrollram_w(0, offset, data, mem_mask); } | |
| 336 | WRITE16_HANDLER( megasys1_scrollram_1_w ) { scrollram_w(1, offset, data, mem_mask); } | |
| 337 | WRITE16_HANDLER( megasys1_scrollram_2_w ) { scrollram_w(2, offset, data, mem_mask); } | |
| 314 | WRITE16_HANDLER( megasys1_scrollram_0_w ) { scrollram_w(space, offset, data, mem_mask, 0); } | |
| 315 | WRITE16_HANDLER( megasys1_scrollram_1_w ) { scrollram_w(space, offset, data, mem_mask, 1); } | |
| 316 | WRITE16_HANDLER( megasys1_scrollram_2_w ) { scrollram_w(space, offset, data, mem_mask, 2); } | |
| 338 | 317 | |
| 339 | 318 | |
| 340 | 319 | |
| r10886 | r10887 | |
| 372 | 351 | |
| 373 | 352 | static TILE_GET_INFO( megasys1_get_scroll_tile_info_8x8 ) |
| 374 | 353 | { |
| 354 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 375 | 355 | int tmap = (FPTR)param; |
| 376 | UINT16 code = megasys1_scrollram[tmap][tile_index]; | |
| 377 | SET_TILE_INFO(tmap, (code & 0xfff) * megasys1_8x8_scroll_factor[tmap], code >> (16 - megasys1_bits_per_color_code), 0); | |
| 356 | UINT16 code = state->scrollram[tmap][tile_index]; | |
| 357 | SET_TILE_INFO(tmap, (code & 0xfff) * state->_8x8_scroll_factor[tmap], code >> (16 - state->bits_per_color_code), 0); | |
| 378 | 358 | } |
| 379 | 359 | |
| 380 | 360 | static TILE_GET_INFO( megasys1_get_scroll_tile_info_16x16 ) |
| 381 | 361 | { |
| 362 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 382 | 363 | int tmap = (FPTR)param; |
| 383 | UINT16 code = megasys1_scrollram[tmap][tile_index/4]; | |
| 384 | SET_TILE_INFO(tmap, (code & 0xfff) * megasys1_16x16_scroll_factor[tmap] + (tile_index & 3), code >> (16 - megasys1_bits_per_color_code), 0); | |
| 364 | UINT16 code = state->scrollram[tmap][tile_index/4]; | |
| 365 | SET_TILE_INFO(tmap, (code & 0xfff) * state->_16x16_scroll_factor[tmap] + (tile_index & 3), code >> (16 - state->bits_per_color_code), 0); | |
| 385 | 366 | } |
| 386 | 367 | |
| 387 | 368 | static void create_tilemaps(running_machine *machine) |
| 388 | 369 | { |
| 370 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 389 | 371 | int layer, i; |
| 390 | 372 | |
| 391 | 373 | for (layer = 0; layer < 3; layer++) |
| 392 | 374 | { |
| 393 | 375 | /* 16x16 tilemaps */ |
| 394 | | |
| 376 | | |
| 395 | 377 | 8,8, TILES_PER_PAGE_X * 16, TILES_PER_PAGE_Y * 2); |
| 396 | | |
| 378 | | |
| 397 | 379 | 8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 4); |
| 398 | | |
| 380 | | |
| 399 | 381 | 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 8); |
| 400 | | |
| 382 | | |
| 401 | 383 | 8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 16); |
| 402 | 384 | |
| 403 | 385 | /* 8x8 tilemaps */ |
| 404 | | |
| 386 | | |
| 405 | 387 | 8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 1); |
| 406 | | |
| 388 | | |
| 407 | 389 | 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2); |
| 408 | | |
| 390 | | |
| 409 | 391 | 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2); |
| 410 | | |
| 392 | | |
| 411 | 393 | 8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 4); |
| 412 | 394 | |
| 413 | 395 | /* set user data and transparency */ |
| 414 | 396 | for (i = 0; i < 8; i++) |
| 415 | 397 | { |
| 416 | tilemap_set_user_data(megasys1_tilemap[layer][i/4][i%4], (void *)(FPTR)layer); | |
| 417 | tilemap_set_transparent_pen(megasys1_tilemap[layer][i/4][i%4], 15); | |
| 398 | tilemap_set_user_data(state->tilemap[layer][i/4][i%4], (void *)(FPTR)layer); | |
| 399 | tilemap_set_transparent_pen(state->tilemap[layer][i/4][i%4], 15); | |
| 418 | 400 | } |
| 419 | 401 | } |
| 420 | 402 | } |
| 421 | 403 | |
| 422 | static void megasys1_set_vreg_flag(int which, int data) | |
| 404 | static void megasys1_set_vreg_flag(megasys1_state *state, int which, int data) | |
| 423 | 405 | { |
| 424 | if ( | |
| 406 | if ( | |
| 425 | 407 | { |
| 426 | megasys1_scroll_flag[which] = data; | |
| 427 | megasys1_tmap[which] = megasys1_tilemap[which][(data >> 4) & 1][data & 3]; | |
| 428 | tilemap_mark_all_tiles_dirty(megasys1_tmap[which]); | |
| 408 | state->scroll_flag[which] = data; | |
| 409 | state->tmap[which] = state->tilemap[which][(data >> 4) & 1][data & 3]; | |
| 410 | tilemap_mark_all_tiles_dirty(state->tmap[which]); | |
| 429 | 411 | } |
| 430 | 412 | } |
| 431 | 413 | |
| r10886 | r10887 | |
| 434 | 416 | /* Used by MS1-A/Z, B */ |
| 435 | 417 | WRITE16_HANDLER( megasys1_vregs_A_w ) |
| 436 | 418 | { |
| 437 | UINT16 new_data = COMBINE_DATA(&megasys1_vregs[offset]); | |
| 419 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 420 | UINT16 new_data = COMBINE_DATA(&state->vregs[offset]); | |
| 438 | 421 | |
| 439 | 422 | switch (offset) |
| 440 | 423 | { |
| 441 | case 0x000/2 : | |
| 424 | case 0x000/2 : | |
| 442 | 425 | |
| 443 | case 0x008/2+0 : megasys1_scrollx[2] = new_data; break; | |
| 444 | case 0x008/2+1 : megasys1_scrolly[2] = new_data; break; | |
| 445 | case 0x008/2+2 : megasys1_set_vreg_flag(2, new_data); break; | |
| 426 | case 0x008/2+0 : state->scrollx[2] = new_data; break; | |
| 427 | case 0x008/2+1 : state->scrolly[2] = new_data; break; | |
| 428 | case 0x008/2+2 : megasys1_set_vreg_flag(state, 2, new_data); break; | |
| 446 | 429 | |
| 447 | case 0x200/2+0 : megasys1_scrollx[0] = new_data; break; | |
| 448 | case 0x200/2+1 : megasys1_scrolly[0] = new_data; break; | |
| 449 | case 0x200/2+2 : megasys1_set_vreg_flag(0, new_data); break; | |
| 430 | case 0x200/2+0 : state->scrollx[0] = new_data; break; | |
| 431 | case 0x200/2+1 : state->scrolly[0] = new_data; break; | |
| 432 | case 0x200/2+2 : megasys1_set_vreg_flag(state, 0, new_data); break; | |
| 450 | 433 | |
| 451 | case 0x208/2+0 : megasys1_scrollx[1] = new_data; break; | |
| 452 | case 0x208/2+1 : megasys1_scrolly[1] = new_data; break; | |
| 453 | case 0x208/2+2 : megasys1_set_vreg_flag(1, new_data); break; | |
| 434 | case 0x208/2+0 : state->scrollx[1] = new_data; break; | |
| 435 | case 0x208/2+1 : state->scrolly[1] = new_data; break; | |
| 436 | case 0x208/2+2 : megasys1_set_vreg_flag(state, 1, new_data); break; | |
| 454 | 437 | |
| 455 | case 0x100/2 : | |
| 438 | case 0x100/2 : | |
| 456 | 439 | |
| 457 | case 0x300/2 : | |
| 440 | case 0x300/2 : | |
| 458 | 441 | if (space->machine->device("soundcpu")) |
| 459 | 442 | { |
| 460 | 443 | if (new_data & 0x10) |
| r10886 | r10887 | |
| 479 | 462 | /* Used by MS1-C only */ |
| 480 | 463 | READ16_HANDLER( megasys1_vregs_C_r ) |
| 481 | 464 | { |
| 465 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 482 | 466 | switch (offset) |
| 483 | 467 | { |
| 484 | 468 | case 0x8000/2: return soundlatch2_word_r(space,0,0xffff); |
| 485 | default: return | |
| 469 | default: return | |
| 486 | 470 | } |
| 487 | 471 | } |
| 488 | 472 | |
| 489 | 473 | WRITE16_HANDLER( megasys1_vregs_C_w ) |
| 490 | 474 | { |
| 491 | UINT16 new_data = COMBINE_DATA(&megasys1_vregs[offset]); | |
| 475 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 476 | UINT16 new_data = COMBINE_DATA(&state->vregs[offset]); | |
| 492 | 477 | |
| 493 | 478 | switch (offset) |
| 494 | 479 | { |
| 495 | case 0x2000/2+0 : megasys1_scrollx[0] = new_data; break; | |
| 496 | case 0x2000/2+1 : megasys1_scrolly[0] = new_data; break; | |
| 497 | case 0x2000/2+2 : megasys1_set_vreg_flag(0, new_data); break; | |
| 480 | case 0x2000/2+0 : state->scrollx[0] = new_data; break; | |
| 481 | case 0x2000/2+1 : state->scrolly[0] = new_data; break; | |
| 482 | case 0x2000/2+2 : megasys1_set_vreg_flag(state, 0, new_data); break; | |
| 498 | 483 | |
| 499 | case 0x2008/2+0 : megasys1_scrollx[1] = new_data; break; | |
| 500 | case 0x2008/2+1 : megasys1_scrolly[1] = new_data; break; | |
| 501 | case 0x2008/2+2 : megasys1_set_vreg_flag(1, new_data); break; | |
| 484 | case 0x2008/2+0 : state->scrollx[1] = new_data; break; | |
| 485 | case 0x2008/2+1 : state->scrolly[1] = new_data; break; | |
| 486 | case 0x2008/2+2 : megasys1_set_vreg_flag(state, 1, new_data); break; | |
| 502 | 487 | |
| 503 | case 0x2100/2+0 : megasys1_scrollx[2] = new_data; break; | |
| 504 | case 0x2100/2+1 : megasys1_scrolly[2] = new_data; break; | |
| 505 | case 0x2100/2+2 : megasys1_set_vreg_flag(2, new_data); break; | |
| 488 | case 0x2100/2+0 : state->scrollx[2] = new_data; break; | |
| 489 | case 0x2100/2+1 : state->scrolly[2] = new_data; break; | |
| 490 | case 0x2100/2+2 : megasys1_set_vreg_flag(state, 2, new_data); break; | |
| 506 | 491 | |
| 507 | case 0x2108/2 : megasys1_sprite_bank = new_data; break; | |
| 508 | case 0x2200/2 : megasys1_sprite_flag = new_data; break; | |
| 509 | case 0x2208/2 : megasys1_active_layers = new_data; break; | |
| 492 | case 0x2108/2 : state->sprite_bank = new_data; break; | |
| 493 | case 0x2200/2 : state->sprite_flag = new_data; break; | |
| 494 | case 0x2208/2 : state->active_layers = new_data; break; | |
| 510 | 495 | |
| 511 | case 0x2308/2 : | |
| 496 | case 0x2308/2 : | |
| 512 | 497 | if (new_data & 0x10) |
| 513 | 498 | cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_RESET, ASSERT_LINE); |
| 514 | 499 | else |
| r10886 | r10887 | |
| 529 | 514 | /* Used by MS1-D only */ |
| 530 | 515 | WRITE16_HANDLER( megasys1_vregs_D_w ) |
| 531 | 516 | { |
| 532 | UINT16 new_data = COMBINE_DATA(&megasys1_vregs[offset]); | |
| 517 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 518 | UINT16 new_data = COMBINE_DATA(&state->vregs[offset]); | |
| 533 | 519 | |
| 534 | 520 | switch (offset) |
| 535 | 521 | { |
| 536 | case 0x2000/2+0 : megasys1_scrollx[0] = new_data; break; | |
| 537 | case 0x2000/2+1 : megasys1_scrolly[0] = new_data; break; | |
| 538 | case 0x2000/2+2 : megasys1_set_vreg_flag(0, new_data); break; | |
| 522 | case 0x2000/2+0 : state->scrollx[0] = new_data; break; | |
| 523 | case 0x2000/2+1 : state->scrolly[0] = new_data; break; | |
| 524 | case 0x2000/2+2 : megasys1_set_vreg_flag(state, 0, new_data); break; | |
| 539 | 525 | |
| 540 | case 0x2008/2+0 : megasys1_scrollx[1] = new_data; break; | |
| 541 | case 0x2008/2+1 : megasys1_scrolly[1] = new_data; break; | |
| 542 | case 0x2008/2+2 : megasys1_set_vreg_flag(1, new_data); break; | |
| 526 | case 0x2008/2+0 : state->scrollx[1] = new_data; break; | |
| 527 | case 0x2008/2+1 : state->scrolly[1] = new_data; break; | |
| 528 | case 0x2008/2+2 : megasys1_set_vreg_flag(state, 1, new_data); break; | |
| 543 | 529 | |
| 544 | // case 0x2100/2+0 : megasys1_scrollx[2] = new_data; break; | |
| 545 | // case 0x2100/2+1 : megasys1_scrolly[2] = new_data; break; | |
| 546 | // case 0x2100/2+2 : megasys1_set_vreg_flag(2, new_data); break; | |
| 530 | // case 0x2100/2+0 : state->scrollx[2] = new_data; break; | |
| 531 | // case 0x2100/2+1 : state->scrolly[2] = new_data; break; | |
| 532 | // case 0x2100/2+2 : megasys1_set_vreg_flag(state, 2, new_data); break; | |
| 547 | 533 | |
| 548 | case 0x2108/2 : megasys1_sprite_bank = new_data; break; | |
| 549 | case 0x2200/2 : megasys1_sprite_flag = new_data; break; | |
| 550 | case 0x2208/2 : megasys1_active_layers = new_data; break; | |
| 551 | case 0x2308/2 : megasys1_screen_flag = new_data; break; | |
| 534 | case 0x2108/2 : state->sprite_bank = new_data; break; | |
| 535 | case 0x2200/2 : state->sprite_flag = new_data; break; | |
| 536 | case 0x2208/2 : state->active_layers = new_data; break; | |
| 537 | case 0x2308/2 : state->screen_flag = new_data; break; | |
| 552 | 538 | |
| 553 | 539 | default: SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data); |
| 554 | 540 | } |
| r10886 | r10887 | |
| 590 | 576 | |
| 591 | 577 | /* sprite order is from first in Sprite Data RAM (frontmost) to last */ |
| 592 | 578 | |
| 593 | if (hardware_type_z == 0) /* standard sprite hardware */ | |
| 579 | if (state->hardware_type_z == 0) /* standard sprite hardware */ | |
| 594 | 580 | { |
| 595 | color_mask = ( | |
| 581 | color_mask = ( | |
| 596 | 582 | |
| 597 | 583 | for (offs = (0x800-8)/2;offs >= 0;offs -= 8/2) |
| 598 | 584 | { |
| 599 | 585 | for (sprite = 0; sprite < 4 ; sprite ++) |
| 600 | 586 | { |
| 601 | UINT16 *objectdata = &megasys1_buffer2_objectram[offs + (0x800/2) * sprite]; | |
| 602 | UINT16 *spritedata = &megasys1_buffer2_spriteram16[ (objectdata[ 0 ] & 0x7f) * 0x10/2]; | |
| 587 | UINT16 *objectdata = &state->buffer2_objectram[offs + (0x800/2) * sprite]; | |
| 588 | UINT16 *spritedata = &state->buffer2_spriteram16[ (objectdata[ 0 ] & 0x7f) * 0x10/2]; | |
| 603 | 589 | |
| 604 | 590 | attr = spritedata[ 8/2 ]; |
| 605 | 591 | if (((attr & 0xc0)>>6) != sprite) continue; // flipping |
| r10886 | r10887 | |
| 614 | 600 | flipx = attr & 0x40; |
| 615 | 601 | flipy = attr & 0x80; |
| 616 | 602 | |
| 617 | if ( | |
| 603 | if ( | |
| 618 | 604 | { |
| 619 | 605 | flipx = !flipx; flipy = !flipy; |
| 620 | 606 | sx = 240-sx; sy = 240-sy; |
| r10886 | r10887 | |
| 626 | 612 | |
| 627 | 613 | pdrawgfx_transpen(bitmap,cliprect, |
| 628 | 614 | machine->gfx[3], |
| 629 | (code & 0xfff ) + (( | |
| 615 | (code & 0xfff ) + (( | |
| 630 | 616 | color, |
| 631 | 617 | flipx, flipy, |
| 632 | 618 | sx, sy, |
| r10886 | r10887 | |
| 659 | 645 | flipx = attr & 0x40; |
| 660 | 646 | flipy = attr & 0x80; |
| 661 | 647 | |
| 662 | if ( | |
| 648 | if ( | |
| 663 | 649 | { |
| 664 | 650 | flipx = !flipx; flipy = !flipy; |
| 665 | 651 | sx = 240-sx; sy = 240-sy; |
| r10886 | r10887 | |
| 691 | 677 | int priorities[16]; |
| 692 | 678 | }; |
| 693 | 679 | |
| 694 | static int megasys1_layers_order[16]; | |
| 695 | 680 | |
| 696 | 681 | /* |
| 697 | 682 | Layers order encoded as an int like: 0x01234, where |
| r10886 | r10887 | |
| 772 | 757 | |
| 773 | 758 | PALETTE_INIT( megasys1 ) |
| 774 | 759 | { |
| 760 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 775 | 761 | int pri_code, offset, i, order; |
| 776 | 762 | |
| 777 | 763 | /* First check if we have an hand-crafted priority scheme |
| r10886 | r10887 | |
| 786 | 772 | |
| 787 | 773 | if (priorities[i].driver) |
| 788 | 774 | { |
| 789 | memcpy ( | |
| 775 | memcpy ( | |
| 790 | 776 | |
| 791 | 777 | logerror("WARNING: using an hand-crafted priorities scheme\n"); |
| 792 | 778 | |
| r10886 | r10887 | |
| 914 | 900 | |
| 915 | 901 | } // merging |
| 916 | 902 | |
| 917 | | |
| 903 | | |
| 918 | 904 | |
| 919 | 905 | } // pri_code |
| 920 | 906 | |
| r10886 | r10887 | |
| 923 | 909 | #if 0 |
| 924 | 910 | /* log the priority schemes */ |
| 925 | 911 | for (i = 0; i < 16; i++) |
| 926 | logerror("PROM %X] %05x\n", i, | |
| 912 | logerror("PROM %X] %05x\n", i, | |
| 927 | 913 | #endif |
| 928 | 914 | |
| 929 | 915 | |
| r10886 | r10887 | |
| 940 | 926 | |
| 941 | 927 | SCREEN_UPDATE( megasys1 ) |
| 942 | 928 | { |
| 929 | megasys1_state *state = screen->machine->driver_data<megasys1_state>(); | |
| 943 | 930 | int i,flag,pri,primask; |
| 944 | 931 | int active_layers; |
| 945 | 932 | |
| 946 | if (hardware_type_z) | |
| 933 | if (state->hardware_type_z) | |
| 947 | 934 | { |
| 948 | 935 | /* no layer 2 and fixed layers order? */ |
| 949 | 936 | active_layers = 0x000b; |
| r10886 | r10887 | |
| 954 | 941 | int reallyactive = 0; |
| 955 | 942 | |
| 956 | 943 | /* get layers order */ |
| 957 | pri = | |
| 944 | pri = | |
| 958 | 945 | |
| 959 | 946 | #ifdef MAME_DEBUG |
| 960 | 947 | if (pri == 0xfffff) |
| 961 | 948 | { |
| 962 | popmessage("Pri: %04X - Flag: %04X", | |
| 949 | popmessage("Pri: %04X - Flag: %04X", | |
| 963 | 950 | } |
| 964 | 951 | #endif |
| 965 | 952 | |
| r10886 | r10887 | |
| 969 | 956 | for (i = 0;i < 5;i++) |
| 970 | 957 | reallyactive |= 1 << ((pri >> (4*i)) & 0x0f); |
| 971 | 958 | |
| 972 | active_layers = | |
| 959 | active_layers = | |
| 973 | 960 | active_layers |= 1 << ((pri & 0xf0000) >> 16); // bottom layer can't be disabled |
| 974 | 961 | } |
| 975 | 962 | |
| 976 | tilemap_set_flip_all( screen->machine, ( | |
| 963 | tilemap_set_flip_all( screen->machine, ( | |
| 977 | 964 | |
| 978 | 965 | for (i = 0;i < 3;i++) |
| 979 | 966 | { |
| 980 | if ( | |
| 967 | if ( | |
| 981 | 968 | { |
| 982 | tilemap_set_enable( | |
| 969 | tilemap_set_enable( | |
| 983 | 970 | |
| 984 | tilemap_set_scrollx(megasys1_tmap[i],0,megasys1_scrollx[i]); | |
| 985 | tilemap_set_scrolly(megasys1_tmap[i],0,megasys1_scrolly[i]); | |
| 971 | tilemap_set_scrollx(state->tmap[i],0,state->scrollx[i]); | |
| 972 | tilemap_set_scrolly(state->tmap[i],0,state->scrolly[i]); | |
| 986 | 973 | } |
| 987 | 974 | } |
| 988 | 975 | |
| r10886 | r10887 | |
| 1001 | 988 | case 0: |
| 1002 | 989 | case 1: |
| 1003 | 990 | case 2: |
| 1004 | if ( ( | |
| 991 | if ( ( | |
| 1005 | 992 | { |
| 1006 | tilemap_draw(bitmap,cliprect, | |
| 993 | tilemap_draw(bitmap,cliprect, | |
| 1007 | 994 | flag = 0; |
| 1008 | 995 | } |
| 1009 | 996 | break; |
| r10886 | r10887 | |
| 1015 | 1002 | bitmap_fill(bitmap,cliprect,0); |
| 1016 | 1003 | } |
| 1017 | 1004 | |
| 1018 | if ( | |
| 1005 | if ( | |
| 1019 | 1006 | { |
| 1020 | 1007 | /* following tilemaps will obscure this sprites layer */ |
| 1021 | 1008 | primask |= 1 << (layer-3); |
| r10886 | r10887 | |
| 1037 | 1024 | { |
| 1038 | 1025 | megasys1_state *state = machine->driver_data<megasys1_state>(); |
| 1039 | 1026 | /* Sprite are TWO frames ahead, like NMK16 HW. */ |
| 1040 | //megasys1_objectram | |
| 1041 | memcpy(megasys1_buffer2_objectram,megasys1_buffer_objectram, 0x2000); | |
| 1042 | memcpy(megasys1_buffer_objectram, megasys1_objectram, 0x2000); | |
| 1027 | //state->objectram | |
| 1028 | memcpy(state->buffer2_objectram,state->buffer_objectram, 0x2000); | |
| 1029 | memcpy(state->buffer_objectram, state->objectram, 0x2000); | |
| 1043 | 1030 | //spriteram16 |
| 1044 | memcpy(megasys1_buffer2_spriteram16, megasys1_buffer_spriteram16, 0x2000); | |
| 1045 | memcpy(megasys1_buffer_spriteram16, state->spriteram, 0x2000); | |
| 1031 | memcpy(state->buffer2_spriteram16, state->buffer_spriteram16, 0x2000); | |
| 1032 | memcpy(state->buffer_spriteram16, state->spriteram, 0x2000); | |
| 1046 | 1033 | |
| 1047 | 1034 | } |
| 1048 | 1035 |
| r10886 | r10887 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | WRITE8_HANDLER( bwing_spriteram_w ) |
| 59 | 59 | { |
| 60 | space->machine->generic.buffered_spriteram.u8[offset] = data; | |
| 60 | bwing_state *state = space->machine->driver_data<bwing_state>(); | |
| 61 | state->spriteram[offset] = data; | |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | WRITE8_HANDLER( bwing_videoram_w ) |
| r10886 | r10887 | |
| 318 | 319 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 319 | 320 | |
| 320 | 321 | // draw low priority sprites |
| 321 | draw_sprites(screen->machine, bitmap, cliprect, s | |
| 322 | draw_sprites(screen->machine, bitmap, cliprect, st | |
| 322 | 323 | |
| 323 | 324 | // draw foreground |
| 324 | 325 | if (!(state->mapmask & 2)) |
| r10886 | r10887 | |
| 332 | 333 | } |
| 333 | 334 | |
| 334 | 335 | // draw high priority sprites |
| 335 | draw_sprites(screen->machine, bitmap, cliprect, s | |
| 336 | draw_sprites(screen->machine, bitmap, cliprect, st | |
| 336 | 337 | |
| 337 | 338 | // draw text layer |
| 338 | 339 | // if (state->mapmask & 4) |
| r10886 | r10887 | |
|---|---|---|
| 1 | 1 | <?xml version="1.0"?> |
| 2 | 2 | <mamelayout version="2"> |
| 3 | <element name="overlay"> | |
| 3 | <element name="overlay_gremlin"> | |
| 4 | 4 | <rect> |
| 5 | 5 | <bounds left="0" top="0" right="256" bottom="224" /> |
| 6 | 6 | <color red="0.27" green="0.53" blue="0.8" /> |
| 7 | 7 | </rect> |
| 8 | 8 | </element> |
| 9 | 9 | |
| 10 | <view name="Color Overlay"> | |
| 10 | <!-- TODO: Taito (Japan) version needs a different overlay --> | |
| 11 | ||
| 12 | <view name="Color Overlay (Gremlin)"> | |
| 11 | 13 | <screen index="0"> |
| 12 | 14 | <bounds left="0" top="0" right="4" bottom="3" /> |
| 13 | 15 | </screen> |
| 14 | <overlay name="overlay" element="overlay"> | |
| 16 | <overlay name="overlay" element="overlay_gremlin"> | |
| 15 | 17 | <bounds left="0" top="0" right="4" bottom="3" /> |
| 16 | 18 | </overlay> |
| 17 | 19 | </view> |
| r10886 | r10887 | |
|---|---|---|
| 36 | 36 | : driver_device(machine, config) { } |
| 37 | 37 | |
| 38 | 38 | UINT8 *videoram; |
| 39 | UINT8 *attr_ram1; | |
| 40 | UINT8 *attr_ram2; | |
| 41 | UINT8 *attr_ram3; | |
| 42 | tilemap_t *bg_tilemap; | |
| 43 | UINT8 question_adr[4]; | |
| 39 | 44 | }; |
| 40 | 45 | |
| 41 | 46 | |
| 42 | ||
| 43 | static UINT8 *attr_ram1, *attr_ram2, *attr_ram3; | |
| 44 | static tilemap_t *bg_tilemap; | |
| 45 | ||
| 46 | static UINT8 question_adr[4]; | |
| 47 | ||
| 48 | 47 | static WRITE8_HANDLER( quizmstr_bg_w ) |
| 49 | 48 | { |
| 50 | 49 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); |
| r10886 | r10887 | |
| 52 | 51 | videoram[offset] = data; |
| 53 | 52 | |
| 54 | 53 | if(offset >= 0x0240) |
| 55 | tilemap_mark_tile_dirty(bg_tilemap,offset - 0x0240); | |
| 54 | tilemap_mark_tile_dirty(state->bg_tilemap,offset - 0x0240); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | |
| r10886 | r10887 | |
| 91 | 90 | |
| 92 | 91 | static WRITE8_HANDLER( quizmstr_attr1_w ) |
| 93 | 92 | { |
| 94 | attr_ram1[offset] = data; | |
| 93 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); | |
| 94 | state->attr_ram1[offset] = data; | |
| 95 | 95 | |
| 96 | 96 | if(offset >= 0x0240) |
| 97 | 97 | { |
| 98 | 98 | // the later games also use attr3 for something.. |
| 99 | UINT32 paldata = (attr_ram1[offset] & 0x7f) | ((attr_ram2[offset] & 0x7f) << 7); | |
| 100 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 99 | UINT32 paldata = (state->attr_ram1[offset] & 0x7f) | ((state->attr_ram2[offset] & 0x7f) << 7); | |
| 100 | tilemap_mark_tile_dirty(state->bg_tilemap, offset - 0x0240); | |
| 101 | 101 | |
| 102 | 102 | coinmstr_set_pal(space->machine, paldata, offset - 0x240); |
| 103 | 103 | |
| r10886 | r10887 | |
| 106 | 106 | |
| 107 | 107 | static WRITE8_HANDLER( quizmstr_attr2_w ) |
| 108 | 108 | { |
| 109 | attr_ram2[offset] = data; | |
| 109 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); | |
| 110 | state->attr_ram2[offset] = data; | |
| 110 | 111 | |
| 111 | 112 | if(offset >= 0x0240) |
| 112 | 113 | { |
| 113 | 114 | // the later games also use attr3 for something.. |
| 114 | UINT32 paldata = (attr_ram1[offset] & 0x7f) | ((attr_ram2[offset] & 0x7f) << 7); | |
| 115 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 115 | UINT32 paldata = (state->attr_ram1[offset] & 0x7f) | ((state->attr_ram2[offset] & 0x7f) << 7); | |
| 116 | tilemap_mark_tile_dirty(state->bg_tilemap, offset - 0x0240); | |
| 116 | 117 | |
| 117 | 118 | coinmstr_set_pal(space->machine, paldata, offset - 0x240); |
| 118 | 119 | |
| r10886 | r10887 | |
| 121 | 122 | |
| 122 | 123 | static WRITE8_HANDLER( quizmstr_attr3_w ) |
| 123 | 124 | { |
| 124 | attr_ram3[offset] = data; | |
| 125 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); | |
| 126 | state->attr_ram3[offset] = data; | |
| 125 | 127 | |
| 126 | 128 | if(offset >= 0x0240) |
| 127 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 129 | tilemap_mark_tile_dirty(state->bg_tilemap, offset - 0x0240); | |
| 128 | 130 | |
| 129 | 131 | } |
| 130 | 132 | |
| 131 | 133 | |
| 132 | 134 | static READ8_HANDLER( question_r ) |
| 133 | 135 | { |
| 136 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); | |
| 134 | 137 | int address; |
| 135 | 138 | UINT8 *questions = space->machine->region("user1")->base(); |
| 136 | 139 | |
| 137 | switch(question_adr[2]) | |
| 140 | switch(state->question_adr[2]) | |
| 138 | 141 | { |
| 139 | case 0x38: address = 0x00000; break; // question_adr[3] == 7 | |
| 140 | case 0x39: address = 0x08000; break; // question_adr[3] == 7 | |
| 141 | case 0x3a: address = 0x10000; break; // question_adr[3] == 7 | |
| 142 | case 0x3b: address = 0x18000; break; // question_adr[3] == 7 | |
| 143 | case 0x3c: address = 0x20000; break; // question_adr[3] == 7 | |
| 144 | case 0x3d: address = 0x28000; break; // question_adr[3] == 7 | |
| 145 | case 0x3e: address = 0x30000; break; // question_adr[3] == 7 | |
| 146 | case 0x07: address = 0x38000; break; // question_adr[3] == 7 | |
| 147 | case 0x0f: address = 0x40000; break; // question_adr[3] == 7 | |
| 148 | case 0x17: address = 0x48000; break; // question_adr[3] == 7 | |
| 149 | case 0x1f: address = 0x50000; break; // question_adr[3] == 7 | |
| 150 | case 0x27: address = 0x58000; break; // question_adr[3] == 7 | |
| 151 | case 0x2f: address = 0x60000; break; // question_adr[3] == 7 | |
| 152 | case 0x37: address = 0x68000; break; // question_adr[3] == 7 | |
| 153 | case 0x3f: address = 0x70000 + question_adr[3] * 0x8000; break; | |
| 142 | case 0x38: address = 0x00000; break; // state->question_adr[3] == 7 | |
| 143 | case 0x39: address = 0x08000; break; // state->question_adr[3] == 7 | |
| 144 | case 0x3a: address = 0x10000; break; // state->question_adr[3] == 7 | |
| 145 | case 0x3b: address = 0x18000; break; // state->question_adr[3] == 7 | |
| 146 | case 0x3c: address = 0x20000; break; // state->question_adr[3] == 7 | |
| 147 | case 0x3d: address = 0x28000; break; // state->question_adr[3] == 7 | |
| 148 | case 0x3e: address = 0x30000; break; // state->question_adr[3] == 7 | |
| 149 | case 0x07: address = 0x38000; break; // state->question_adr[3] == 7 | |
| 150 | case 0x0f: address = 0x40000; break; // state->question_adr[3] == 7 | |
| 151 | case 0x17: address = 0x48000; break; // state->question_adr[3] == 7 | |
| 152 | case 0x1f: address = 0x50000; break; // state->question_adr[3] == 7 | |
| 153 | case 0x27: address = 0x58000; break; // state->question_adr[3] == 7 | |
| 154 | case 0x2f: address = 0x60000; break; // state->question_adr[3] == 7 | |
| 155 | case 0x37: address = 0x68000; break; // state->question_adr[3] == 7 | |
| 156 | case 0x3f: address = 0x70000 + state->question_adr[3] * 0x8000; break; | |
| 154 | 157 | |
| 155 | 158 | default: |
| 156 | 159 | address = 0; |
| 157 | logerror("unknown question rom # = %02X\n",question_adr[2]); | |
| 160 | logerror("unknown question rom # = %02X\n",state->question_adr[2]); | |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | if(question_adr[3] == 6 || question_adr[3] > 7) | |
| 161 | logerror("question_adr[3] = %02X\n",question_adr[3]); | |
| 163 | if(state->question_adr[3] == 6 || state->question_adr[3] > 7) | |
| 164 | logerror("question_adr[3] = %02X\n",state->question_adr[3]); | |
| 162 | 165 | |
| 163 | 166 | /* |
| 164 | 167 | in these offsets they set 0x80... why? |
| 165 | 168 | |
| 166 | if( (question_adr[0] & 0x5f) == 0x00 || | |
| 167 | (question_adr[0] & 0x5f) == 0x01 || | |
| 168 | (question_adr[0] & 0x5f) == 0x0f || | |
| 169 | (question_adr[0] & 0x5f) == 0x56 ) | |
| 169 | if( (state->question_adr[0] & 0x5f) == 0x00 || | |
| 170 | (state->question_adr[0] & 0x5f) == 0x01 || | |
| 171 | (state->question_adr[0] & 0x5f) == 0x0f || | |
| 172 | (state->question_adr[0] & 0x5f) == 0x56 ) | |
| 170 | 173 | */ |
| 171 | 174 | |
| 172 | 175 | |
| 173 | 176 | // don't know... |
| 174 | // address |= ((question_adr[0] & 0x7f) << 8) | question_adr[1]; | |
| 175 | address |= (question_adr[1] << 7) | (question_adr[0] & 0x7f); | |
| 177 | // address |= ((state->question_adr[0] & 0x7f) << 8) | state->question_adr[1]; | |
| 178 | address |= (state->question_adr[1] << 7) | (state->question_adr[0] & 0x7f); | |
| 176 | 179 | |
| 177 | 180 | return questions[address]; |
| 178 | 181 | } |
| 179 | 182 | |
| 180 | 183 | static WRITE8_HANDLER( question_w ) |
| 181 | 184 | { |
| 182 | if(data != question_adr[offset]) | |
| 185 | coinmstr_state *state = space->machine->driver_data<coinmstr_state>(); | |
| 186 | if(data != state->question_adr[offset]) | |
| 183 | 187 | { |
| 184 | 188 | logerror("offset = %d data = %02X\n",offset,data); |
| 185 | 189 | } |
| 186 | 190 | |
| 187 | question_adr[offset] = data; | |
| 191 | state->question_adr[offset] = data; | |
| 188 | 192 | } |
| 189 | 193 | |
| 190 | 194 | static READ8_HANDLER( ff_r ) |
| r10886 | r10887 | |
| 198 | 202 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 199 | 203 | AM_RANGE(0xc000, 0xdfff) AM_RAM |
| 200 | 204 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(quizmstr_bg_w) AM_BASE_MEMBER(coinmstr_state, videoram) |
| 201 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(quizmstr_attr1_w) AM_BASE(&attr_ram1) | |
| 202 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(quizmstr_attr2_w) AM_BASE(&attr_ram2) | |
| 203 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(quizmstr_attr3_w) AM_BASE(&attr_ram3) | |
| 205 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(quizmstr_attr1_w) AM_BASE_MEMBER(coinmstr_state, attr_ram1) | |
| 206 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(quizmstr_attr2_w) AM_BASE_MEMBER(coinmstr_state, attr_ram2) | |
| 207 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(quizmstr_attr3_w) AM_BASE_MEMBER(coinmstr_state, attr_ram3) | |
| 204 | 208 | ADDRESS_MAP_END |
| 205 | 209 | |
| 206 | 210 | // Different I/O mappping for every game |
| r10886 | r10887 | |
| 896 | 900 | int tile = videoram[tile_index + 0x0240]; |
| 897 | 901 | int color = tile_index; |
| 898 | 902 | |
| 899 | tile |= (attr_ram1[tile_index + 0x0240] & 0x80) << 1; | |
| 900 | tile |= (attr_ram2[tile_index + 0x0240] & 0x80) << 2; | |
| 903 | tile |= (state->attr_ram1[tile_index + 0x0240] & 0x80) << 1; | |
| 904 | tile |= (state->attr_ram2[tile_index + 0x0240] & 0x80) << 2; | |
| 901 | 905 | |
| 902 | tile |= (attr_ram3[tile_index + 0x0240] & 0x03) << (6+4); | |
| 906 | tile |= (state->attr_ram3[tile_index + 0x0240] & 0x03) << (6+4); | |
| 903 | 907 | |
| 904 | 908 | SET_TILE_INFO(0, tile, color, 0); |
| 905 | 909 | } |
| 906 | 910 | |
| 907 | 911 | static VIDEO_START( coinmstr ) |
| 908 | 912 | { |
| 909 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 46, 32); | |
| 913 | coinmstr_state *state = machine->driver_data<coinmstr_state>(); | |
| 914 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 46, 32); | |
| 910 | 915 | } |
| 911 | 916 | |
| 912 | 917 | static SCREEN_UPDATE( coinmstr ) |
| 913 | 918 | { |
| 914 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 919 | coinmstr_state *state = screen->machine->driver_data<coinmstr_state>(); | |
| 920 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 915 | 921 | return 0; |
| 916 | 922 | } |
| 917 | 923 |
| r10886 | r10887 | |
|---|---|---|
| 165 | 165 | #include "cpu/m68000/m68000.h" |
| 166 | 166 | #include "sound/2413intf.h" |
| 167 | 167 | |
| 168 | static UINT16 *magicram; | |
| 169 | static UINT16 *pcab_vregs; | |
| 170 | 168 | |
| 169 | class magicard_state : public driver_device | |
| 170 | { | |
| 171 | public: | |
| 172 | magicard_state(running_machine &machine, const driver_device_config_base &config) | |
| 173 | : driver_device(machine, config) { } | |
| 171 | 174 | |
| 175 | UINT16 *magicram; | |
| 176 | UINT16 *pcab_vregs; | |
| 177 | UINT16 *scc68070_ext_irqc_regs; | |
| 178 | UINT16 *scc68070_iic_regs; | |
| 179 | UINT16 *scc68070_uart_regs; | |
| 180 | UINT16 *scc68070_timer_regs; | |
| 181 | UINT16 *scc68070_int_irqc_regs; | |
| 182 | UINT16 *scc68070_dma_ch1_regs; | |
| 183 | UINT16 *scc68070_dma_ch2_regs; | |
| 184 | UINT16 *scc68070_mmu_regs; | |
| 185 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 186 | }; | |
| 187 | ||
| 188 | ||
| 172 | 189 | /************************* |
| 173 | 190 | * Video Hardware * |
| 174 | 191 | *************************/ |
| r10886 | r10887 | |
| 200 | 217 | */ |
| 201 | 218 | |
| 202 | 219 | /*63 at post test,6d all the time.*/ |
| 203 | #define SCC_CSR_VREG (pcab_vregs[0x00/2] & 0xffff) | |
| 220 | #define SCC_CSR_VREG (state->pcab_vregs[0x00/2] & 0xffff) | |
| 204 | 221 | #define SCC_CG_VREG ((SCC_CSR_VREG & 0x10)>>4) |
| 205 | 222 | |
| 206 | 223 | /* |
| r10886 | r10887 | |
| 226 | 243 | w ........ ....aaaa VSR:H = video start address (MSB's) |
| 227 | 244 | */ |
| 228 | 245 | |
| 229 | #define SCC_DCR_VREG (pcab_vregs[0x02/2] & 0xffff) | |
| 246 | #define SCC_DCR_VREG (state->pcab_vregs[0x02/2] & 0xffff) | |
| 230 | 247 | #define SCC_DE_VREG ((SCC_DCR_VREG & 0x8000)>>15) |
| 231 | 248 | #define SCC_FG_VREG ((SCC_DCR_VREG & 0x0080)>>7) |
| 232 | 249 | #define SCC_VSR_VREG_H ((SCC_DCR_VREG & 0xf)>>0) |
| r10886 | r10887 | |
| 236 | 253 | w aaaaaaaa aaaaaaaa VSR:L = video start address (LSB's) |
| 237 | 254 | */ |
| 238 | 255 | |
| 239 | #define SCC_VSR_VREG_L (pcab_vregs[0x04/2] & 0xffff) | |
| 256 | #define SCC_VSR_VREG_L (state->pcab_vregs[0x04/2] & 0xffff) | |
| 240 | 257 | #define SCC_VSR_VREG ((SCC_VSR_VREG_H)<<16) | (SCC_VSR_VREG_L) |
| 241 | 258 | |
| 242 | 259 | /* |
| r10886 | r10887 | |
| 255 | 272 | w ........ xxxx.... not used |
| 256 | 273 | w ........ ....aaaa "data" (dunno the purpose...) |
| 257 | 274 | */ |
| 258 | #define SCC_DCR2_VREG (pcab_vregs[0x08/2] & 0xffff) | |
| 275 | #define SCC_DCR2_VREG (state->pcab_vregs[0x08/2] & 0xffff) | |
| 259 | 276 | |
| 260 | 277 | /* |
| 261 | 278 | (Note: not present on the original vreg listing) |
| r10886 | r10887 | |
| 276 | 293 | 1ffff0 a = source register a |
| 277 | 294 | w nnnnnnnn nnnnnnnn source |
| 278 | 295 | */ |
| 279 | #define SCC_SRCA_VREG (pcab_vregs[0x10/2] & 0xffff) | |
| 296 | #define SCC_SRCA_VREG (state->pcab_vregs[0x10/2] & 0xffff) | |
| 280 | 297 | |
| 281 | 298 | /* |
| 282 | 299 | 1ffff2 b = destination register b |
| 283 | 300 | rw nnnnnnnn nnnnnnnn destination |
| 284 | 301 | */ |
| 285 | 302 | |
| 286 | #define SCC_DSTB_VREG (pcab_vregs[0x12/2] & 0xffff) | |
| 303 | #define SCC_DSTB_VREG (state->pcab_vregs[0x12/2] & 0xffff) | |
| 287 | 304 | |
| 288 | 305 | /* |
| 289 | 306 | 1ffff4 pcr = pixac command register |
| r10886 | r10887 | |
| 330 | 347 | w ........ .......0 |
| 331 | 348 | */ |
| 332 | 349 | |
| 333 | #define SCC_PCR_VREG (pcab_vregs[0x14/2] & 0xffff) | |
| 350 | #define SCC_PCR_VREG (state->pcab_vregs[0x14/2] & 0xffff) | |
| 334 | 351 | |
| 335 | 352 | /* |
| 336 | 353 | 1ffff6 mask = mask register |
| r10886 | r10887 | |
| 363 | 380 | |
| 364 | 381 | static SCREEN_UPDATE(magicard) |
| 365 | 382 | { |
| 383 | magicard_state *state = screen->machine->driver_data<magicard_state>(); | |
| 366 | 384 | int x,y; |
| 367 | 385 | UINT32 count; |
| 368 | 386 | |
| r10886 | r10887 | |
| 381 | 399 | { |
| 382 | 400 | UINT32 color; |
| 383 | 401 | |
| 384 | color = ((magicram[count]) & 0x000f)>>0; | |
| 402 | color = ((state->magicram[count]) & 0x000f)>>0; | |
| 385 | 403 | |
| 386 | 404 | if(((x*4)+3)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 387 | 405 | *BITMAP_ADDR32(bitmap, y, (x*4)+3) = screen->machine->pens[color]; |
| 388 | 406 | |
| 389 | color = ((magicram[count]) & 0x00f0)>>4; | |
| 407 | color = ((state->magicram[count]) & 0x00f0)>>4; | |
| 390 | 408 | |
| 391 | 409 | if(((x*4)+2)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 392 | 410 | *BITMAP_ADDR32(bitmap, y, (x*4)+2) = screen->machine->pens[color]; |
| 393 | 411 | |
| 394 | color = ((magicram[count]) & 0x0f00)>>8; | |
| 412 | color = ((state->magicram[count]) & 0x0f00)>>8; | |
| 395 | 413 | |
| 396 | 414 | if(((x*4)+1)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 397 | 415 | *BITMAP_ADDR32(bitmap, y, (x*4)+1) = screen->machine->pens[color]; |
| 398 | 416 | |
| 399 | color = ((magicram[count]) & 0xf000)>>12; | |
| 417 | color = ((state->magicram[count]) & 0xf000)>>12; | |
| 400 | 418 | |
| 401 | 419 | if(((x*4)+0)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 402 | 420 | *BITMAP_ADDR32(bitmap, y, (x*4)+0) = screen->machine->pens[color]; |
| r10886 | r10887 | |
| 413 | 431 | { |
| 414 | 432 | UINT32 color; |
| 415 | 433 | |
| 416 | color = ((magicram[count]) & 0x00ff)>>0; | |
| 434 | color = ((state->magicram[count]) & 0x00ff)>>0; | |
| 417 | 435 | |
| 418 | 436 | if(((x*2)+1)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 419 | 437 | *BITMAP_ADDR32(bitmap, y, (x*2)+1) = screen->machine->pens[color]; |
| 420 | 438 | |
| 421 | color = ((magicram[count]) & 0xff00)>>8; | |
| 439 | color = ((state->magicram[count]) & 0xff00)>>8; | |
| 422 | 440 | |
| 423 | 441 | if(((x*2)+0)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 424 | 442 | *BITMAP_ADDR32(bitmap, y, (x*2)+0) = screen->machine->pens[color]; |
| r10886 | r10887 | |
| 443 | 461 | |
| 444 | 462 | static WRITE16_HANDLER( paletteram_io_w ) |
| 445 | 463 | { |
| 446 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 447 | ||
| 464 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 448 | 465 | switch(offset*2) |
| 449 | 466 | { |
| 450 | 467 | case 0: |
| 451 | pal_offs = data; | |
| 452 | internal_pal_offs = 0; | |
| 468 | state->pal.offs = data; | |
| 469 | state->pal.offs_internal = 0; | |
| 453 | 470 | break; |
| 454 | 471 | case 4: |
| 455 | 472 | break; |
| 456 | 473 | case 2: |
| 457 | switch( | |
| 474 | switch(s | |
| 458 | 475 | { |
| 459 | 476 | case 0: |
| 460 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 461 | internal_pal_offs++; | |
| 477 | state->pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 478 | state->pal.offs_internal++; | |
| 462 | 479 | break; |
| 463 | 480 | case 1: |
| 464 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 465 | internal_pal_offs++; | |
| 481 | state->pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 482 | state->pal.offs_internal++; | |
| 466 | 483 | break; |
| 467 | 484 | case 2: |
| 468 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 469 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 470 | internal_pal_offs = 0; | |
| 471 | pal_offs++; | |
| 485 | state->pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 486 | palette_set_color(space->machine, state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 487 | state->pal.offs_internal = 0; | |
| 488 | state->pal.offs++; | |
| 472 | 489 | break; |
| 473 | 490 | } |
| 474 | 491 | |
| r10886 | r10887 | |
| 478 | 495 | |
| 479 | 496 | static READ16_HANDLER( philips_66470_r ) |
| 480 | 497 | { |
| 498 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 481 | 499 | switch(offset) |
| 482 | 500 | { |
| 483 | 501 | // case 0/2: |
| r10886 | r10887 | |
| 487 | 505 | //printf("[%04x]\n",offset*2); |
| 488 | 506 | |
| 489 | 507 | |
| 490 | return pcab_vregs[offset]; | |
| 508 | return state->pcab_vregs[offset]; | |
| 491 | 509 | } |
| 492 | 510 | |
| 493 | 511 | static WRITE16_HANDLER( philips_66470_w ) |
| 494 | 512 | { |
| 495 | COMBINE_DATA(&pcab_vregs[offset]); | |
| 513 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 514 | COMBINE_DATA(&state->pcab_vregs[offset]); | |
| 496 | 515 | |
| 497 | 516 | // if(offset == 0x10/2) |
| 498 | 517 | // { |
| 499 | //printf("%04x %04x %04x\n",data,pcab_vregs[0x12/2],pcab_vregs[0x14/2]); | |
| 500 | //pcab_vregs[0x12/2] = pcab_vregs[0x10/2]; | |
| 518 | //printf("%04x %04x %04x\n",data,state->pcab_vregs[0x12/2],state->pcab_vregs[0x14/2]); | |
| 519 | //state->pcab_vregs[0x12/2] = state->pcab_vregs[0x10/2]; | |
| 501 | 520 | // } |
| 502 | 521 | } |
| 503 | 522 | |
| 504 | 523 | /* scc68070 specific stuff (to be moved) */ |
| 505 | static UINT16 *scc68070_ext_irqc_regs; | |
| 506 | static UINT16 *scc68070_iic_regs; | |
| 507 | static UINT16 *scc68070_uart_regs; | |
| 508 | static UINT16 *scc68070_timer_regs; | |
| 509 | static UINT16 *scc68070_int_irqc_regs; | |
| 510 | static UINT16 *scc68070_dma_ch1_regs; | |
| 511 | static UINT16 *scc68070_dma_ch2_regs; | |
| 512 | static UINT16 *scc68070_mmu_regs; | |
| 513 | 524 | |
| 514 | static READ16_HANDLER( scc68070_ext_irqc_r ) { return scc68070_ext_irqc_regs[offset]; } | |
| 515 | static WRITE16_HANDLER( scc68070_ext_irqc_w ){ scc68070_ext_irqc_regs[offset] = data; } | |
| 525 | static READ16_HANDLER( scc68070_ext_irqc_r ) | |
| 526 | { | |
| 527 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 528 | return state->scc68070_ext_irqc_regs[offset]; | |
| 529 | } | |
| 530 | ||
| 531 | static WRITE16_HANDLER( scc68070_ext_irqc_w ) | |
| 532 | { | |
| 533 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 534 | state->scc68070_ext_irqc_regs[offset] = data; | |
| 535 | } | |
| 536 | ||
| 516 | 537 | static READ16_HANDLER( scc68070_iic_r ) |
| 517 | 538 | { |
| 539 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 518 | 540 | //printf("%04x\n",offset*2); |
| 519 | 541 | |
| 520 | 542 | switch(offset) |
| 521 | 543 | { |
| 522 | case 0x04/2: return scc68070_iic_regs[offset] & 0xef; //iic status register, bit 4 = pending irq | |
| 544 | case 0x04/2: return state->scc68070_iic_regs[offset] & 0xef; //iic status register, bit 4 = pending irq | |
| 523 | 545 | } |
| 524 | 546 | |
| 525 | return scc68070_iic_regs[offset]; | |
| 547 | return state->scc68070_iic_regs[offset]; | |
| 526 | 548 | } |
| 527 | 549 | |
| 528 | static WRITE16_HANDLER( scc68070_iic_w ){ scc68070_iic_regs[offset] = data; } | |
| 550 | static WRITE16_HANDLER( scc68070_iic_w ) | |
| 551 | { | |
| 552 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 553 | state->scc68070_iic_regs[offset] = data; | |
| 554 | } | |
| 529 | 555 | |
| 530 | 556 | static READ16_HANDLER( scc68070_uart_r ) |
| 531 | 557 | { |
| 558 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 532 | 559 | //printf("%02x\n",offset*2); |
| 533 | 560 | |
| 534 | 561 | switch(offset) |
| r10886 | r10887 | |
| 536 | 563 | case 0x02/2: return space->machine->rand(); //uart mode register |
| 537 | 564 | } |
| 538 | 565 | |
| 539 | return scc68070_uart_regs[offset]; | |
| 566 | return state->scc68070_uart_regs[offset]; | |
| 540 | 567 | } |
| 541 | 568 | |
| 542 | static WRITE16_HANDLER( scc68070_uart_w ) { scc68070_uart_regs[offset] = data; } | |
| 569 | static WRITE16_HANDLER( scc68070_uart_w ) | |
| 570 | { | |
| 571 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 572 | state->scc68070_uart_regs[offset] = data; | |
| 573 | } | |
| 543 | 574 | |
| 544 | static READ16_HANDLER( scc68070_timer_r ) { return scc68070_timer_regs[offset]; } | |
| 545 | static WRITE16_HANDLER( scc68070_timer_w ){ scc68070_timer_regs[offset] = data; } | |
| 546 | static READ16_HANDLER( scc68070_int_irqc_r ) { return scc68070_int_irqc_regs[offset]; } | |
| 547 | static WRITE16_HANDLER( scc68070_int_irqc_w ){ scc68070_int_irqc_regs[offset] = data; } | |
| 548 | static READ16_HANDLER( scc68070_dma_ch1_r ) { return scc68070_dma_ch1_regs[offset]; } | |
| 549 | static WRITE16_HANDLER( scc68070_dma_ch1_w ){ scc68070_dma_ch1_regs[offset] = data; } | |
| 550 | static READ16_HANDLER( scc68070_dma_ch2_r ) { return scc68070_dma_ch2_regs[offset]; } | |
| 551 | static WRITE16_HANDLER( scc68070_dma_ch2_w ){ scc68070_dma_ch2_regs[offset] = data; } | |
| 552 | static READ16_HANDLER( scc68070_mmu_r ) { return scc68070_mmu_regs[offset]; } | |
| 575 | static READ16_HANDLER( scc68070_timer_r ) | |
| 576 | { | |
| 577 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 578 | return state->scc68070_timer_regs[offset]; | |
| 579 | } | |
| 580 | ||
| 581 | static WRITE16_HANDLER( scc68070_timer_w ) | |
| 582 | { | |
| 583 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 584 | state->scc68070_timer_regs[offset] = data; | |
| 585 | } | |
| 586 | ||
| 587 | static READ16_HANDLER( scc68070_int_irqc_r ) | |
| 588 | { | |
| 589 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 590 | return state->scc68070_int_irqc_regs[offset]; | |
| 591 | } | |
| 592 | ||
| 593 | static WRITE16_HANDLER( scc68070_int_irqc_w ) | |
| 594 | { | |
| 595 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 596 | state->scc68070_int_irqc_regs[offset] = data; | |
| 597 | } | |
| 598 | ||
| 599 | static READ16_HANDLER( scc68070_dma_ch1_r ) | |
| 600 | { | |
| 601 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 602 | return state->scc68070_dma_ch1_regs[offset]; | |
| 603 | } | |
| 604 | ||
| 605 | static WRITE16_HANDLER( scc68070_dma_ch1_w ) | |
| 606 | { | |
| 607 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 608 | state->scc68070_dma_ch1_regs[offset] = data; | |
| 609 | } | |
| 610 | ||
| 611 | static READ16_HANDLER( scc68070_dma_ch2_r ) | |
| 612 | { | |
| 613 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 614 | return state->scc68070_dma_ch2_regs[offset]; | |
| 615 | } | |
| 616 | ||
| 617 | static WRITE16_HANDLER( scc68070_dma_ch2_w ) | |
| 618 | { | |
| 619 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 620 | state->scc68070_dma_ch2_regs[offset] = data; | |
| 621 | } | |
| 622 | ||
| 623 | static READ16_HANDLER( scc68070_mmu_r ) | |
| 624 | { | |
| 625 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 626 | return state->scc68070_mmu_regs[offset]; | |
| 627 | } | |
| 628 | ||
| 553 | 629 | static WRITE16_HANDLER( scc68070_mmu_w ) |
| 554 | 630 | { |
| 555 | scc68070_mmu_regs[offset] = data; | |
| 631 | magicard_state *state = space->machine->driver_data<magicard_state>(); | |
| 632 | state->scc68070_mmu_regs[offset] = data; | |
| 556 | 633 | |
| 557 | 634 | switch(offset) |
| 558 | 635 | { |
| r10886 | r10887 | |
| 570 | 647 | |
| 571 | 648 | static ADDRESS_MAP_START( magicard_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 572 | 649 | // ADDRESS_MAP_GLOBAL_MASK(0x1fffff) |
| 573 | AM_RANGE(0x00000000, 0x0017ffff) AM_MIRROR(0x7fe00000) AM_RAM AM_BASE( | |
| 650 | AM_RANGE(0x00000000, 0x0017ffff) AM_MIRROR(0x7fe00000) AM_RAM AM_BASE_MEMBER(magicard_state, magicram) /*only 0-7ffff accessed in Magic Card*/ | |
| 574 | 651 | AM_RANGE(0x00180000, 0x001ffbff) AM_MIRROR(0x7fe00000) AM_RAM AM_REGION("maincpu", 0) |
| 575 | 652 | /* 001ffc00-001ffdff System I/O */ |
| 576 | 653 | AM_RANGE(0x001ffc00, 0x001ffc01) AM_MIRROR(0x7fe00000) AM_READ(test_r) |
| r10886 | r10887 | |
| 581 | 658 | AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_READ(test_r) |
| 582 | 659 | AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_WRITENOP //? |
| 583 | 660 | AM_RANGE(0x001fff80, 0x001fffbf) AM_MIRROR(0x7fe00000) AM_RAM //DRAM I/O, not accessed by this game, CD buffer? |
| 584 | AM_RANGE(0x001fffe0, 0x001fffff) AM_MIRROR(0x7fe00000) AM_READWRITE(philips_66470_r,philips_66470_w) AM_BASE(&pcab_vregs) //video registers | |
| 585 | AM_RANGE(0x80001000, 0x8000100f) AM_READWRITE(scc68070_ext_irqc_r,scc68070_ext_irqc_w) AM_BASE(&scc68070_ext_irqc_regs) //lir | |
| 586 | AM_RANGE(0x80002000, 0x8000200f) AM_READWRITE(scc68070_iic_r,scc68070_iic_w) AM_BASE(&scc68070_iic_regs) //i2c | |
| 587 | AM_RANGE(0x80002010, 0x8000201f) AM_READWRITE(scc68070_uart_r,scc68070_uart_w) AM_BASE(&scc68070_uart_regs) | |
| 588 | AM_RANGE(0x80002020, 0x8000202f) AM_READWRITE(scc68070_timer_r,scc68070_timer_w) AM_BASE(&scc68070_timer_regs) | |
| 589 | AM_RANGE(0x80002040, 0x8000204f) AM_READWRITE(scc68070_int_irqc_r,scc68070_int_irqc_w) AM_BASE(&scc68070_int_irqc_regs) | |
| 590 | AM_RANGE(0x80004000, 0x8000403f) AM_READWRITE(scc68070_dma_ch1_r,scc68070_dma_ch1_w) AM_BASE(&scc68070_dma_ch1_regs) | |
| 591 | AM_RANGE(0x80004040, 0x8000407f) AM_READWRITE(scc68070_dma_ch2_r,scc68070_dma_ch2_w) AM_BASE(&scc68070_dma_ch2_regs) | |
| 592 | AM_RANGE(0x80008000, 0x8000807f) AM_READWRITE(scc68070_mmu_r,scc68070_mmu_w) AM_BASE(&scc68070_mmu_regs) | |
| 661 | AM_RANGE(0x001fffe0, 0x001fffff) AM_MIRROR(0x7fe00000) AM_READWRITE(philips_66470_r,philips_66470_w) AM_BASE_MEMBER(magicard_state, pcab_vregs) //video registers | |
| 662 | AM_RANGE(0x80001000, 0x8000100f) AM_READWRITE(scc68070_ext_irqc_r,scc68070_ext_irqc_w) AM_BASE_MEMBER(magicard_state, scc68070_ext_irqc_regs) //lir | |
| 663 | AM_RANGE(0x80002000, 0x8000200f) AM_READWRITE(scc68070_iic_r,scc68070_iic_w) AM_BASE_MEMBER(magicard_state, scc68070_iic_regs) //i2c | |
| 664 | AM_RANGE(0x80002010, 0x8000201f) AM_READWRITE(scc68070_uart_r,scc68070_uart_w) AM_BASE_MEMBER(magicard_state, scc68070_uart_regs) | |
| 665 | AM_RANGE(0x80002020, 0x8000202f) AM_READWRITE(scc68070_timer_r,scc68070_timer_w) AM_BASE_MEMBER(magicard_state, scc68070_timer_regs) | |
| 666 | AM_RANGE(0x80002040, 0x8000204f) AM_READWRITE(scc68070_int_irqc_r,scc68070_int_irqc_w) AM_BASE_MEMBER(magicard_state, scc68070_int_irqc_regs) | |
| 667 | AM_RANGE(0x80004000, 0x8000403f) AM_READWRITE(scc68070_dma_ch1_r,scc68070_dma_ch1_w) AM_BASE_MEMBER(magicard_state, scc68070_dma_ch1_regs) | |
| 668 | AM_RANGE(0x80004040, 0x8000407f) AM_READWRITE(scc68070_dma_ch2_r,scc68070_dma_ch2_w) AM_BASE_MEMBER(magicard_state, scc68070_dma_ch2_regs) | |
| 669 | AM_RANGE(0x80008000, 0x8000807f) AM_READWRITE(scc68070_mmu_r,scc68070_mmu_w) AM_BASE_MEMBER(magicard_state, scc68070_mmu_regs) | |
| 593 | 670 | ADDRESS_MAP_END |
| 594 | 671 | |
| 595 | 672 | |
| r10886 | r10887 | |
| 603 | 680 | |
| 604 | 681 | static MACHINE_RESET( magicard ) |
| 605 | 682 | { |
| 606 | UINT16 *src = (UINT16*)machine->region( "maincpu" )->base(); | |
| 607 | UINT16 *dst = magicram; | |
| 683 | magicard_state *state = machine->driver_data<magicard_state>(); | |
| 684 | UINT16 *src = (UINT16*)machine->region("maincpu" )->base(); | |
| 685 | UINT16 *dst = state->magicram; | |
| 608 | 686 | memcpy (dst, src, 0x80000); |
| 609 | 687 | machine->device("maincpu")->reset(); |
| 610 | 688 | } |
| r10886 | r10887 | |
| 623 | 701 | cpu_set_input_line_and_vector(device, 1, HOLD_LINE,0xf0/4); |
| 624 | 702 | } |
| 625 | 703 | |
| 626 | static MACHINE_CONFIG_START( magicard, | |
| 704 | static MACHINE_CONFIG_START( magicard, magicar | |
| 627 | 705 | MCFG_CPU_ADD("maincpu", SCC68070, CLOCK_A/2) /* SCC-68070 CCA84 datasheet */ |
| 628 | 706 | MCFG_CPU_PROGRAM_MAP(magicard_mem) |
| 629 | 707 | MCFG_CPU_VBLANK_INT("screen", magicard_irq) /* no interrupts? (it erases the vectors..) */ |
| r10886 | r10887 | |
|---|---|---|
| 98 | 98 | #include "cpu/m6800/m6800.h" |
| 99 | 99 | #include "video/mc6845.h" |
| 100 | 100 | |
| 101 | static UINT8 *murogem_videoram; | |
| 102 | 101 | |
| 102 | class murogem_state : public driver_device | |
| 103 | { | |
| 104 | public: | |
| 105 | murogem_state(running_machine &machine, const driver_device_config_base &config) | |
| 106 | : driver_device(machine, config) { } | |
| 103 | 107 | |
| 108 | UINT8 *videoram; | |
| 109 | }; | |
| 110 | ||
| 111 | ||
| 104 | 112 | static ADDRESS_MAP_START( murogem_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 105 | 113 | AM_RANGE(0x0000, 0x007f) AM_RAM |
| 106 | 114 | AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("crtc", mc6845_address_w) |
| r10886 | r10887 | |
| 108 | 116 | AM_RANGE(0x5000, 0x5000) AM_READ_PORT("IN0") |
| 109 | 117 | AM_RANGE(0x5800, 0x5800) AM_READ_PORT("IN1") |
| 110 | 118 | AM_RANGE(0x7000, 0x7000) AM_WRITENOP // sound? payout? |
| 111 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE( | |
| 119 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE_MEMBER( | |
| 112 | 120 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 113 | 121 | ADDRESS_MAP_END |
| 114 | 122 | |
| r10886 | r10887 | |
| 169 | 177 | |
| 170 | 178 | static SCREEN_UPDATE(murogem) |
| 171 | 179 | { |
| 180 | murogem_state *state = screen->machine->driver_data<murogem_state>(); | |
| 172 | 181 | int xx,yy,count; |
| 173 | 182 | count = 0x000; |
| 174 | 183 | |
| r10886 | r10887 | |
| 178 | 187 | { |
| 179 | 188 | for(xx=0;xx<32;xx++) |
| 180 | 189 | { |
| 181 | int tileno = murogem_videoram[count]&0x3f; | |
| 182 | int attr = murogem_videoram[count+0x400]&0x0f; | |
| 190 | int tileno = state->videoram[count]&0x3f; | |
| 191 | int attr = state->videoram[count+0x400]&0x0f; | |
| 183 | 192 | |
| 184 | 193 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tileno,attr,0,0,xx*8,yy*8,0); |
| 185 | 194 | |
| r10886 | r10887 | |
| 207 | 216 | }; |
| 208 | 217 | |
| 209 | 218 | |
| 210 | static MACHINE_CONFIG_START( murogem, | |
| 219 | static MACHINE_CONFIG_START( murogem, murogem_stat | |
| 211 | 220 | /* basic machine hardware */ |
| 212 | 221 | MCFG_CPU_ADD("maincpu", M6802,8000000) /* ? MHz */ |
| 213 | 222 | MCFG_CPU_PROGRAM_MAP(murogem_map) |
| r10886 | r10887 | |
|---|---|---|
| 3 | 3 | #include "emu.h" |
| 4 | 4 | #include "cpu/m68000/m68000.h" |
| 5 | 5 | |
| 6 | static UINT16* hotstuff_bitmapram; | |
| 7 | 6 | |
| 7 | class hotstuff_state : public driver_device | |
| 8 | { | |
| 9 | public: | |
| 10 | hotstuff_state(running_machine &machine, const driver_device_config_base &config) | |
| 11 | : driver_device(machine, config) { } | |
| 12 | ||
| 13 | UINT16* bitmapram; | |
| 14 | }; | |
| 15 | ||
| 16 | ||
| 8 | 17 | VIDEO_START( hotstuff ) |
| 9 | 18 | { |
| 10 | ||
| 11 | 19 | } |
| 12 | 20 | |
| 13 | 21 | /* the first 0x20 bytes in every 0x200 (each line) of video ram are the colour data, providing a palette of 16 RGB444 colours for that line */ |
| 14 | 22 | |
| 15 | 23 | SCREEN_UPDATE( hotstuff ) |
| 16 | 24 | { |
| 25 | hotstuff_state *state = screen->machine->driver_data<hotstuff_state>(); | |
| 17 | 26 | int count, y,yyy,x,xxx; |
| 18 | 27 | UINT16 row_palette_data[0x10]; |
| 19 | 28 | rgb_t row_palette_data_as_rgb32_pen_data[0x10]; |
| r10886 | r10887 | |
| 28 | 37 | |
| 29 | 38 | for (p=0;p<0x10;p++) |
| 30 | 39 | { |
| 31 | row_palette_data[p] = | |
| 40 | row_palette_data[p] = | |
| 32 | 41 | |
| 33 | 42 | row_palette_data_as_rgb32_pen_data[p] = MAKE_RGB( (row_palette_data[p] & 0x0f00)>>4, (row_palette_data[p] & 0x00f0)>>0, (row_palette_data[p] & 0x000f)<<4 ); |
| 34 | 43 | |
| r10886 | r10887 | |
| 37 | 46 | for(x = 0; x < xxx; x++) |
| 38 | 47 | { |
| 39 | 48 | { |
| 40 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 49 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 41 | 50 | x++; |
| 42 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 51 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 43 | 52 | x++; |
| 44 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 53 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 45 | 54 | x++; |
| 46 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 55 | *BITMAP_ADDR32(bitmap, y, x) = row_palette_data_as_rgb32_pen_data[( | |
| 47 | 56 | } |
| 48 | 57 | |
| 49 | 58 | count++; |
| r10886 | r10887 | |
| 58 | 67 | |
| 59 | 68 | AM_RANGE(0x400000, 0x40ffff) AM_RAM |
| 60 | 69 | |
| 61 | AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE( | |
| 70 | AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE_MEMBER( | |
| 62 | 71 | ADDRESS_MAP_END |
| 63 | 72 | |
| 64 | 73 | static INPUT_PORTS_START( hotstuff ) |
| 65 | 74 | INPUT_PORTS_END |
| 66 | 75 | |
| 67 | static MACHINE_CONFIG_START( hotstuff, | |
| 76 | static MACHINE_CONFIG_START( hotstuff, hotstuff_stat | |
| 68 | 77 | |
| 69 | 78 | MCFG_CPU_ADD("maincpu", M68000, 16000000) |
| 70 | 79 | MCFG_CPU_PROGRAM_MAP(hotstuff_map) |
| r10886 | r10887 | |
|---|---|---|
| 351 | 351 | GAME(1981, ironmaid, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Iron Maiden", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| 352 | 352 | GAME(1984, lazrlord, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Lazer Lord", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| 353 | 353 | GAME(1981, lightnin, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Lightning", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| 354 | GAME(1979, meteorp, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Meteor ( | |
| 354 | GAME(1979, meteorp, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Meteor (Stern | |
| 355 | 355 | GAME(1980, nineball, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Nine Ball", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| 356 | 356 | GAME(1982, orbitor1, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Orbitor 1", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| 357 | 357 | GAME(1980, quicksil, 0, st_mp200, st_mp200, st_mp200, ROT0, "Stern", "Quicksilver", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL) |
| r10886 | r10887 | |
|---|---|---|
| 40 | 40 | #include "sound/okim6295.h" |
| 41 | 41 | |
| 42 | 42 | |
| 43 | /************************************* | |
| 44 | * | |
| 45 | * Statics | |
| 46 | * | |
| 47 | *************************************/ | |
| 43 | class skimaxx_state : public driver_device | |
| 44 | { | |
| 45 | public: | |
| 46 | skimaxx_state(running_machine &machine, const driver_device_config_base &config) | |
| 47 | : driver_device(machine, config) { } | |
| 48 | 48 | |
| 49 | static UINT32 *bg_buffer; // i.e. background and sprites | |
| 50 | static UINT16 *fg_buffer; // i.e. text | |
| 49 | UINT32 *bg_buffer; | |
| 50 | UINT16 *fg_buffer; | |
| 51 | UINT32 *bg_buffer_front; | |
| 52 | UINT32 *bg_buffer_back; | |
| 53 | UINT32 *blitter_regs; | |
| 54 | UINT16 *blitter_gfx; | |
| 55 | UINT32 blitter_gfx_len; | |
| 56 | UINT32 blitter_src_x; | |
| 57 | UINT32 blitter_src_dx; | |
| 58 | UINT32 blitter_src_y; | |
| 59 | UINT32 blitter_src_dy; | |
| 60 | UINT32 *fpga_ctrl; | |
| 61 | }; | |
| 51 | 62 | |
| 52 | 63 | |
| 53 | 64 | /************************************* |
| r10886 | r10887 | |
| 56 | 67 | * |
| 57 | 68 | *************************************/ |
| 58 | 69 | |
| 59 | static UINT32 *skimaxx_bg_buffer_front; | |
| 60 | static UINT32 *skimaxx_bg_buffer_back; | |
| 61 | ||
| 62 | static UINT32 *skimaxx_blitter_regs; | |
| 63 | static UINT16 *skimaxx_blitter_gfx; | |
| 64 | ||
| 65 | static UINT32 skimaxx_blitter_gfx_len; | |
| 66 | ||
| 67 | static UINT32 skimaxx_blitter_src_x, skimaxx_blitter_src_dx; | |
| 68 | static UINT32 skimaxx_blitter_src_y, skimaxx_blitter_src_dy; | |
| 69 | ||
| 70 | 70 | // Set up blit parameters |
| 71 | 71 | static WRITE32_HANDLER( skimaxx_blitter_w ) |
| 72 | 72 | { |
| 73 | UINT32 newdata = COMBINE_DATA( &skimaxx_blitter_regs[offset] ); | |
| 73 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 74 | UINT32 newdata = COMBINE_DATA( &state->blitter_regs[offset] ); | |
| 74 | 75 | |
| 75 | 76 | switch (offset) |
| 76 | 77 | { |
| 77 | 78 | case 0: |
| 78 | s | |
| 79 | st | |
| 79 | 80 | break; |
| 80 | 81 | |
| 81 | 82 | case 1: |
| 82 | skimaxx_blitter_src_x = (newdata & 0x1ff) << 8; | |
| 83 | skimaxx_blitter_src_y = (newdata >> 9) << 8; | |
| 83 | state->blitter_src_x = (newdata & 0x1ff) << 8; | |
| 84 | state->blitter_src_y = (newdata >> 9) << 8; | |
| 84 | 85 | break; |
| 85 | 86 | |
| 86 | 87 | case 2: |
| 87 | 88 | if (ACCESSING_BITS_16_31) |
| 88 | s | |
| 89 | st | |
| 89 | 90 | if (ACCESSING_BITS_0_15) |
| 90 | s | |
| 91 | st | |
| 91 | 92 | |
| 92 | s | |
| 93 | st | |
| 93 | 94 | break; |
| 94 | 95 | |
| 95 | 96 | case 3: |
| r10886 | r10887 | |
| 101 | 102 | // A read by the 68030 from this area blits one pixel to the back buffer (at the same offset) |
| 102 | 103 | static READ32_HANDLER( skimaxx_blitter_r ) |
| 103 | 104 | { |
| 104 | UINT32 penaddr = ((skimaxx_blitter_src_x >> 8) & 0x1ff) + ((skimaxx_blitter_src_y >> 8) << 9); | |
| 105 | UINT16 *src = skimaxx_blitter_gfx + (penaddr % skimaxx_blitter_gfx_len); | |
| 106 | UINT32 *dst = skimaxx_bg_buffer_back + offset; | |
| 105 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 106 | UINT32 penaddr = ((state->blitter_src_x >> 8) & 0x1ff) + ((state->blitter_src_y >> 8) << 9); | |
| 107 | UINT16 *src = state->blitter_gfx + (penaddr % state->blitter_gfx_len); | |
| 108 | UINT32 *dst = state->bg_buffer_back + offset; | |
| 107 | 109 | |
| 108 | 110 | UINT16 pen = (*src) & 0x7fff; |
| 109 | 111 | |
| r10886 | r10887 | |
| 115 | 117 | *dst = (*dst & 0xffff0000) | pen; |
| 116 | 118 | } |
| 117 | 119 | |
| 118 | skimaxx_blitter_src_x = (skimaxx_blitter_src_x & 0x10000) | ((skimaxx_blitter_src_x + skimaxx_blitter_src_dx) & 0xffff); | |
| 119 | skimaxx_blitter_src_y = (skimaxx_blitter_src_y & 0xffff0000) | ((skimaxx_blitter_src_y + skimaxx_blitter_src_dy) & 0xffff); | |
| 120 | state->blitter_src_x = (state->blitter_src_x & 0x10000) | ((state->blitter_src_x + state->blitter_src_dx) & 0xffff); | |
| 121 | state->blitter_src_y = (state->blitter_src_y & 0xffff0000) | ((state->blitter_src_y + state->blitter_src_dy) & 0xffff); | |
| 120 | 122 | |
| 121 | 123 | return 0; |
| 122 | 124 | } |
| r10886 | r10887 | |
| 124 | 126 | |
| 125 | 127 | static VIDEO_START( skimaxx ) |
| 126 | 128 | { |
| 127 | skimaxx_blitter_gfx = (UINT16 *) machine->region( "blitter" )->base(); | |
| 128 | skimaxx_blitter_gfx_len = machine->region( "blitter" )->bytes() / 2; | |
| 129 | skimaxx_state *state = machine->driver_data<skimaxx_state>(); | |
| 130 | state->blitter_gfx = (UINT16 *) machine->region( "blitter" )->base(); | |
| 131 | state->blitter_gfx_len = machine->region( "blitter" )->bytes() / 2; | |
| 129 | 132 | |
| 130 | bg_buffer = auto_alloc_array(machine, UINT32, 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 2); // 2 buffers | |
| 131 | skimaxx_bg_buffer_back = bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 0; | |
| 132 | skimaxx_bg_buffer_front = bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 1; | |
| 133 | memory_configure_bank(machine, "bank1", 0, 1, skimaxx_bg_buffer_back, 0); | |
| 134 | memory_configure_bank(machine, "bank1", 1, 1, skimaxx_bg_buffer_front, 0); | |
| 133 | state->bg_buffer = auto_alloc_array(machine, UINT32, 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 2); // 2 buffers | |
| 134 | state->bg_buffer_back = state->bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 0; | |
| 135 | state->bg_buffer_front = state->bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 1; | |
| 136 | memory_configure_bank(machine, "bank1", 0, 1, state->bg_buffer_back, 0); | |
| 137 | memory_configure_bank(machine, "bank1", 1, 1, state->bg_buffer_front, 0); | |
| 135 | 138 | } |
| 136 | 139 | |
| 137 | 140 | static SCREEN_UPDATE( skimaxx ) |
| r10886 | r10887 | |
| 152 | 155 | // TODO: Might not be used |
| 153 | 156 | static void skimaxx_to_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg) |
| 154 | 157 | { |
| 155 | memcpy(shiftreg, &fg_buffer[TOWORD(address)], 512 * sizeof(UINT16)); | |
| 158 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 159 | memcpy(shiftreg, &state->fg_buffer[TOWORD(address)], 512 * sizeof(UINT16)); | |
| 156 | 160 | } |
| 157 | 161 | |
| 158 | 162 | static void skimaxx_from_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg) |
| 159 | 163 | { |
| 160 | memcpy(&fg_buffer[TOWORD(address)], shiftreg, 512 * sizeof(UINT16)); | |
| 164 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 165 | memcpy(&state->fg_buffer[TOWORD(address)], shiftreg, 512 * sizeof(UINT16)); | |
| 161 | 166 | } |
| 162 | 167 | |
| 163 | 168 | |
| r10886 | r10887 | |
| 169 | 174 | |
| 170 | 175 | static void skimaxx_scanline_update(screen_device &screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params) |
| 171 | 176 | { |
| 177 | skimaxx_state *state = screen.machine->driver_data<skimaxx_state>(); | |
| 172 | 178 | // TODO: This isn't correct. I just hacked it together quickly so I could see something! |
| 173 | 179 | |
| 174 | 180 | if (params->rowaddr >= 0x220) |
| 175 | 181 | { |
| 176 | 182 | UINT32 rowaddr = (params->rowaddr - 0x220); |
| 177 | UINT16 *fg = &fg_buffer[rowaddr << 8]; | |
| 178 | UINT32 *bg = &skimaxx_bg_buffer_front[rowaddr/2 * 1024/2]; | |
| 183 | UINT16 *fg = &state->fg_buffer[rowaddr << 8]; | |
| 184 | UINT32 *bg = &state->bg_buffer_front[rowaddr/2 * 1024/2]; | |
| 179 | 185 | UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0); |
| 180 | 186 | //int coladdr = params->coladdr; |
| 181 | 187 | int x; |
| r10886 | r10887 | |
| 236 | 242 | bit 0: bit banging data |
| 237 | 243 | */ |
| 238 | 244 | |
| 239 | static UINT32 *skimaxx_fpga_ctrl; | |
| 240 | 245 | static WRITE32_HANDLER( skimaxx_fpga_ctrl_w ) |
| 241 | 246 | { |
| 242 | UINT32 newdata = COMBINE_DATA( skimaxx_fpga_ctrl ); | |
| 247 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 248 | UINT32 newdata = COMBINE_DATA( state->fpga_ctrl ); | |
| 243 | 249 | |
| 244 | 250 | if (ACCESSING_BITS_0_7) |
| 245 | 251 | { |
| 246 | 252 | // double buffering |
| 247 | 253 | UINT8 bank_bg_buffer = (newdata & 0x40) ? 1 : 0; |
| 248 | 254 | |
| 249 | skimaxx_bg_buffer_back = bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * bank_bg_buffer; | |
| 250 | skimaxx_bg_buffer_front = bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * (1 - bank_bg_buffer); | |
| 255 | state->bg_buffer_back = state->bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * bank_bg_buffer; | |
| 256 | state->bg_buffer_front = state->bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * (1 - bank_bg_buffer); | |
| 251 | 257 | |
| 252 | 258 | memory_set_bank(space->machine, "bank1", bank_bg_buffer); |
| 253 | 259 | } |
| r10886 | r10887 | |
| 256 | 262 | // 0x2000004c: bit 7, bit 0 |
| 257 | 263 | static READ32_HANDLER( unk_r ) |
| 258 | 264 | { |
| 259 | return (*skimaxx_fpga_ctrl & 0x20) ? 0x80 : 0x00; | |
| 265 | skimaxx_state *state = space->machine->driver_data<skimaxx_state>(); | |
| 266 | return (*state->fpga_ctrl & 0x20) ? 0x80 : 0x00; | |
| 260 | 267 | } |
| 261 | 268 | |
| 262 | 269 | // 0x20000023 |
| r10886 | r10887 | |
| 338 | 345 | AM_RANGE(0x00000000, 0x003fffff) AM_ROM |
| 339 | 346 | |
| 340 | 347 | AM_RANGE(0x20000000, 0x2007ffff) AM_READ ( skimaxx_blitter_r ) // do blit |
| 341 | AM_RANGE(0x30000000, 0x3000000f) AM_WRITE( skimaxx_blitter_w ) AM_BASE( | |
| 348 | AM_RANGE(0x30000000, 0x3000000f) AM_WRITE( skimaxx_blitter_w ) AM_BASE_MEMBER( | |
| 342 | 349 | |
| 343 | AM_RANGE(0x40000000, 0x40000003) AM_WRITE( skimaxx_fpga_ctrl_w ) AM_BASE( | |
| 350 | AM_RANGE(0x40000000, 0x40000003) AM_WRITE( skimaxx_fpga_ctrl_w ) AM_BASE_MEMBER( | |
| 344 | 351 | |
| 345 | 352 | AM_RANGE(0x50000000, 0x5007ffff) AM_RAMBANK("bank1") // background ram allocated here at video_start (skimaxx_bg_buffer_back/front) |
| 346 | 353 | // AM_RANGE(0xfffc0000, 0xfffc7fff) AM_RAM AM_SHARE("share1") |
| r10886 | r10887 | |
| 362 | 369 | AM_RANGE(0x00000000, 0x000100ff) AM_RAM |
| 363 | 370 | AM_RANGE(0x00008000, 0x0003ffff) AM_RAM |
| 364 | 371 | AM_RANGE(0x00050000, 0x0005ffff) AM_RAM |
| 365 | AM_RANGE(0x00220000, 0x003fffff) AM_RAM AM_BASE( | |
| 372 | AM_RANGE(0x00220000, 0x003fffff) AM_RAM AM_BASE_MEMBER(skimaxx_state, fg_buffer) | |
| 366 | 373 | AM_RANGE(0x02000000, 0x0200000f) AM_RAM |
| 367 | 374 | AM_RANGE(0x02100000, 0x0210000f) AM_RAM |
| 368 | 375 | AM_RANGE(0x04000000, 0x047fffff) AM_ROM AM_REGION("tmsgfx", 0) |
| r10886 | r10887 | |
| 503 | 510 | * |
| 504 | 511 | *************************************/ |
| 505 | 512 | |
| 506 | static MACHINE_CONFIG_START( skimaxx, | |
| 513 | static MACHINE_CONFIG_START( skimaxx, skimaxx_stat | |
| 507 | 514 | MCFG_CPU_ADD("maincpu", M68EC030, XTAL_40MHz) |
| 508 | 515 | MCFG_CPU_PROGRAM_MAP(68030_1_map) |
| 509 | 516 | MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) // 1,3,7 are identical, rest is RTE |
| r10886 | r10887 | |
|---|---|---|
| 40 | 40 | #include "sound/ay8910.h" |
| 41 | 41 | #include "machine/nvram.h" |
| 42 | 42 | |
| 43 | ||
| 44 | class vroulet_state : public driver_device | |
| 45 | { | |
| 46 | public: | |
| 47 | vroulet_state(running_machine &machine, const driver_device_config_base &config) | |
| 48 | : driver_device(machine, config) { } | |
| 49 | ||
| 50 | UINT8 *ball; | |
| 51 | UINT8 *videoram; | |
| 52 | UINT8 *colorram; | |
| 53 | tilemap_t *bg_tilemap; | |
| 54 | }; | |
| 55 | ||
| 56 | ||
| 43 | 57 | /* video */ |
| 44 | 58 | |
| 45 | static UINT8 *vroulet_ball; | |
| 46 | static UINT8 *videoram; | |
| 47 | static UINT8 *colorram; | |
| 48 | static tilemap_t *bg_tilemap; | |
| 49 | 59 | |
| 50 | 60 | static WRITE8_HANDLER(vroulet_paletteram_w) |
| 51 | 61 | { |
| r10886 | r10887 | |
| 69 | 79 | |
| 70 | 80 | static WRITE8_HANDLER( vroulet_videoram_w ) |
| 71 | 81 | { |
| 72 | videoram[offset] = data; | |
| 73 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 82 | vroulet_state *state = space->machine->driver_data<vroulet_state>(); | |
| 83 | state->videoram[offset] = data; | |
| 84 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 74 | 85 | } |
| 75 | 86 | |
| 76 | 87 | static WRITE8_HANDLER( vroulet_colorram_w ) |
| 77 | 88 | { |
| 78 | colorram[offset] = data; | |
| 79 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 89 | vroulet_state *state = space->machine->driver_data<vroulet_state>(); | |
| 90 | state->colorram[offset] = data; | |
| 91 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 80 | 92 | } |
| 81 | 93 | |
| 82 | 94 | static TILE_GET_INFO( get_bg_tile_info ) |
| 83 | 95 | { |
| 84 | int attr = colorram[tile_index]; | |
| 85 | int code = videoram[tile_index] + ((attr & 0xc0) << 2); | |
| 96 | vroulet_state *state = machine->driver_data<vroulet_state>(); | |
| 97 | int attr = state->colorram[tile_index]; | |
| 98 | int code = state->videoram[tile_index] + ((attr & 0xc0) << 2); | |
| 86 | 99 | int color = attr & 0x1f; |
| 87 | 100 | |
| 88 | 101 | SET_TILE_INFO(0, code, color, 0); |
| r10886 | r10887 | |
| 90 | 103 | |
| 91 | 104 | static VIDEO_START(vroulet) |
| 92 | 105 | { |
| 93 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, | |
| 106 | vroulet_state *state = machine->driver_data<vroulet_state>(); | |
| 107 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, | |
| 94 | 108 | 8, 8, 32, 32); |
| 95 | 109 | } |
| 96 | 110 | |
| 97 | 111 | static SCREEN_UPDATE(vroulet) |
| 98 | 112 | { |
| 99 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 113 | vroulet_state *state = screen->machine->driver_data<vroulet_state>(); | |
| 114 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 100 | 115 | drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], 0x320, 1, 0, 0, |
| 101 | | |
| 116 | s | |
| 102 | 117 | return 0; |
| 103 | 118 | } |
| 104 | 119 | |
| r10886 | r10887 | |
| 108 | 123 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 109 | 124 | AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("nvram") |
| 110 | 125 | AM_RANGE(0x8000, 0x8000) AM_NOP |
| 111 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(vroulet_videoram_w) AM_BASE(&videoram) | |
| 112 | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(vroulet_colorram_w) AM_BASE(&colorram) | |
| 113 | AM_RANGE(0xa000, 0xa001) AM_RAM AM_BASE(&vroulet_ball) | |
| 126 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(vroulet_videoram_w) AM_BASE_MEMBER(vroulet_state, videoram) | |
| 127 | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(vroulet_colorram_w) AM_BASE_MEMBER(vroulet_state, colorram) | |
| 128 | AM_RANGE(0xa000, 0xa001) AM_RAM AM_BASE_MEMBER(vroulet_state, ball) | |
| 114 | 129 | AM_RANGE(0xb000, 0xb0ff) AM_WRITE(vroulet_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 115 | 130 | AM_RANGE(0xc000, 0xc000) AM_NOP |
| 116 | 131 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 260 | 275 | |
| 261 | 276 | /* Machine Driver */ |
| 262 | 277 | |
| 263 | static MACHINE_CONFIG_START( vroulet, | |
| 278 | static MACHINE_CONFIG_START( vroulet, | |
| 264 | 279 | // basic machine hardware |
| 265 | 280 | MCFG_CPU_ADD("maincpu", Z80, 4000000) //??? |
| 266 | 281 | MCFG_CPU_PROGRAM_MAP(vroulet_map) |
| r10886 | r10887 | |
|---|---|---|
| 218 | 218 | #include "sound/ymz280b.h" |
| 219 | 219 | #include "machine/nvram.h" |
| 220 | 220 | |
| 221 | static UINT16 *vram; | |
| 222 | 221 | |
| 222 | class coinmvga_state : public driver_device | |
| 223 | { | |
| 224 | public: | |
| 225 | coinmvga_state(running_machine &machine, const driver_device_config_base &config) | |
| 226 | : driver_device(machine, config) { } | |
| 223 | 227 | |
| 228 | UINT16 *vram; | |
| 229 | struct { int r,g,b,offs,offs_internal; } bgpal, fgpal; | |
| 230 | }; | |
| 231 | ||
| 232 | ||
| 224 | 233 | /************************* |
| 225 | 234 | * Video Hardware * |
| 226 | 235 | *************************/ |
| r10886 | r10887 | |
| 228 | 237 | |
| 229 | 238 | static VIDEO_START( coinmvga ) |
| 230 | 239 | { |
| 231 | ||
| 232 | 240 | } |
| 233 | 241 | |
| 234 | 242 | |
| 235 | 243 | static SCREEN_UPDATE( coinmvga ) |
| 236 | 244 | { |
| 245 | coinmvga_state *state = screen->machine->driver_data<coinmvga_state>(); | |
| 237 | 246 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 238 | 247 | int count = 0x04000/2; |
| 239 | 248 | |
| r10886 | r10887 | |
| 244 | 253 | { |
| 245 | 254 | for (x=0;x<128;x++) |
| 246 | 255 | { |
| 247 | int tile = vram[count]; | |
| 256 | int tile = state->vram[count]; | |
| 248 | 257 | //int colour = tile>>12; |
| 249 | 258 | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8); |
| 250 | 259 | |
| r10886 | r10887 | |
| 274 | 283 | |
| 275 | 284 | static WRITE16_HANDLER( ramdac_bg_w ) |
| 276 | 285 | { |
| 277 | static int pal_offs,internal_pal_offs,r,g,b; | |
| 278 | ||
| 286 | coinmvga_state *state = space->machine->driver_data<coinmvga_state>(); | |
| 279 | 287 | if(ACCESSING_BITS_8_15) |
| 280 | 288 | { |
| 281 | pal_offs = data >> 8; | |
| 282 | internal_pal_offs = 0; | |
| 289 | state->bgpal.offs = data >> 8; | |
| 290 | state->bgpal.offs_internal = 0; | |
| 283 | 291 | } |
| 284 | 292 | else //if(mem_mask == 0x00ff) |
| 285 | 293 | { |
| 286 | switch( | |
| 294 | switch(s | |
| 287 | 295 | { |
| 288 | 296 | case 0: |
| 289 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 290 | internal_pal_offs++; | |
| 297 | state->bgpal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 298 | state->bgpal.offs_internal++; | |
| 291 | 299 | break; |
| 292 | 300 | case 1: |
| 293 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 294 | internal_pal_offs++; | |
| 301 | state->bgpal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 302 | state->bgpal.offs_internal++; | |
| 295 | 303 | break; |
| 296 | 304 | case 2: |
| 297 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 298 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 299 | internal_pal_offs = 0; | |
| 300 | pal_offs++; | |
| 305 | state->bgpal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 306 | palette_set_color(space->machine, state->bgpal.offs, MAKE_RGB(state->bgpal.r, state->bgpal.g, state->bgpal.b)); | |
| 307 | state->bgpal.offs_internal = 0; | |
| 308 | state->bgpal.offs++; | |
| 301 | 309 | break; |
| 302 | 310 | } |
| 303 | 311 | } |
| r10886 | r10887 | |
| 306 | 314 | |
| 307 | 315 | static WRITE16_HANDLER( ramdac_fg_w ) |
| 308 | 316 | { |
| 309 | static int pal_offs,internal_pal_offs,r,g,b; | |
| 310 | ||
| 317 | coinmvga_state *state = space->machine->driver_data<coinmvga_state>(); | |
| 311 | 318 | if(ACCESSING_BITS_8_15) |
| 312 | 319 | { |
| 313 | pal_offs = data >> 8; | |
| 314 | internal_pal_offs = 0; | |
| 320 | state->fgpal.offs = data >> 8; | |
| 321 | state->fgpal.offs_internal = 0; | |
| 315 | 322 | } |
| 316 | 323 | else |
| 317 | 324 | { |
| 318 | switch( | |
| 325 | switch(s | |
| 319 | 326 | { |
| 320 | 327 | case 0: |
| 321 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 322 | internal_pal_offs++; | |
| 328 | state->fgpal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 329 | state->fgpal.offs_internal++; | |
| 323 | 330 | break; |
| 324 | 331 | case 1: |
| 325 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 326 | internal_pal_offs++; | |
| 332 | state->fgpal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 333 | state->fgpal.offs_internal++; | |
| 327 | 334 | break; |
| 328 | 335 | case 2: |
| 329 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 330 | palette_set_color(space->machine, 0x100+pal_offs, MAKE_RGB(r, g, b)); | |
| 331 | internal_pal_offs = 0; | |
| 332 | pal_offs++; | |
| 336 | state->fgpal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 337 | palette_set_color(space->machine, 0x100+state->fgpal.offs, MAKE_RGB(state->fgpal.r, state->fgpal.g, state->fgpal.b)); | |
| 338 | state->fgpal.offs_internal = 0; | |
| 339 | state->fgpal.offs++; | |
| 333 | 340 | break; |
| 334 | 341 | } |
| 335 | 342 | } |
| r10886 | r10887 | |
| 351 | 358 | |
| 352 | 359 | // AM_RANGE(0x0a0000, 0x0fffff) AM_RAM |
| 353 | 360 | // AM_RANGE(0x100000, 0x1fffff) AM_RAM //colorama |
| 354 | AM_RANGE(0x210000, 0x21ffff) AM_RAM AM_BASE( | |
| 361 | AM_RANGE(0x210000, 0x21ffff) AM_RAM AM_BASE_MEMBER(coinmvga_state, vram) | |
| 355 | 362 | // AM_RANGE(0x40746e, 0x40746f) AM_READ(test_r) AM_WRITENOP //touch screen related, colorama |
| 356 | 363 | // AM_RANGE(0x403afa, 0x403afb) AM_READ(test_r) AM_WRITENOP //touch screen related, cmrltv75 |
| 357 | 364 | AM_RANGE(0x400000, 0x40ffff) AM_RAM |
| r10886 | r10887 | |
| 653 | 660 | * Machine Drivers * |
| 654 | 661 | *************************/ |
| 655 | 662 | |
| 656 | static MACHINE_CONFIG_START( coinmvga, | |
| 663 | static MACHINE_CONFIG_START( coinmvga, coinmvga_stat | |
| 657 | 664 | |
| 658 | 665 | /* basic machine hardware */ |
| 659 | 666 | MCFG_CPU_ADD("maincpu", H83007, CPU_CLOCK) /* xtal */ |
| r10886 | r10887 | |
|---|---|---|
| 450 | 450 | #include "sound/ay8910.h" |
| 451 | 451 | #include "sound/okim6295.h" |
| 452 | 452 | |
| 453 | static UINT8 main_latch_d800; | |
| 454 | static UINT8 snd_latch_0800; | |
| 455 | static UINT8 snd_latch_0a02; | |
| 456 | static UINT8 ay8910_addr; | |
| 457 | static device_t *ay8910; | |
| 458 | 453 | |
| 454 | class _5clown_state : public driver_device | |
| 455 | { | |
| 456 | public: | |
| 457 | _5clown_state(running_machine &machine, const driver_device_config_base &config) | |
| 458 | : driver_device(machine, config) { } | |
| 459 | 459 | |
| 460 | UINT8 main_latch_d800; | |
| 461 | UINT8 snd_latch_0800; | |
| 462 | UINT8 snd_latch_0a02; | |
| 463 | UINT8 ay8910_addr; | |
| 464 | device_t *ay8910; | |
| 465 | UINT8 *videoram; | |
| 466 | UINT8 *colorram; | |
| 467 | tilemap_t *bg_tilemap; | |
| 468 | int mux_data; | |
| 469 | }; | |
| 470 | ||
| 471 | ||
| 472 | ||
| 473 | ||
| 460 | 474 | /************************* |
| 461 | 475 | * Video Hardware * |
| 462 | 476 | *************************/ |
| 463 | 477 | |
| 464 | static UINT8 *videoram; | |
| 465 | static UINT8 *colorram; | |
| 466 | static tilemap_t *bg_tilemap; | |
| 467 | 478 | |
| 468 | 479 | |
| 469 | 480 | static WRITE8_HANDLER( fclown_videoram_w ) |
| 470 | 481 | { |
| 471 | videoram[offset] = data; | |
| 472 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 482 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 483 | state->videoram[offset] = data; | |
| 484 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 473 | 485 | } |
| 474 | 486 | |
| 475 | 487 | static WRITE8_HANDLER( fclown_colorram_w ) |
| 476 | 488 | { |
| 477 | colorram[offset] = data; | |
| 478 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 489 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 490 | state->colorram[offset] = data; | |
| 491 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 479 | 492 | } |
| 480 | 493 | |
| 481 | 494 | |
| 482 | 495 | static TILE_GET_INFO( get_fclown_tile_info ) |
| 483 | 496 | { |
| 497 | _5clown_state *state = machine->driver_data<_5clown_state>(); | |
| 484 | 498 | |
| 485 | 499 | /* - bits - |
| 486 | 500 | 7654 3210 |
| r10886 | r10887 | |
| 491 | 505 | x--- ---- Extra color for 7's. |
| 492 | 506 | */ |
| 493 | 507 | |
| 494 | int attr = colorram[tile_index]; | |
| 495 | int code = ((attr & 0x01) << 8) | ((attr & 0x40) << 2) | videoram[tile_index]; /* bit 8 for extended char set */ | |
| 508 | int attr = state->colorram[tile_index]; | |
| 509 | int code = ((attr & 0x01) << 8) | ((attr & 0x40) << 2) | state->videoram[tile_index]; /* bit 8 for extended char set */ | |
| 496 | 510 | int bank = (attr & 0x02) >> 1; /* bit 1 switch the gfx banks */ |
| 497 | 511 | int color = (attr & 0x3c) >> 2 | ((attr & 0x80) >> 3); /* bits 2-3-4-5-7 for color */ |
| 498 | 512 | |
| r10886 | r10887 | |
| 502 | 516 | |
| 503 | 517 | static VIDEO_START(fclown) |
| 504 | 518 | { |
| 505 | bg_tilemap = tilemap_create(machine, get_fclown_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 519 | _5clown_state *state = machine->driver_data<_5clown_state>(); | |
| 520 | state->bg_tilemap = tilemap_create(machine, get_fclown_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 506 | 521 | } |
| 507 | 522 | |
| 508 | 523 | |
| 509 | 524 | static SCREEN_UPDATE( fclown ) |
| 510 | 525 | { |
| 511 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 526 | _5clown_state *state = screen->machine->driver_data<_5clown_state>(); | |
| 527 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 512 | 528 | return 0; |
| 513 | 529 | } |
| 514 | 530 | |
| r10886 | r10887 | |
| 557 | 573 | * R/W Handlers * |
| 558 | 574 | ******************************/ |
| 559 | 575 | |
| 560 | static int mux_data = 0; | |
| 561 | 576 | |
| 562 | 577 | /* Inputs (buttons) are multiplexed. |
| 563 | 578 | There are 4 sets of 5 bits each and are connected to PIA0, portA. |
| r10886 | r10887 | |
| 565 | 580 | */ |
| 566 | 581 | static READ8_DEVICE_HANDLER( mux_port_r ) |
| 567 | 582 | { |
| 568 | switch( mux_data & 0xf0 ) /* bits 4-7 */ | |
| 583 | _5clown_state *state = device->machine->driver_data<_5clown_state>(); | |
| 584 | switch( state->mux_data & 0xf0 ) /* bits 4-7 */ | |
| 569 | 585 | { |
| 570 | 586 | case 0x10: return input_port_read(device->machine, "IN0-0"); |
| 571 | 587 | case 0x20: return input_port_read(device->machine, "IN0-1"); |
| r10886 | r10887 | |
| 579 | 595 | |
| 580 | 596 | static WRITE8_DEVICE_HANDLER( mux_w ) |
| 581 | 597 | { |
| 582 | mux_data = data ^ 0xff; /* Inverted */ | |
| 598 | _5clown_state *state = device->machine->driver_data<_5clown_state>(); | |
| 599 | state->mux_data = data ^ 0xff; /* Inverted */ | |
| 583 | 600 | } |
| 584 | 601 | |
| 585 | 602 | |
| r10886 | r10887 | |
| 643 | 660 | |
| 644 | 661 | static WRITE8_HANDLER( cpu_d800_w ) |
| 645 | 662 | { |
| 663 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 646 | 664 | logerror("Main: Write to $D800: %02x\n", data); |
| 647 | main_latch_d800 = data; | |
| 665 | state->main_latch_d800 = data; | |
| 648 | 666 | } |
| 649 | 667 | |
| 650 | 668 | |
| r10886 | r10887 | |
| 665 | 683 | |
| 666 | 684 | static READ8_HANDLER( snd_e06_r ) |
| 667 | 685 | { |
| 686 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 668 | 687 | logerror("Sound: Read from $0E06 \n"); |
| 669 | return main_latch_d800; | |
| 688 | return state->main_latch_d800; | |
| 670 | 689 | } |
| 671 | 690 | |
| 672 | 691 | static WRITE8_HANDLER( snd_800_w ) |
| 673 | 692 | { |
| 674 | snd_latch_0800 = data; | |
| 693 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 694 | state->snd_latch_0800 = data; | |
| 675 | 695 | |
| 676 | if (snd_latch_0a02 == 0xc0) | |
| 696 | if (state->snd_latch_0a02 == 0xc0) | |
| 677 | 697 | { |
| 678 | ay8910_addr = snd_latch_0800; | |
| 698 | state->ay8910_addr = state->snd_latch_0800; | |
| 679 | 699 | } |
| 680 | 700 | |
| 681 | if (snd_latch_0a02 == 0x00) | |
| 701 | if (state->snd_latch_0a02 == 0x00) | |
| 682 | 702 | { |
| 683 | fclown_ay8910_w( ay8910, ay8910_addr, snd_latch_0800); | |
| 703 | fclown_ay8910_w( state->ay8910, state->ay8910_addr, state->snd_latch_0800); | |
| 684 | 704 | } |
| 685 | 705 | } |
| 686 | 706 | |
| 687 | 707 | static WRITE8_HANDLER( snd_a02_w ) |
| 688 | 708 | { |
| 689 | snd_latch_0a02 = data & 0xff; | |
| 690 | logerror("Sound: Write to $0A02: %02x\n", snd_latch_0a02); | |
| 709 | _5clown_state *state = space->machine->driver_data<_5clown_state>(); | |
| 710 | state->snd_latch_0a02 = data & 0xff; | |
| 711 | logerror("Sound: Write to $0A02: %02x\n", state->snd_latch_0a02); | |
| 691 | 712 | } |
| 692 | 713 | |
| 693 | 714 | |
| r10886 | r10887 | |
| 701 | 722 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 702 | 723 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 703 | 724 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 704 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(fclown_videoram_w) AM_BASE(&videoram) /* Init'ed at $2042 */ | |
| 705 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(fclown_colorram_w) AM_BASE(&colorram) /* Init'ed at $2054 */ | |
| 725 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(fclown_videoram_w) AM_BASE_MEMBER(_5clown_state, videoram) /* Init'ed at $2042 */ | |
| 726 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(fclown_colorram_w) AM_BASE_MEMBER(_5clown_state, colorram) /* Init'ed at $2054 */ | |
| 706 | 727 | AM_RANGE(0x2000, 0x7fff) AM_ROM /* ROM space */ |
| 707 | 728 | |
| 708 | 729 | AM_RANGE(0xc048, 0xc048) AM_WRITE(cpu_c048_w ) |
| r10886 | r10887 | |
| 1028 | 1049 | * Machine Drivers * |
| 1029 | 1050 | *************************/ |
| 1030 | 1051 | |
| 1031 | static MACHINE_CONFIG_START( fclown, | |
| 1052 | static MACHINE_CONFIG_START( fclown, | |
| 1032 | 1053 | |
| 1033 | 1054 | /* basic machine hardware */ |
| 1034 | 1055 | MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/8) /* guess, seems ok */ |
| r10886 | r10887 | |
| 1177 | 1198 | |
| 1178 | 1199 | static DRIVER_INIT( fclown ) |
| 1179 | 1200 | { |
| 1201 | _5clown_state *state = machine->driver_data<_5clown_state>(); | |
| 1180 | 1202 | /* Decrypting main program */ |
| 1181 | 1203 | |
| 1182 | 1204 | int x; |
| r10886 | r10887 | |
| 1229 | 1251 | |
| 1230 | 1252 | /* Assigning AY-3-8910 sound device */ |
| 1231 | 1253 | |
| 1232 | ay8910 = machine->device("ay8910"); | |
| 1254 | state->ay8910 = machine->device("ay8910"); | |
| 1233 | 1255 | } |
| 1234 | 1256 | |
| 1235 | 1257 |
| r10886 | r10887 | |
|---|---|---|
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "cpu/z80/z80.h" |
| 14 | 14 | |
| 15 | static UINT8 *ram; | |
| 16 | static UINT8 color; | |
| 17 | 15 | |
| 16 | class tgtpanic_state : public driver_device | |
| 17 | { | |
| 18 | public: | |
| 19 | tgtpanic_state(running_machine &machine, const driver_device_config_base &config) | |
| 20 | : driver_device(machine, config) { } | |
| 18 | 21 | |
| 22 | UINT8 *ram; | |
| 23 | UINT8 color; | |
| 24 | }; | |
| 25 | ||
| 26 | ||
| 19 | 27 | /************************************* |
| 20 | 28 | * |
| 21 | 29 | * Video hardware |
| r10886 | r10887 | |
| 24 | 32 | |
| 25 | 33 | static SCREEN_UPDATE( tgtpanic ) |
| 26 | 34 | { |
| 35 | tgtpanic_state *state = screen->machine->driver_data<tgtpanic_state>(); | |
| 27 | 36 | UINT32 colors[4]; |
| 28 | 37 | UINT32 offs; |
| 29 | 38 | UINT32 x, y; |
| 30 | 39 | |
| 31 | 40 | colors[0] = 0; |
| 32 | 41 | colors[1] = 0xffffffff; |
| 33 | colors[2] = MAKE_RGB(pal1bit(color >> 2), pal1bit(color >> 1), pal1bit(color >> 0)); | |
| 34 | colors[3] = MAKE_RGB(pal1bit(color >> 6), pal1bit(color >> 5), pal1bit(color >> 4)); | |
| 42 | colors[2] = MAKE_RGB(pal1bit(state->color >> 2), pal1bit(state->color >> 1), pal1bit(state->color >> 0)); | |
| 43 | colors[3] = MAKE_RGB(pal1bit(state->color >> 6), pal1bit(state->color >> 5), pal1bit(state->color >> 4)); | |
| 35 | 44 | |
| 36 | 45 | for (offs = 0; offs < 0x2000; ++offs) |
| 37 | 46 | { |
| 38 | UINT8 val = ram[offs]; | |
| 47 | UINT8 val = state->ram[offs]; | |
| 39 | 48 | |
| 40 | 49 | y = (offs & 0x7f) << 1; |
| 41 | 50 | x = (offs >> 7) << 2; |
| r10886 | r10887 | |
| 59 | 68 | |
| 60 | 69 | static WRITE8_HANDLER( color_w ) |
| 61 | 70 | { |
| 71 | tgtpanic_state *state = space->machine->driver_data<tgtpanic_state>(); | |
| 62 | 72 | space->machine->primary_screen->update_partial(space->machine->primary_screen->vpos()); |
| 63 | color = data; | |
| 73 | state->color = data; | |
| 64 | 74 | } |
| 65 | 75 | |
| 66 | 76 | |
| r10886 | r10887 | |
| 72 | 82 | |
| 73 | 83 | static ADDRESS_MAP_START( prg_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 74 | 84 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 75 | AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE( | |
| 85 | AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_MEMBER(tgtpanic_state, ram) | |
| 76 | 86 | ADDRESS_MAP_END |
| 77 | 87 | |
| 78 | 88 | static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 117 | 127 | * |
| 118 | 128 | *************************************/ |
| 119 | 129 | |
| 120 | static MACHINE_CONFIG_START( tgtpanic, | |
| 130 | static MACHINE_CONFIG_START( tgtpanic, tgtpani | |
| 121 | 131 | |
| 122 | 132 | /* basic machine hardware */ |
| 123 | 133 | MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) |
| r10886 | r10887 | |
|---|---|---|
| 17 | 17 | ***************************************************************************/ |
| 18 | 18 | |
| 19 | 19 | #include "emu.h" |
| 20 | #include "cpu/hd6309/hd6309.h" | |
| 20 | 21 | #include "cpu/m6809/m6809.h" |
| 21 | 22 | #include "sound/2151intf.h" |
| 22 | 23 | #include "video/konicdev.h" |
| r10886 | r10887 | |
| 24 | 25 | #include "includes/contra.h" |
| 25 | 26 | |
| 26 | 27 | |
| 28 | static INTERRUPT_GEN( contra_interrupt ) | |
| 29 | { | |
| 30 | contra_state *state = device->machine->driver_data<contra_state>(); | |
| 31 | if (k007121_ctrlram_r(state->k007121_1, 7) & 0x02) | |
| 32 | cpu_set_input_line(device, HD6309_IRQ_LINE, HOLD_LINE); | |
| 33 | } | |
| 34 | ||
| 27 | 35 | static WRITE8_HANDLER( contra_bankswitch_w ) |
| 28 | 36 | { |
| 29 | if ((data & 0x0f) < 12) /* for safety */ | |
| 30 | memory_set_bank(space->machine, "bank1", data & 0x0f); | |
| 37 | memory_set_bank(space->machine, "bank1", data & 0x0f); | |
| 31 | 38 | } |
| 32 | 39 | |
| 33 | 40 | static WRITE8_HANDLER( contra_sh_irqtrigger_w ) |
| r10886 | r10887 | |
| 174 | 181 | contra_state *state = machine->driver_data<contra_state>(); |
| 175 | 182 | UINT8 *ROM = machine->region("maincpu")->base(); |
| 176 | 183 | |
| 177 | memory_configure_bank(machine, "bank1", 0, 1 | |
| 184 | memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x2000); | |
| 178 | 185 | |
| 179 | 186 | state->audiocpu = machine->device("audiocpu"); |
| 180 | 187 | state->k007121_1 = machine->device("k007121_1"); |
| r10886 | r10887 | |
| 184 | 191 | static MACHINE_CONFIG_START( contra, contra_state ) |
| 185 | 192 | |
| 186 | 193 | /* basic machine hardware */ |
| 187 | MCFG_CPU_ADD("maincpu", | |
| 194 | MCFG_CPU_ADD("maincpu", HD6309, XTAL_24MHz / | |
| 188 | 195 | MCFG_CPU_PROGRAM_MAP(contra_map) |
| 189 | MCFG_CPU_VBLANK_INT("screen", | |
| 196 | MCFG_CPU_VBLANK_INT("screen", contra | |
| 190 | 197 | |
| 191 | MCFG_CPU_ADD("audiocpu", M6809, XTAL_24MHz/ | |
| 198 | MCFG_CPU_ADD("audiocpu", M6809, XTAL_24MHz/8 | |
| 192 | 199 | MCFG_CPU_PROGRAM_MAP(sound_map) |
| 193 | 200 | |
| 194 | MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* | |
| 201 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* | |
| 195 | 202 | |
| 196 | 203 | MCFG_MACHINE_START(contra) |
| 197 | 204 | |
| r10886 | r10887 | |
| 223 | 230 | |
| 224 | 231 | |
| 225 | 232 | ROM_START( contra ) |
| 226 | ROM_REGION( 0x | |
| 233 | ROM_REGION( 0x3 | |
| 227 | 234 | ROM_LOAD( "633m03.18a", 0x20000, 0x08000, CRC(d045e1da) SHA1(ec781e98a6efb14861223250c6239b06ec98ed0b) ) |
| 228 | 235 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 229 | 236 | ROM_LOAD( "633i02.17a", 0x10000, 0x10000, CRC(b2f7bd9a) SHA1(6c29568419bc49f0be3995b0c34edd9038f6f8d9) ) |
| r10886 | r10887 | |
| 250 | 257 | ROM_END |
| 251 | 258 | |
| 252 | 259 | ROM_START( contra1 ) |
| 253 | ROM_REGION( 0x | |
| 260 | ROM_REGION( 0x3 | |
| 254 | 261 | ROM_LOAD( "633e03.18a", 0x20000, 0x08000, CRC(7fc0d8cf) SHA1(cf1cf15646a4e5dc72671e957bc51ca44d30995c) ) |
| 255 | 262 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 256 | 263 | ROM_LOAD( "633i02.17a", 0x10000, 0x10000, CRC(b2f7bd9a) SHA1(6c29568419bc49f0be3995b0c34edd9038f6f8d9) ) |
| r10886 | r10887 | |
| 277 | 284 | ROM_END |
| 278 | 285 | |
| 279 | 286 | ROM_START( contrab ) |
| 280 | ROM_REGION( 0x | |
| 287 | ROM_REGION( 0x3 | |
| 281 | 288 | ROM_LOAD( "633m03.18a", 0x20000, 0x08000, CRC(d045e1da) SHA1(ec781e98a6efb14861223250c6239b06ec98ed0b) ) |
| 282 | 289 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 283 | 290 | ROM_LOAD( "633i02.17a", 0x10000, 0x10000, CRC(b2f7bd9a) SHA1(6c29568419bc49f0be3995b0c34edd9038f6f8d9) ) |
| r10886 | r10887 | |
| 316 | 323 | ROM_END |
| 317 | 324 | |
| 318 | 325 | ROM_START( contraj ) |
| 319 | ROM_REGION( 0x | |
| 326 | ROM_REGION( 0x3 | |
| 320 | 327 | ROM_LOAD( "633n03.18a", 0x20000, 0x08000, CRC(fedab568) SHA1(7fd4546335bdeef7f8326d4cbde7fa36d74e5cfc) ) |
| 321 | 328 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 322 | 329 | ROM_LOAD( "633k02.17a", 0x10000, 0x10000, CRC(5d5f7438) SHA1(489fe56ca57ef4f6a7792fba07a9656009f3f285) ) |
| r10886 | r10887 | |
| 343 | 350 | ROM_END |
| 344 | 351 | |
| 345 | 352 | ROM_START( contrajb ) |
| 346 | ROM_REGION( 0x | |
| 353 | ROM_REGION( 0x3 | |
| 347 | 354 | ROM_LOAD( "g-2.18a", 0x20000, 0x08000, CRC(bdb9196d) SHA1(fad170e8fda94c9c9d7b82433daa30b80af12efc) ) |
| 348 | 355 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 349 | 356 | ROM_LOAD( "633k02.17a", 0x10000, 0x10000, CRC(5d5f7438) SHA1(489fe56ca57ef4f6a7792fba07a9656009f3f285) ) |
| r10886 | r10887 | |
| 382 | 389 | ROM_END |
| 383 | 390 | |
| 384 | 391 | ROM_START( gryzor ) |
| 385 | ROM_REGION( 0x | |
| 392 | ROM_REGION( 0x3 | |
| 386 | 393 | ROM_LOAD( "g2.18a", 0x20000, 0x08000, CRC(92ca77bd) SHA1(3a56f51a617edff9f2a60df0141dff040881b82a) ) |
| 387 | 394 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 388 | 395 | ROM_LOAD( "g3.17a", 0x10000, 0x10000, CRC(bbd9e95e) SHA1(fd5de1bcc485de7b8fc2e321351c2e3ddd25d053) ) |
| r10886 | r10887 | |
| 409 | 416 | ROM_END |
| 410 | 417 | |
| 411 | 418 | ROM_START( gryzora ) |
| 412 | ROM_REGION( 0x | |
| 419 | ROM_REGION( 0x3 | |
| 413 | 420 | ROM_LOAD( "633j03.18a", 0x20000, 0x08000, CRC(20919162) SHA1(2f375166428ee03f6e8ac0372a373bb8ab35e64c) ) |
| 414 | 421 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 415 | 422 | ROM_LOAD( "633j02.17a", 0x10000, 0x10000, CRC(b5922f9a) SHA1(441a23dc99a908ec2c09c855e73070dbab8c5ae2) ) |
| r10886 | r10887 | |
|---|---|---|
| 57 | 57 | #include "sound/upd7759.h" |
| 58 | 58 | |
| 59 | 59 | |
| 60 | static int test_x, test_y, start_offs; | |
| 60 | class itgambl2_state : public driver_device | |
| 61 | { | |
| 62 | public: | |
| 63 | itgambl2_state(running_machine &machine, const driver_device_config_base &config) | |
| 64 | : driver_device(machine, config) { } | |
| 61 | 65 | |
| 66 | int test_x; | |
| 67 | int test_y; | |
| 68 | int start_offs; | |
| 69 | }; | |
| 70 | ||
| 71 | ||
| 62 | 72 | /************************* |
| 63 | 73 | * Video Hardware * |
| 64 | 74 | *************************/ |
| 65 | 75 | |
| 66 | 76 | static VIDEO_START( itgambl2 ) |
| 67 | 77 | { |
| 68 | test_x = 256; | |
| 69 | test_y = 256; | |
| 70 | start_offs = 0; | |
| 78 | itgambl2_state *state = machine->driver_data<itgambl2_state>(); | |
| 79 | state->test_x = 256; | |
| 80 | state->test_y = 256; | |
| 81 | state->start_offs = 0; | |
| 71 | 82 | } |
| 72 | 83 | |
| 73 | 84 | /* (dirty) debug code for looking 8bpps blitter-based gfxs */ |
| 74 | 85 | static SCREEN_UPDATE( itgambl2 ) |
| 75 | 86 | { |
| 87 | itgambl2_state *state = screen->machine->driver_data<itgambl2_state>(); | |
| 76 | 88 | int x,y,count; |
| 77 | 89 | const UINT8 *blit_ram = screen->machine->region("gfx1")->base(); |
| 78 | 90 | |
| 79 | 91 | if(input_code_pressed(screen->machine, KEYCODE_Z)) |
| 80 | test_x++; | |
| 92 | state->test_x++; | |
| 81 | 93 | |
| 82 | 94 | if(input_code_pressed(screen->machine, KEYCODE_X)) |
| 83 | test_x--; | |
| 95 | state->test_x--; | |
| 84 | 96 | |
| 85 | 97 | if(input_code_pressed(screen->machine, KEYCODE_A)) |
| 86 | test_y++; | |
| 98 | state->test_y++; | |
| 87 | 99 | |
| 88 | 100 | if(input_code_pressed(screen->machine, KEYCODE_S)) |
| 89 | test_y--; | |
| 101 | state->test_y--; | |
| 90 | 102 | |
| 91 | 103 | if(input_code_pressed(screen->machine, KEYCODE_Q)) |
| 92 | start_offs+=0x200; | |
| 104 | state->start_offs+=0x200; | |
| 93 | 105 | |
| 94 | 106 | if(input_code_pressed(screen->machine, KEYCODE_W)) |
| 95 | start_offs-=0x200; | |
| 107 | state->start_offs-=0x200; | |
| 96 | 108 | |
| 97 | 109 | if(input_code_pressed(screen->machine, KEYCODE_E)) |
| 98 | start_offs++; | |
| 110 | state->start_offs++; | |
| 99 | 111 | |
| 100 | 112 | if(input_code_pressed(screen->machine, KEYCODE_R)) |
| 101 | start_offs--; | |
| 113 | state->start_offs--; | |
| 102 | 114 | |
| 103 | popmessage("%d %d %04x",test_x,test_y,start_offs); | |
| 115 | popmessage("%d %d %04x",state->test_x,state->test_y,state->start_offs); | |
| 104 | 116 | |
| 105 | 117 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 106 | 118 | |
| 107 | count = (start_offs); | |
| 119 | count = (state->start_offs); | |
| 108 | 120 | |
| 109 | for(y=0;y<test_y;y++) | |
| 121 | for(y=0;y<state->test_y;y++) | |
| 110 | 122 | { |
| 111 | for(x=0;x<test_x;x++) | |
| 123 | for(x=0;x<state->test_x;x++) | |
| 112 | 124 | { |
| 113 | 125 | UINT32 color; |
| 114 | 126 | |
| r10886 | r10887 | |
| 247 | 259 | * Machine Drivers * |
| 248 | 260 | **************************/ |
| 249 | 261 | |
| 250 | static MACHINE_CONFIG_START( itgambl2, | |
| 262 | static MACHINE_CONFIG_START( itgambl2, | |
| 251 | 263 | |
| 252 | 264 | /* basic machine hardware */ |
| 253 | 265 | MCFG_CPU_ADD("maincpu", H83044, MAIN_CLOCK) /* wrong CPU, but we have not a H8/3337 core ATM */ |
| r10886 | r10887 | |
|---|---|---|
| 30 | 30 | #include "sound/ay8910.h" |
| 31 | 31 | #include "cpu/mcs48/mcs48.h" |
| 32 | 32 | |
| 33 | ||
| 34 | class drw80pkr_state : public driver_device | |
| 35 | { | |
| 36 | public: | |
| 37 | drw80pkr_state(running_machine &machine, const driver_device_config_base &config) | |
| 38 | : driver_device(machine, config) { } | |
| 39 | ||
| 40 | tilemap_t *bg_tilemap; | |
| 41 | UINT8 t0; | |
| 42 | UINT8 t1; | |
| 43 | UINT8 p0; | |
| 44 | UINT8 p1; | |
| 45 | UINT8 p2; | |
| 46 | UINT8 prog; | |
| 47 | UINT8 bus; | |
| 48 | UINT8 attract_mode; | |
| 49 | UINT8 active_bank; | |
| 50 | UINT8 pkr_io_ram[0x100]; | |
| 51 | UINT16 video_ram[0x0400]; | |
| 52 | UINT8 color_ram[0x0400]; | |
| 53 | }; | |
| 54 | ||
| 55 | ||
| 33 | 56 | #define CPU_CLOCK XTAL_8MHz |
| 34 | 57 | #define DATA_NVRAM_SIZE 0x100 |
| 35 | 58 | |
| 36 | static tilemap_t *bg_tilemap; | |
| 37 | 59 | |
| 38 | static UINT8 t0, t1, p0, p1, p2, prog, bus; | |
| 39 | static UINT8 attract_mode = 0; | |
| 40 | static UINT8 active_bank = 0; | |
| 41 | ||
| 42 | static UINT8 pkr_io_ram[0x100]; | |
| 43 | static UINT16 video_ram[0x0400]; | |
| 44 | static UINT8 color_ram[0x0400]; | |
| 45 | ||
| 46 | 60 | static MACHINE_START( drw80pkr ) |
| 47 | 61 | { |
| 48 | machine->device<nvram_device>("nvram")->set_base(pkr_io_ram, sizeof(pkr_io_ram)); | |
| 62 | drw80pkr_state *state = machine->driver_data<drw80pkr_state>(); | |
| 63 | machine->device<nvram_device>("nvram")->set_base(state->pkr_io_ram, sizeof(state->pkr_io_ram)); | |
| 49 | 64 | } |
| 50 | 65 | |
| 51 | 66 | /***************** |
| r10886 | r10887 | |
| 54 | 69 | |
| 55 | 70 | static WRITE8_HANDLER( t0_w ) |
| 56 | 71 | { |
| 57 | t0 = data; | |
| 72 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 73 | state->t0 = data; | |
| 58 | 74 | } |
| 59 | 75 | |
| 60 | 76 | static WRITE8_HANDLER( t1_w ) |
| 61 | 77 | { |
| 62 | t1 = data; | |
| 78 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 79 | state->t1 = data; | |
| 63 | 80 | } |
| 64 | 81 | |
| 65 | 82 | static WRITE8_HANDLER( p0_w ) |
| 66 | 83 | { |
| 67 | p0 = data; | |
| 84 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 85 | state->p0 = data; | |
| 68 | 86 | } |
| 69 | 87 | |
| 70 | 88 | static WRITE8_HANDLER( p1_w ) |
| 71 | 89 | { |
| 72 | p1 = data; | |
| 90 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 91 | state->p1 = data; | |
| 73 | 92 | } |
| 74 | 93 | |
| 75 | 94 | static WRITE8_HANDLER( p2_w ) |
| 76 | 95 | { |
| 77 | p2 = data; | |
| 96 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 97 | state->p2 = data; | |
| 78 | 98 | } |
| 79 | 99 | |
| 80 | 100 | static WRITE8_HANDLER( prog_w ) |
| 81 | 101 | { |
| 82 | prog = data; | |
| 102 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 103 | state->prog = data; | |
| 83 | 104 | |
| 84 | 105 | // Bankswitch Program Memory |
| 85 | if (prog == 0x01) | |
| 106 | if (state->prog == 0x01) | |
| 86 | 107 | { |
| 87 | active_bank = active_bank ^ 0x01; | |
| 108 | state->active_bank = state->active_bank ^ 0x01; | |
| 88 | 109 | |
| 89 | memory_set_bank(space->machine, "bank1", active_bank); | |
| 110 | memory_set_bank(space->machine, "bank1", state->active_bank); | |
| 90 | 111 | } |
| 91 | 112 | } |
| 92 | 113 | |
| 93 | 114 | static WRITE8_HANDLER( bus_w ) |
| 94 | 115 | { |
| 95 | bus = data; | |
| 116 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 117 | state->bus = data; | |
| 96 | 118 | } |
| 97 | 119 | |
| 98 | 120 | static WRITE8_HANDLER( drw80pkr_io_w ) |
| 99 | 121 | { |
| 122 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 100 | 123 | UINT16 n_offs; |
| 101 | 124 | |
| 102 | if (p2 == 0x3f || p2 == 0x7f) | |
| 125 | if (state->p2 == 0x3f || state->p2 == 0x7f) | |
| 103 | 126 | { |
| 104 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 127 | n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 105 | 128 | |
| 106 | if (p2 == 0x3f) | |
| 129 | if (state->p2 == 0x3f) | |
| 107 | 130 | { |
| 108 | video_ram[n_offs] = data; // low address | |
| 131 | state->video_ram[n_offs] = data; // low address | |
| 109 | 132 | } else { |
| 110 | color_ram[n_offs] = data & 0x0f; // color palette | |
| 111 | video_ram[n_offs] += ((data & 0xf0) << 4 ); // high address | |
| 133 | state->color_ram[n_offs] = data & 0x0f; // color palette | |
| 134 | state->video_ram[n_offs] += ((data & 0xf0) << 4 ); // high address | |
| 112 | 135 | } |
| 113 | 136 | |
| 114 | tilemap_mark_tile_dirty(bg_tilemap, n_offs); | |
| 137 | tilemap_mark_tile_dirty(state->bg_tilemap, n_offs); | |
| 115 | 138 | } |
| 116 | 139 | |
| 117 | if (p2 == 0xc7) | |
| 140 | if (state->p2 == 0xc7) | |
| 118 | 141 | { |
| 119 | 142 | // CRTC Register |
| 120 | 143 | // R0 = 0x1f(31) Horizontal Total |
| r10886 | r10887 | |
| 138 | 161 | // R13 = 0x00 Display Start Address (Low) |
| 139 | 162 | } |
| 140 | 163 | |
| 141 | if (p2 == 0xd7) | |
| 164 | if (state->p2 == 0xd7) | |
| 142 | 165 | { |
| 143 | 166 | // CRTC Address |
| 144 | 167 | } |
| 145 | 168 | |
| 146 | if (p2 == 0xfb) { | |
| 147 | pkr_io_ram[offset] = data; | |
| 169 | if (state->p2 == 0xfb) { | |
| 170 | state->pkr_io_ram[offset] = data; | |
| 148 | 171 | } |
| 149 | 172 | |
| 150 | if (p2 == 0xff) | |
| 173 | if (state->p2 == 0xff) | |
| 151 | 174 | { |
| 152 | if (p1 == 0xdf) | |
| 175 | if (state->p1 == 0xdf) | |
| 153 | 176 | { |
| 154 | attract_mode = data; // Latch this for use in input reads (0x01 = attract mode, 0x00 = game in progress) | |
| 177 | state->attract_mode = data; // Latch this for use in input reads (0x01 = attract mode, 0x00 = game in progress) | |
| 155 | 178 | } |
| 156 | 179 | |
| 157 | if (p1 == 0xdb || p1 == 0xef || p1 == 0xf7 || p1 == 0xfb) | |
| 180 | if (state->p1 == 0xdb || state->p1 == 0xef || state->p1 == 0xf7 || state->p1 == 0xfb) | |
| 158 | 181 | { |
| 159 | 182 | // unknown, most likely lamps, meters, hopper etc. |
| 160 | 183 | } |
| 161 | 184 | |
| 162 | 185 | // ay8910 control port |
| 163 | if (p1 == 0xfc) | |
| 186 | if (state->p1 == 0xfc) | |
| 164 | 187 | ay8910_address_w(space->machine->device("aysnd"), 0, data); |
| 165 | 188 | |
| 166 | 189 | // ay8910_write_port_0_w |
| 167 | if (p1 == 0xfe) | |
| 190 | if (state->p1 == 0xfe) | |
| 168 | 191 | ay8910_data_w(space->machine->device("aysnd"), 0, data); |
| 169 | 192 | } |
| 170 | 193 | } |
| r10886 | r10887 | |
| 175 | 198 | |
| 176 | 199 | static READ8_HANDLER( t0_r ) |
| 177 | 200 | { |
| 178 | return t0; | |
| 201 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 202 | return state->t0; | |
| 179 | 203 | } |
| 180 | 204 | |
| 181 | 205 | static READ8_HANDLER( t1_r ) |
| 182 | 206 | { |
| 183 | return t1; | |
| 207 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 208 | return state->t1; | |
| 184 | 209 | } |
| 185 | 210 | |
| 186 | 211 | static READ8_HANDLER( p0_r ) |
| 187 | 212 | { |
| 188 | return p0; | |
| 213 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 214 | return state->p0; | |
| 189 | 215 | } |
| 190 | 216 | |
| 191 | 217 | static READ8_HANDLER( p1_r ) |
| 192 | 218 | { |
| 193 | return p1; | |
| 219 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 220 | return state->p1; | |
| 194 | 221 | } |
| 195 | 222 | |
| 196 | 223 | static READ8_HANDLER( p2_r ) |
| 197 | 224 | { |
| 198 | return p2; | |
| 225 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 226 | return state->p2; | |
| 199 | 227 | } |
| 200 | 228 | |
| 201 | 229 | static READ8_HANDLER( bus_r ) |
| 202 | 230 | { |
| 203 | return bus; | |
| 231 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 232 | return state->bus; | |
| 204 | 233 | } |
| 205 | 234 | |
| 206 | 235 | static READ8_HANDLER( drw80pkr_io_r ) |
| 207 | 236 | { |
| 237 | drw80pkr_state *state = space->machine->driver_data<drw80pkr_state>(); | |
| 208 | 238 | UINT8 ret; |
| 209 | 239 | UINT16 kbdin; |
| 210 | 240 | |
| 211 | 241 | ret = 0x00; |
| 212 | 242 | |
| 213 | if (p2 == 0x3b) | |
| 243 | if (state->p2 == 0x3b) | |
| 214 | 244 | { |
| 215 | 245 | // unknown |
| 216 | 246 | } |
| 217 | 247 | |
| 218 | if (p2 == 0x7b) | |
| 248 | if (state->p2 == 0x7b) | |
| 219 | 249 | { |
| 220 | ret = pkr_io_ram[offset]; | |
| 250 | ret = state->pkr_io_ram[offset]; | |
| 221 | 251 | } |
| 222 | 252 | |
| 223 | if (p2 == 0xf7) | |
| 253 | if (state->p2 == 0xf7) | |
| 224 | 254 | { |
| 225 | 255 | // unknown |
| 226 | 256 | } |
| 227 | 257 | |
| 228 | if (p2 == 0xfb) | |
| 258 | if (state->p2 == 0xfb) | |
| 229 | 259 | { |
| 230 | ret = pkr_io_ram[offset]; | |
| 260 | ret = state->pkr_io_ram[offset]; | |
| 231 | 261 | } |
| 232 | 262 | |
| 233 | if (p2 == 0xff) | |
| 263 | if (state->p2 == 0xff) | |
| 234 | 264 | { |
| 235 | if (p1 == 0x5f || p1 == 0x9f || p1 == 0xdb) | |
| 265 | if (state->p1 == 0x5f || state->p1 == 0x9f || state->p1 == 0xdb) | |
| 236 | 266 | { |
| 237 | 267 | // unknown |
| 238 | 268 | } |
| 239 | 269 | |
| 240 | if (p1 == 0xfe) | |
| 270 | if (state->p1 == 0xfe) | |
| 241 | 271 | { |
| 242 | 272 | // Dip switches tied to sound chip |
| 243 | 273 | // |
| r10886 | r10887 | |
| 250 | 280 | ret = 0x77; // double-up with credit payout |
| 251 | 281 | } |
| 252 | 282 | |
| 253 | if ((attract_mode == 0x01 && p1 == 0xef) || p1 == 0xf7) | |
| 283 | if ((state->attract_mode == 0x01 && state->p1 == 0xef) || state->p1 == 0xf7) | |
| 254 | 284 | { |
| 255 | 285 | |
| 256 | 286 | // TODO: Get Input Port Values |
| r10886 | r10887 | |
| 294 | 324 | |
| 295 | 325 | static TILE_GET_INFO( get_bg_tile_info ) |
| 296 | 326 | { |
| 297 | int color = color_ram[tile_index]; | |
| 298 | int code = video_ram[tile_index]; | |
| 327 | drw80pkr_state *state = machine->driver_data<drw80pkr_state>(); | |
| 328 | int color = state->color_ram[tile_index]; | |
| 329 | int code = state->video_ram[tile_index]; | |
| 299 | 330 | |
| 300 | 331 | SET_TILE_INFO(0, code, color, 0); |
| 301 | 332 | } |
| 302 | 333 | |
| 303 | 334 | static VIDEO_START( drw80pkr ) |
| 304 | 335 | { |
| 305 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 27); | |
| 336 | drw80pkr_state *state = machine->driver_data<drw80pkr_state>(); | |
| 337 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 27); | |
| 306 | 338 | } |
| 307 | 339 | |
| 308 | 340 | static SCREEN_UPDATE( drw80pkr ) |
| 309 | 341 | { |
| 310 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 342 | drw80pkr_state *state = screen->machine->driver_data<drw80pkr_state>(); | |
| 343 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 311 | 344 | |
| 312 | 345 | return 0; |
| 313 | 346 | } |
| r10886 | r10887 | |
| 426 | 459 | * Machine Driver * |
| 427 | 460 | *************************/ |
| 428 | 461 | |
| 429 | static MACHINE_CONFIG_START( drw80pkr, dr | |
| 462 | static MACHINE_CONFIG_START( drw80pkr, drw80pkr_stat | |
| 430 | 463 | // basic machine hardware |
| 431 | 464 | MCFG_CPU_ADD("maincpu", I8039, CPU_CLOCK) |
| 432 | 465 | MCFG_CPU_PROGRAM_MAP(drw80pkr_map) |
| r10886 | r10887 | |
|---|---|---|
| 724 | 724 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)2) |
| 725 | 725 | |
| 726 | 726 | PORT_START("SERVICESW") |
| 727 | PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) | |
| 727 | PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_CHANGED(service_switch, 0) | |
| 728 | 728 | |
| 729 | 729 | PORT_START("DSW02") |
| 730 | 730 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) ) |
| r10886 | r10887 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | /***************************************************************************************/ |
| 58 | 58 | |
| 59 | static UINT8 bbx_sound_enable; | |
| 60 | static UINT8 sound_latch; | |
| 61 | ||
| 62 | /***************************************************************************************/ | |
| 63 | ||
| 64 | 59 | static WRITE8_HANDLER( shangkid_maincpu_bank_w ) |
| 65 | 60 | { |
| 66 | 61 | memory_set_bank(space->machine, "bank1", data & 1); |
| r10886 | r10887 | |
| 85 | 80 | |
| 86 | 81 | static WRITE8_HANDLER( shangkid_sound_enable_w ) |
| 87 | 82 | { |
| 88 | bbx_sound_enable = data; | |
| 83 | shangkid_state *state = space->machine->driver_data<shangkid_state>(); | |
| 84 | state->bbx_sound_enable = data; | |
| 89 | 85 | } |
| 90 | 86 | |
| 91 | 87 | static WRITE8_DEVICE_HANDLER( chinhero_ay8910_porta_w ) |
| 92 | 88 | { |
| 93 | if( bbx_sound_enable ) | |
| 89 | shangkid_state *state = device->machine->driver_data<shangkid_state>(); | |
| 90 | if( state->bbx_sound_enable ) | |
| 94 | 91 | { |
| 95 | 92 | if( data == 0x01 ) |
| 96 | 93 | /* 0->1 transition triggers interrupt on Sound CPU */ |
| r10886 | r10887 | |
| 100 | 97 | |
| 101 | 98 | static WRITE8_DEVICE_HANDLER( shangkid_ay8910_porta_w ) |
| 102 | 99 | { |
| 103 | if( bbx_sound_enable ) | |
| 100 | shangkid_state *state = device->machine->driver_data<shangkid_state>(); | |
| 101 | if( state->bbx_sound_enable ) | |
| 104 | 102 | { |
| 105 | 103 | if( data == 0x01 ) |
| 106 | 104 | /* 0->1 transition triggers interrupt on Sound CPU */ |
| r10886 | r10887 | |
| 112 | 110 | |
| 113 | 111 | static WRITE8_DEVICE_HANDLER( ay8910_portb_w ) |
| 114 | 112 | { |
| 115 | sound_latch = data; | |
| 113 | shangkid_state *state = device->machine->driver_data<shangkid_state>(); | |
| 114 | state->sound_latch = data; | |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | 117 | /***************************************************************************************/ |
| 119 | 118 | |
| 120 | 119 | static READ8_HANDLER( shangkid_soundlatch_r ) |
| 121 | 120 | { |
| 122 | return sound_latch; | |
| 121 | shangkid_state *state = space->machine->driver_data<shangkid_state>(); | |
| 122 | return state->sound_latch; | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /***************************************************************************************/ |
| 126 | 126 | |
| 127 | 127 | static DRIVER_INIT( chinhero ) |
| 128 | 128 | { |
| 129 | shangkid_gfx_type = 0; | |
| 129 | shangkid_state *state = machine->driver_data<shangkid_state>(); | |
| 130 | state->gfx_type = 0; | |
| 130 | 131 | } |
| 131 | 132 | |
| 132 | 133 | static DRIVER_INIT( shangkid ) |
| 133 | 134 | { |
| 134 | shangkid_gfx_type = 1; | |
| 135 | shangkid_state *state = machine->driver_data<shangkid_state>(); | |
| 136 | state->gfx_type = 1; | |
| 135 | 137 | |
| 136 | 138 | /* set up banking */ |
| 137 | 139 | memory_configure_bank(machine, "bank1", 0, 2, machine->region("maincpu")->base() + 0x8000, 0x8000); |
| r10886 | r10887 | |
| 246 | 248 | AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM") |
| 247 | 249 | AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2") |
| 248 | 250 | AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1") |
| 249 | AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_BASE( | |
| 251 | AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_BASE_MEMBER( | |
| 250 | 252 | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_BASE_MEMBER(shangkid_state, videoram) AM_SHARE("share1") |
| 251 | 253 | AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2") |
| 252 | 254 | AM_RANGE(0xfe00, 0xffff) AM_RAM AM_BASE_MEMBER(shangkid_state, spriteram) AM_SHARE("share3") |
| r10886 | r10887 | |
| 267 | 269 | AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM") |
| 268 | 270 | AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2") |
| 269 | 271 | AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1") |
| 270 | AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_BASE( | |
| 272 | AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_BASE_MEMBER( | |
| 271 | 273 | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_BASE_MEMBER(shangkid_state, videoram) AM_SHARE("share1") |
| 272 | 274 | AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2") |
| 273 | 275 | AM_RANGE(0xfe00, 0xffff) AM_RAM AM_BASE_MEMBER(shangkid_state, spriteram) AM_SHARE("share3") |
| r10886 | r10887 | |
|---|---|---|
| 2 | 2 | ATV Track |
| 3 | 3 | (c)2002 Gaelco |
| 4 | 4 | |
| 5 | 2x SH4 (HD64177506), bus clock of 33 MHz | |
| 6 | There is a chip hidden under a heatsink with RAM connected, probably GFX | |
| 5 | ATV Track | |
| 6 | Gaelco 2002 | |
| 7 | ||
| 8 | PCB Layout | |
| 9 | ||
| 10 | GAELCO | |
| 11 | REF. 020419 | |
| 12 | |--------------------------------------------------------------| | |
| 13 | | | | |
| 14 | | SW3 EPC1PC8 | | |
| 15 | | K4S643232 | | |
| 16 | | LC245A 7LB176 |-| | |
| 17 | | FLASH.IC14 FLASH.IC19 7LB176 | | | |
| 18 | | |-----| 7LB176 | |DB9 | |
| 19 | | | SH4 | 7LB176 |-| | |
| 20 | | | | FLASH.IC15 FLASH.IC20 | | |
| 21 | | |-----| | | |
| 22 | | |----------| | | |
| 23 | |-| K4S643232 |ALTERA | | | |
| 24 | | | L4955 |FLEX | | | |
| 25 | | | |-----| K4S643232 |EPF10K50 | | | |
| 26 | | |CN1 | SH4 | |EQC240-3 | | | |
| 27 | | | | | |----------| | | |
| 28 | | | |-----| | | |
| 29 | |-| | | |
| 30 | | | | |
| 31 | | 33MHz K4S643232 |----------| | | |
| 32 | | K4S643232 | GFX | | | |
| 33 | | LED | | |-| | |
| 34 | | LED | | | | | |
| 35 | | K4S643232 | | | |DB9 | |
| 36 | | K4S643232 |----------| |-| | |
| 37 | | TL074C TL074C 385-1 | | |
| 38 | | TDA1387 TDA1387 14.31818MHz | | |
| 39 | | | | |
| 40 | |--------------------------------------------------------------| | |
| 41 | Notes: | |
| 42 | SH4 - Hitachi HD6417750S SH4 CPU (BGA) | |
| 43 | K4S643232 - Samsung K4S643232E-TC70 64M x 32-bit SDRAM (TSSOP86) | |
| 44 | GFX - Unknown BGA graphics chip (heatsinked) | |
| 45 | FLASH.IC* - Samsung K9F2808U0B 128MBit (16M + 512k Spare x 8-bit) FlashROM (TSOP48) | |
| 46 | EPF10K50 - Altera Flex EPF10K50EQC240-3 FPGA (QFP240) | |
| 47 | EPC1PC8 - Altera EPC1PC8 FPGA Configuration Device (DIP8) | |
| 48 | TL074C - Texas Instruments TL074C Low Noise Quad JFet Operational Amplifier (SOIC14) | |
| 49 | TDA1387 - Philips TDA1387 Stereo Continuous Calibration DAC (SOIC8) | |
| 50 | L4955 - ST Microelectronics L4955 low-power, quad channel, 8-bit buffered voltage output DAC and amplifier | |
| 51 | 7LB176 - Texas Instruments 7LB176 Differential Bus Tranceiver (SOIC8) | |
| 52 | 385-1 - National LM385 Adjustable Micropower Voltage Reference Diode (SOIC8) | |
| 53 | CN1 - Multi-pin connector for filter board (input power & controls connectors etc) | |
| 54 | DB9 - Video output connector (for twin monitors) | |
| 55 | SW3 - Push button switch | |
| 56 | ||
| 7 | 57 | */ |
| 8 | 58 | |
| 9 | 59 | #include "emu.h" |
| r10886 | r10887 | |
| 67 | 117 | ROM_LOAD32_BYTE("20.bin", 0x0000001, 0x1080000, CRC(649dc331) SHA1(0cac2d0c15dd564c7fdebdf4365422958f453d63) ) |
| 68 | 118 | ROM_LOAD32_BYTE("14.bin", 0x0000002, 0x1080000, CRC(67983453) SHA1(05389a0ffc1a1bae9bac16a53a97d78b6eccc626) ) |
| 69 | 119 | ROM_LOAD32_BYTE("19.bin", 0x0000003, 0x1080000, CRC(9fc5c579) SHA1(8829329ef229564952aea2108ef1750dc226cbac) ) |
| 120 | ||
| 121 | ROM_REGION( 0x20000, "eeprom", ROMREGION_ERASEFF) | |
| 122 | ROM_LOAD("epc1pc8.ic23", 0x0000000, 0x1ff01, CRC(752444c7) SHA1(c77e8fcfcbe15b53eda25553763bdac45f0ef7df) ) // contains a large amount of data, maybe used for some form of protection | |
| 70 | 123 | ROM_END |
| 71 | 124 | |
| 72 | GAME( 2002, atvtrack, 0, atvtrack, atvtrack, 0, ROT0, "Gaelco", "ATV Track", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 125 | ROM_START( atvtracka ) | |
| 126 | ROM_REGION( 0x4200000, "maincpu", ROMREGION_ERASEFF) // NAND roms, contain additional data hence the sizes | |
| 127 | ROM_LOAD32_BYTE("k9f2808u0b.ic15", 0x0000000, 0x1080000, CRC(10730001) SHA1(48c685a6ff7135abd074dc7fb7d10834c44da58f) ) | |
| 128 | ROM_LOAD32_BYTE("k9f2808u0b.ic20", 0x0000001, 0x1080000, CRC(b0c34433) SHA1(852c79bb3d7082cd2c056140071ae7d71679ec1d) ) | |
| 129 | ROM_LOAD32_BYTE("k9f2808u0b.ic14", 0x0000002, 0x1080000, CRC(02a12085) SHA1(acb112c9c7b29d92610465fb92268ce787ca06f4) ) | |
| 130 | ROM_LOAD32_BYTE("k9f2808u0b.ic19", 0x0000003, 0x1080000, CRC(856c1e6a) SHA1(a6b2839120d61811c36cc6b4095de9cefceb394b) ) | |
| 131 | ROM_END | |
| 132 | ||
| 133 | GAME( 2002, atvtrack, 0, atvtrack, atvtrack, 0, ROT0, "Gaelco", "ATV Track (set 1)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 134 | GAME( 2002, atvtracka, atvtrack, atvtrack, atvtrack, 0, ROT0, "Gaelco", "ATV Track (set 2)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 165 | 165 | #include "sound/8950intf.h" |
| 166 | 166 | #include "rendlay.h" |
| 167 | 167 | |
| 168 | static tilemap_t *tx_tilemap; | |
| 169 | static UINT16 *tx_vram,*bg_vram,*fg_vram,*spr_ram; | |
| 170 | static UINT16 *io_ram; | |
| 171 | static UINT16 *cybertnk_roadram; | |
| 172 | 168 | |
| 169 | class cybertnk_state : public driver_device | |
| 170 | { | |
| 171 | public: | |
| 172 | cybertnk_state(running_machine &machine, const driver_device_config_base &config) | |
| 173 | : driver_device(machine, config) { } | |
| 174 | ||
| 175 | tilemap_t *tx_tilemap; | |
| 176 | UINT16 *tx_vram; | |
| 177 | UINT16 *bg_vram; | |
| 178 | UINT16 *fg_vram; | |
| 179 | UINT16 *spr_ram; | |
| 180 | UINT16 *io_ram; | |
| 181 | UINT16 *roadram; | |
| 182 | int test_x; | |
| 183 | int test_y; | |
| 184 | int start_offs; | |
| 185 | int color_pen; | |
| 186 | }; | |
| 187 | ||
| 188 | ||
| 173 | 189 | #define LOG_UNKNOWN_WRITE logerror("unknown io write CPU '%s':%08x 0x%08x 0x%04x & 0x%04x\n", space->cpu->tag(), cpu_get_pc(space->cpu), offset*2, data, mem_mask); |
| 174 | 190 | |
| 175 | 191 | static TILE_GET_INFO( get_tx_tile_info ) |
| 176 | 192 | { |
| 177 | int code = tx_vram[tile_index]; | |
| 193 | cybertnk_state *state = machine->driver_data<cybertnk_state>(); | |
| 194 | int code = state->tx_vram[tile_index]; | |
| 178 | 195 | SET_TILE_INFO( |
| 179 | 196 | 0, |
| 180 | 197 | code & 0x1fff, |
| r10886 | r10887 | |
| 184 | 201 | |
| 185 | 202 | static VIDEO_START( cybertnk ) |
| 186 | 203 | { |
| 187 | tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8,128,32); | |
| 188 | tilemap_set_transparent_pen(tx_tilemap,0); | |
| 204 | cybertnk_state *state = machine->driver_data<cybertnk_state>(); | |
| 205 | state->tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8,128,32); | |
| 206 | tilemap_set_transparent_pen(state->tx_tilemap,0); | |
| 189 | 207 | } |
| 190 | 208 | |
| 191 | 209 | static void draw_pixel( bitmap_t* bitmap, const rectangle *cliprect, int y, int x, int pen) |
| r10886 | r10887 | |
| 200 | 218 | |
| 201 | 219 | static SCREEN_UPDATE( cybertnk ) |
| 202 | 220 | { |
| 221 | cybertnk_state *state = screen->machine->driver_data<cybertnk_state>(); | |
| 203 | 222 | device_t *left_screen = screen->machine->device("lscreen"); |
| 204 | 223 | device_t *right_screen = screen->machine->device("rscreen"); |
| 205 | 224 | int screen_shift = 0; |
| r10886 | r10887 | |
| 214 | 233 | screen_shift = -256; |
| 215 | 234 | } |
| 216 | 235 | |
| 217 | tilemap_set_scrolldx(tx_tilemap, screen_shift, screen_shift); | |
| 236 | tilemap_set_scrolldx(state->tx_tilemap, screen_shift, screen_shift); | |
| 218 | 237 | |
| 219 | 238 | |
| 220 | 239 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| r10886 | r10887 | |
| 226 | 245 | |
| 227 | 246 | for (i=0;i<0x1000/4;i+=4) |
| 228 | 247 | { |
| 229 | UINT16 param1 = cybertnk_roadram[i+2]; | |
| 230 | UINT16 param2 = cybertnk_roadram[i+0]; | |
| 248 | UINT16 param1 = state->roadram[i+2]; | |
| 249 | UINT16 param2 = state->roadram[i+0]; | |
| 231 | 250 | |
| 232 | 251 | drawgfx_transpen(bitmap,cliprect,gfx,param1,0,0,0,-param2+screen_shift,i/4,0); |
| 233 | 252 | |
| r10886 | r10887 | |
| 247 | 266 | { |
| 248 | 267 | for (x=0;x<128;x++) |
| 249 | 268 | { |
| 250 | UINT16 tile = bg_vram[count] & 0x1fff; | |
| 251 | UINT16 color = (fg_vram[count] & 0xe000) >> 13; | |
| 269 | UINT16 tile = state->bg_vram[count] & 0x1fff; | |
| 270 | UINT16 color = (state->fg_vram[count] & 0xe000) >> 13; | |
| 252 | 271 | |
| 253 | 272 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color+0x194,0,0,(x*8)+screen_shift,(y*8),0); |
| 254 | 273 | |
| r10886 | r10887 | |
| 268 | 287 | { |
| 269 | 288 | for (x=0;x<128;x++) |
| 270 | 289 | { |
| 271 | UINT16 tile = fg_vram[count] & 0x1fff; | |
| 272 | UINT16 color = (fg_vram[count] & 0xe000) >> 13; | |
| 290 | UINT16 tile = state->fg_vram[count] & 0x1fff; | |
| 291 | UINT16 color = (state->fg_vram[count] & 0xe000) >> 13; | |
| 273 | 292 | |
| 274 | 293 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color+0x1c0,0,0,(x*8)+screen_shift,(y*8),0); |
| 275 | 294 | |
| r10886 | r10887 | |
| 289 | 308 | |
| 290 | 309 | for(offs=0;offs<0x1000/2;offs+=8) |
| 291 | 310 | { |
| 292 | z = (spr_ram[offs+(0x6/2)] & 0xffff); | |
| 293 | if(z == 0xffff || spr_ram[offs+(0x0/2)] == 0x0000) //TODO: check the correct bit | |
| 311 | z = (state->spr_ram[offs+(0x6/2)] & 0xffff); | |
| 312 | if(z == 0xffff || state->spr_ram[offs+(0x0/2)] == 0x0000) //TODO: check the correct bit | |
| 294 | 313 | continue; |
| 295 | x = (spr_ram[offs+(0xa/2)] & 0x3ff); | |
| 296 | y = (spr_ram[offs+(0x4/2)] & 0xff); | |
| 297 | if(spr_ram[offs+(0x4/2)] & 0x100) | |
| 314 | x = (state->spr_ram[offs+(0xa/2)] & 0x3ff); | |
| 315 | y = (state->spr_ram[offs+(0x4/2)] & 0xff); | |
| 316 | if(state->spr_ram[offs+(0x4/2)] & 0x100) | |
| 298 | 317 | y = 0x100 - y; |
| 299 | spr_offs = (((spr_ram[offs+(0x0/2)] & 7) << 16) | (spr_ram[offs+(0x2/2)])) << 2; | |
| 300 | xsize = ((spr_ram[offs+(0xc/2)] & 0x000f)+1) << 3; | |
| 301 | ysize = (spr_ram[offs+(0x8/2)] & 0x00ff)+1; | |
| 302 | fx = (spr_ram[offs+(0xa/2)] & 0x8000) >> 15; | |
| 303 | zoom = (spr_ram[offs+(0xc/2)] & 0xff00) >> 8; | |
| 318 | spr_offs = (((state->spr_ram[offs+(0x0/2)] & 7) << 16) | (state->spr_ram[offs+(0x2/2)])) << 2; | |
| 319 | xsize = ((state->spr_ram[offs+(0xc/2)] & 0x000f)+1) << 3; | |
| 320 | ysize = (state->spr_ram[offs+(0x8/2)] & 0x00ff)+1; | |
| 321 | fx = (state->spr_ram[offs+(0xa/2)] & 0x8000) >> 15; | |
| 322 | zoom = (state->spr_ram[offs+(0xc/2)] & 0xff00) >> 8; | |
| 304 | 323 | |
| 305 | col_bank = (spr_ram[offs+(0x0/2)] & 0xff00) >> 8; | |
| 324 | col_bank = (state->spr_ram[offs+(0x0/2)] & 0xff00) >> 8; | |
| 306 | 325 | |
| 307 | 326 | xf = 0; |
| 308 | 327 | yf = 0; |
| r10886 | r10887 | |
| 403 | 422 | } |
| 404 | 423 | } |
| 405 | 424 | |
| 406 | tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); | |
| 425 | tilemap_draw(bitmap,cliprect,state->tx_tilemap,0,0); | |
| 407 | 426 | |
| 408 | 427 | |
| 409 | 428 | //0x62 0x9a 1c2d0 |
| r10886 | r10887 | |
| 414 | 433 | if(0) //sprite gfx debug viewer |
| 415 | 434 | { |
| 416 | 435 | int x,y,count; |
| 417 | static int test_x, test_y, start_offs,color_pen; | |
| 418 | 436 | const UINT8 *blit_ram = screen->machine->region("spr_gfx")->base(); |
| 419 | 437 | |
| 420 | 438 | if(input_code_pressed(screen->machine, KEYCODE_Z)) |
| 421 | test_x++; | |
| 439 | state->test_x++; | |
| 422 | 440 | |
| 423 | 441 | if(input_code_pressed(screen->machine, KEYCODE_X)) |
| 424 | test_x--; | |
| 442 | state->test_x--; | |
| 425 | 443 | |
| 426 | 444 | if(input_code_pressed(screen->machine, KEYCODE_A)) |
| 427 | test_y++; | |
| 445 | state->test_y++; | |
| 428 | 446 | |
| 429 | 447 | if(input_code_pressed(screen->machine, KEYCODE_S)) |
| 430 | test_y--; | |
| 448 | state->test_y--; | |
| 431 | 449 | |
| 432 | 450 | if(input_code_pressed(screen->machine, KEYCODE_Q)) |
| 433 | start_offs+=0x200; | |
| 451 | state->start_offs+=0x200; | |
| 434 | 452 | |
| 435 | 453 | if(input_code_pressed(screen->machine, KEYCODE_W)) |
| 436 | start_offs-=0x200; | |
| 454 | state->start_offs-=0x200; | |
| 437 | 455 | |
| 438 | 456 | if(input_code_pressed_once(screen->machine, KEYCODE_T)) |
| 439 | start_offs+=0x20000; | |
| 457 | state->start_offs+=0x20000; | |
| 440 | 458 | |
| 441 | 459 | if(input_code_pressed_once(screen->machine, KEYCODE_Y)) |
| 442 | start_offs-=0x20000; | |
| 460 | state->start_offs-=0x20000; | |
| 443 | 461 | |
| 444 | 462 | if(input_code_pressed(screen->machine, KEYCODE_E)) |
| 445 | start_offs+=4; | |
| 463 | state->start_offs+=4; | |
| 446 | 464 | |
| 447 | 465 | if(input_code_pressed(screen->machine, KEYCODE_R)) |
| 448 | start_offs-=4; | |
| 466 | state->start_offs-=4; | |
| 449 | 467 | |
| 450 | 468 | if(input_code_pressed(screen->machine, KEYCODE_D)) |
| 451 | color_pen++; | |
| 469 | state->color_pen++; | |
| 452 | 470 | |
| 453 | 471 | if(input_code_pressed(screen->machine, KEYCODE_F)) |
| 454 | color_pen--; | |
| 472 | state->color_pen--; | |
| 455 | 473 | |
| 456 | popmessage("%02x %02x %04x %02x",test_x,test_y,start_offs,color_pen); | |
| 474 | popmessage("%02x %02x %04x %02x",state->test_x,state->test_y,state->start_offs,state->color_pen); | |
| 457 | 475 | |
| 458 | 476 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 459 | 477 | |
| 460 | count = (start_offs); | |
| 478 | count = (state->start_offs); | |
| 461 | 479 | |
| 462 | for(y=0;y<test_y;y++) | |
| 480 | for(y=0;y<state->test_y;y++) | |
| 463 | 481 | { |
| 464 | for(x=0;x<test_x;x+=8) | |
| 482 | for(x=0;x<state->test_x;x+=8) | |
| 465 | 483 | { |
| 466 | 484 | UINT32 color; |
| 467 | 485 | UINT8 dot; |
| r10886 | r10887 | |
| 472 | 490 | color|= ((blit_ram[count+3] & 0xff) << 0); |
| 473 | 491 | |
| 474 | 492 | dot = (color & 0xf0000000) >> 28; |
| 475 | *BITMAP_ADDR16(bitmap, y, x+0) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 493 | *BITMAP_ADDR16(bitmap, y, x+0) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 476 | 494 | |
| 477 | 495 | dot = (color & 0x0f000000) >> 24; |
| 478 | *BITMAP_ADDR16(bitmap, y, x+4) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 496 | *BITMAP_ADDR16(bitmap, y, x+4) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 479 | 497 | |
| 480 | 498 | dot = (color & 0x00f00000) >> 20; |
| 481 | *BITMAP_ADDR16(bitmap, y, x+1) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 499 | *BITMAP_ADDR16(bitmap, y, x+1) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 482 | 500 | |
| 483 | 501 | dot = (color & 0x000f0000) >> 16; |
| 484 | *BITMAP_ADDR16(bitmap, y, x+5) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 502 | *BITMAP_ADDR16(bitmap, y, x+5) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 485 | 503 | |
| 486 | 504 | dot = (color & 0x0000f000) >> 12; |
| 487 | *BITMAP_ADDR16(bitmap, y, x+2) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 505 | *BITMAP_ADDR16(bitmap, y, x+2) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 488 | 506 | |
| 489 | 507 | dot = (color & 0x00000f00) >> 8; |
| 490 | *BITMAP_ADDR16(bitmap, y, x+6) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 508 | *BITMAP_ADDR16(bitmap, y, x+6) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 491 | 509 | |
| 492 | 510 | dot = (color & 0x000000f0) >> 4; |
| 493 | *BITMAP_ADDR16(bitmap, y, x+3) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 511 | *BITMAP_ADDR16(bitmap, y, x+3) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 494 | 512 | |
| 495 | 513 | dot = (color & 0x0000000f) >> 0; |
| 496 | *BITMAP_ADDR16(bitmap, y, x+7) = screen->machine->pens[dot+(color_pen<<4)]; | |
| 514 | *BITMAP_ADDR16(bitmap, y, x+7) = screen->machine->pens[dot+(state->color_pen<<4)]; | |
| 497 | 515 | |
| 498 | 516 | count+=4; |
| 499 | 517 | } |
| r10886 | r10887 | |
| 508 | 526 | |
| 509 | 527 | static WRITE16_HANDLER( tx_vram_w ) |
| 510 | 528 | { |
| 511 | COMBINE_DATA(&tx_vram[offset]); | |
| 512 | tilemap_mark_tile_dirty(tx_tilemap,offset); | |
| 529 | cybertnk_state *state = space->machine->driver_data<cybertnk_state>(); | |
| 530 | COMBINE_DATA(&state->tx_vram[offset]); | |
| 531 | tilemap_mark_tile_dirty(state->tx_tilemap,offset); | |
| 513 | 532 | } |
| 514 | 533 | |
| 515 | 534 | static READ16_HANDLER( io_r ) |
| 516 | 535 | { |
| 536 | cybertnk_state *state = space->machine->driver_data<cybertnk_state>(); | |
| 517 | 537 | switch( offset ) |
| 518 | 538 | { |
| 519 | 539 | case 2/2: |
| r10886 | r10887 | |
| 523 | 543 | // 0x001100D5 is controller data |
| 524 | 544 | // 0x00110004 low is controller data ready |
| 525 | 545 | case 4/2: |
| 526 | switch( (io_ram[6/2]) & 0xff ) | |
| 546 | switch( (state->io_ram[6/2]) & 0xff ) | |
| 527 | 547 | { |
| 528 | 548 | case 0: |
| 529 | io_ram[0xd4/2] = input_port_read(space->machine, "TRAVERSE"); | |
| 549 | state->io_ram[0xd4/2] = input_port_read(space->machine, "TRAVERSE"); | |
| 530 | 550 | break; |
| 531 | 551 | |
| 532 | 552 | case 0x20: |
| 533 | io_ram[0xd4/2] = input_port_read(space->machine, "ELEVATE"); | |
| 553 | state->io_ram[0xd4/2] = input_port_read(space->machine, "ELEVATE"); | |
| 534 | 554 | break; |
| 535 | 555 | |
| 536 | 556 | case 0x40: |
| 537 | io_ram[0xd4/2] = input_port_read(space->machine, "ACCEL"); | |
| 557 | state->io_ram[0xd4/2] = input_port_read(space->machine, "ACCEL"); | |
| 538 | 558 | break; |
| 539 | 559 | |
| 540 | 560 | case 0x42: |
| r10886 | r10887 | |
| 542 | 562 | // controller return value is stored in $42(a6) |
| 543 | 563 | // but I don't see it referenced again. |
| 544 | 564 | //popmessage("unknown controller device 0x42"); |
| 545 | io_ram[0xd4/2] = 0; | |
| 565 | state->io_ram[0xd4/2] = 0; | |
| 546 | 566 | break; |
| 547 | 567 | |
| 548 | 568 | case 0x60: |
| 549 | io_ram[0xd4/2] = input_port_read(space->machine, "HANDLE"); | |
| 569 | state->io_ram[0xd4/2] = input_port_read(space->machine, "HANDLE"); | |
| 550 | 570 | break; |
| 551 | 571 | |
| 552 | 572 | //default: |
| r10886 | r10887 | |
| 564 | 584 | return input_port_read(space->machine, "DSW2"); |
| 565 | 585 | |
| 566 | 586 | case 0xd4/2: |
| 567 | return io_ram[offset]; // controller data | |
| 587 | return state->io_ram[offset]; // controller data | |
| 568 | 588 | |
| 569 | 589 | default: |
| 570 | 590 | { |
| 571 | 591 | //popmessage("unknown io read 0x%08x", offset); |
| 572 | return io_ram[offset]; | |
| 592 | return state->io_ram[offset]; | |
| 573 | 593 | } |
| 574 | 594 | } |
| 575 | 595 | } |
| 576 | 596 | |
| 577 | 597 | static WRITE16_HANDLER( io_w ) |
| 578 | 598 | { |
| 579 | COMBINE_DATA(&io_ram[offset]); | |
| 599 | cybertnk_state *state = space->machine->driver_data<cybertnk_state>(); | |
| 600 | COMBINE_DATA(&state->io_ram[offset]); | |
| 580 | 601 | |
| 581 | 602 | switch( offset ) |
| 582 | 603 | { |
| r10886 | r10887 | |
| 637 | 658 | case 0x80/2: |
| 638 | 659 | case 0x82/2: |
| 639 | 660 | case 0x84/2: |
| 640 | popmessage("%02x %02x %02x %02x %02x %02x %02x",io_ram[0x40/2],io_ram[0x42/2],io_ram[0x44/2],io_ram[0x46/2],io_ram[0x48/2],io_ram[0x4a/2],io_ram[0x4c/2]); | |
| 661 | popmessage("%02x %02x %02x %02x %02x %02x %02x",state->io_ram[0x40/2],state->io_ram[0x42/2],state->io_ram[0x44/2],state->io_ram[0x46/2],state->io_ram[0x48/2],state->io_ram[0x4a/2],state->io_ram[0x4c/2]); | |
| 641 | 662 | break; |
| 642 | 663 | |
| 643 | 664 | default: |
| r10886 | r10887 | |
| 648 | 669 | |
| 649 | 670 | static READ8_HANDLER( soundport_r ) |
| 650 | 671 | { |
| 651 | return io_ram[0] & 0xff; | |
| 672 | cybertnk_state *state = space->machine->driver_data<cybertnk_state>(); | |
| 673 | return state->io_ram[0] & 0xff; | |
| 652 | 674 | } |
| 653 | 675 | |
| 654 | 676 | static ADDRESS_MAP_START( master_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 655 | 677 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 656 | 678 | AM_RANGE(0x080000, 0x087fff) AM_RAM /*Work RAM*/ |
| 657 | AM_RANGE(0x0a0000, 0x0a0fff) AM_RAM AM_BASE(&spr_ram) // non-tile based sprite ram | |
| 658 | AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM_WRITE(tx_vram_w) AM_BASE(&tx_vram) | |
| 659 | AM_RANGE(0x0c4000, 0x0c5fff) AM_RAM AM_BASE(&bg_vram) | |
| 660 | AM_RANGE(0x0c8000, 0x0c9fff) AM_RAM AM_BASE(&fg_vram) | |
| 679 | AM_RANGE(0x0a0000, 0x0a0fff) AM_RAM AM_BASE_MEMBER(cybertnk_state, spr_ram) // non-tile based sprite ram | |
| 680 | AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM_WRITE(tx_vram_w) AM_BASE_MEMBER(cybertnk_state, tx_vram) | |
| 681 | AM_RANGE(0x0c4000, 0x0c5fff) AM_RAM AM_BASE_MEMBER(cybertnk_state, bg_vram) | |
| 682 | AM_RANGE(0x0c8000, 0x0c9fff) AM_RAM AM_BASE_MEMBER(cybertnk_state, fg_vram) | |
| 661 | 683 | AM_RANGE(0x0e0000, 0x0e0fff) AM_RAM AM_SHARE("sharedram") |
| 662 | 684 | AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 663 | AM_RANGE(0x110000, 0x1101ff) AM_READWRITE(io_r,io_w) AM_BASE( | |
| 685 | AM_RANGE(0x110000, 0x1101ff) AM_READWRITE(io_r,io_w) AM_BASE_MEMBER(cybertnk_state, io_ram) | |
| 664 | 686 | ADDRESS_MAP_END |
| 665 | 687 | |
| 666 | 688 | static ADDRESS_MAP_START( slave_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 667 | 689 | AM_RANGE(0x000000, 0x01ffff) AM_ROM |
| 668 | 690 | AM_RANGE(0x080000, 0x083fff) AM_RAM /*Work RAM*/ |
| 669 | AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_BASE( | |
| 691 | AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_BASE_MEMBER( | |
| 670 | 692 | AM_RANGE(0x100000, 0x100fff) AM_RAM AM_SHARE("sharedram") |
| 671 | 693 | AM_RANGE(0x140000, 0x140003) AM_NOP /*Watchdog? Written during loops and interrupts*/ |
| 672 | 694 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 836 | 858 | 0 /* TODO */ |
| 837 | 859 | }; |
| 838 | 860 | |
| 839 | static MACHINE_CONFIG_START( cybertnk, | |
| 861 | static MACHINE_CONFIG_START( cybertnk, cyb | |
| 840 | 862 | MCFG_CPU_ADD("maincpu", M68000,20000000/2) |
| 841 | 863 | MCFG_CPU_PROGRAM_MAP(master_mem) |
| 842 | 864 | MCFG_CPU_VBLANK_INT("lscreen", irq1_line_hold) |
| r10886 | r10887 | |
|---|---|---|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | |
| 120 | /************************************* | |
| 121 | * | |
| 122 | * Local variables and tables | |
| 123 | * | |
| 124 | *************************************/ | |
| 125 | ||
| 126 | static UINT8 input_mux; | |
| 127 | static UINT8 latched_input; | |
| 128 | ||
| 129 | static UINT8 last_op4; | |
| 130 | ||
| 131 | static UINT8 maxrpm_adc_control; | |
| 132 | static UINT8 maxrpm_adc_select; | |
| 133 | static UINT8 maxrpm_last_shift; | |
| 134 | static INT8 maxrpm_p1_shift; | |
| 135 | static INT8 maxrpm_p2_shift; | |
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | 120 | static WRITE8_HANDLER( mcrmono_control_port_w ) |
| 140 | 121 | { |
| 141 | 122 | /* |
| r10886 | r10887 | |
| 163 | 144 | |
| 164 | 145 | static READ8_HANDLER( demoderm_ip1_r ) |
| 165 | 146 | { |
| 147 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 166 | 148 | return input_port_read(space->machine, "MONO.IP1") | |
| 167 | (input_port_read(space->machine, input_mux ? "MONO.IP1.ALT2" : "MONO.IP1.ALT1") << 2); | |
| 149 | (input_port_read(space->machine, state->input_mux ? "MONO.IP1.ALT2" : "MONO.IP1.ALT1") << 2); | |
| 168 | 150 | } |
| 169 | 151 | |
| 170 | 152 | |
| 171 | 153 | static READ8_HANDLER( demoderm_ip2_r ) |
| 172 | 154 | { |
| 155 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 173 | 156 | return input_port_read(space->machine, "MONO.IP2") | |
| 174 | (input_port_read(space->machine, input_mux ? "MONO.IP2.ALT2" : "MONO.IP2.ALT1") << 2); | |
| 157 | (input_port_read(space->machine, state->input_mux ? "MONO.IP2.ALT2" : "MONO.IP2.ALT1") << 2); | |
| 175 | 158 | } |
| 176 | 159 | |
| 177 | 160 | |
| 178 | 161 | static WRITE8_HANDLER( demoderm_op6_w ) |
| 179 | 162 | { |
| 163 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 180 | 164 | /* top 2 bits select the input */ |
| 181 | if (data & 0x80) input_mux = 0; | |
| 182 | if (data & 0x40) input_mux = 1; | |
| 165 | if (data & 0x80) state->input_mux = 0; | |
| 166 | if (data & 0x40) state->input_mux = 1; | |
| 183 | 167 | |
| 184 | 168 | /* low 5 bits control the turbo CS */ |
| 185 | 169 | turbocs_data_w(space, offset, data); |
| r10886 | r10887 | |
| 195 | 179 | |
| 196 | 180 | static READ8_HANDLER( maxrpm_ip1_r ) |
| 197 | 181 | { |
| 198 | return latched_input; | |
| 182 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 183 | return state->latched_input; | |
| 199 | 184 | } |
| 200 | 185 | |
| 201 | 186 | |
| 202 | 187 | static READ8_HANDLER( maxrpm_ip2_r ) |
| 203 | 188 | { |
| 189 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 204 | 190 | static const UINT8 shift_bits[5] = { 0x00, 0x05, 0x06, 0x01, 0x02 }; |
| 205 | 191 | UINT8 start = input_port_read(space->machine, "MONO.IP0"); |
| 206 | 192 | UINT8 shift = input_port_read(space->machine, "SHIFT"); |
| 207 | 193 | |
| 208 | 194 | /* reset on a start */ |
| 209 | 195 | if (!(start & 0x08)) |
| 210 | maxrpm_p1_shift = 0; | |
| 196 | state->maxrpm_p1_shift = 0; | |
| 211 | 197 | if (!(start & 0x04)) |
| 212 | maxrpm_p2_shift = 0; | |
| 198 | state->maxrpm_p2_shift = 0; | |
| 213 | 199 | |
| 214 | 200 | /* increment, decrement on falling edge */ |
| 215 | if (!(shift & 0x01) && (maxrpm_last_shift & 0x01)) | |
| 201 | if (!(shift & 0x01) && (state->maxrpm_last_shift & 0x01)) | |
| 216 | 202 | { |
| 217 | maxrpm_p1_shift++; | |
| 218 | if (maxrpm_p1_shift > 4) | |
| 219 | maxrpm_p1_shift = 4; | |
| 203 | state->maxrpm_p1_shift++; | |
| 204 | if (state->maxrpm_p1_shift > 4) | |
| 205 | state->maxrpm_p1_shift = 4; | |
| 220 | 206 | } |
| 221 | if (!(shift & 0x02) && (maxrpm_last_shift & 0x02)) | |
| 207 | if (!(shift & 0x02) && (state->maxrpm_last_shift & 0x02)) | |
| 222 | 208 | { |
| 223 | maxrpm_p1_shift--; | |
| 224 | if (maxrpm_p1_shift < 0) | |
| 225 | maxrpm_p1_shift = 0; | |
| 209 | state->maxrpm_p1_shift--; | |
| 210 | if (state->maxrpm_p1_shift < 0) | |
| 211 | state->maxrpm_p1_shift = 0; | |
| 226 | 212 | } |
| 227 | if (!(shift & 0x04) && (maxrpm_last_shift & 0x04)) | |
| 213 | if (!(shift & 0x04) && (state->maxrpm_last_shift & 0x04)) | |
| 228 | 214 | { |
| 229 | maxrpm_p2_shift++; | |
| 230 | if (maxrpm_p2_shift > 4) | |
| 231 | maxrpm_p2_shift = 4; | |
| 215 | state->maxrpm_p2_shift++; | |
| 216 | if (state->maxrpm_p2_shift > 4) | |
| 217 | state->maxrpm_p2_shift = 4; | |
| 232 | 218 | } |
| 233 | if (!(shift & 0x08) && (maxrpm_last_shift & 0x08)) | |
| 219 | if (!(shift & 0x08) && (state->maxrpm_last_shift & 0x08)) | |
| 234 | 220 | { |
| 235 | maxrpm_p2_shift--; | |
| 236 | if (maxrpm_p2_shift < 0) | |
| 237 | maxrpm_p2_shift = 0; | |
| 221 | state->maxrpm_p2_shift--; | |
| 222 | if (state->maxrpm_p2_shift < 0) | |
| 223 | state->maxrpm_p2_shift = 0; | |
| 238 | 224 | } |
| 239 | 225 | |
| 240 | maxrpm_last_shift = shift; | |
| 226 | state->maxrpm_last_shift = shift; | |
| 241 | 227 | |
| 242 | return ~((shift_bits[maxrpm_p1_shift] << 4) + shift_bits[maxrpm_p2_shift]); | |
| 228 | return ~((shift_bits[state->maxrpm_p1_shift] << 4) + shift_bits[state->maxrpm_p2_shift]); | |
| 243 | 229 | } |
| 244 | 230 | |
| 245 | 231 | |
| 246 | 232 | static WRITE8_HANDLER( maxrpm_op5_w ) |
| 247 | 233 | { |
| 234 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 248 | 235 | /* latch the low 4 bits as input to the ADC0844 */ |
| 249 | maxrpm_adc_control = data & 0x0f; | |
| 236 | state->maxrpm_adc_control = data & 0x0f; | |
| 250 | 237 | |
| 251 | 238 | /* remaining bits go to standard connections */ |
| 252 | 239 | mcrmono_control_port_w(space, offset, data); |
| r10886 | r10887 | |
| 255 | 242 | |
| 256 | 243 | static WRITE8_HANDLER( maxrpm_op6_w ) |
| 257 | 244 | { |
| 245 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 258 | 246 | static const char *const inputs[] = { "MONO.IP1", "MONO.IP1.ALT1", "MONO.IP1.ALT2", "MONO.IP1.ALT3" }; |
| 259 | 247 | /* |
| 260 | 248 | Reflective Sensor Control: |
| r10886 | r10887 | |
| 276 | 264 | |
| 277 | 265 | /* when the read is toggled is when the ADC value is latched */ |
| 278 | 266 | if (!(data & 0x80)) |
| 279 | latched_input = input_port_read(space->machine, inputs[maxrpm_adc_select]); | |
| 267 | state->latched_input = input_port_read(space->machine, inputs[state->maxrpm_adc_select]); | |
| 280 | 268 | |
| 281 | 269 | /* when both the write and the enable are low, it's a write to the ADC0844 */ |
| 282 | 270 | /* unfortunately the behavior below doesn't match up with the inputs on the */ |
| 283 | 271 | /* schematics and wiring diagrams, so they must be wrong */ |
| 284 | 272 | if (!(data & 0x40) && !(data & 0x20)) |
| 285 | maxrpm_adc_select = (maxrpm_adc_control >> 1) & 3; | |
| 273 | state->maxrpm_adc_select = (state->maxrpm_adc_control >> 1) & 3; | |
| 286 | 274 | |
| 287 | 275 | /* low 5 bits control the turbo CS */ |
| 288 | 276 | turbocs_data_w(space, offset, data); |
| r10886 | r10887 | |
| 365 | 353 | |
| 366 | 354 | static READ8_HANDLER( stargrds_ip0_r ) |
| 367 | 355 | { |
| 356 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 368 | 357 | UINT8 result = input_port_read(space->machine, "MONO.IP0"); |
| 369 | if (input_mux) | |
| 358 | if (state->input_mux) | |
| 370 | 359 | result = (result & ~0x0a) | (input_port_read(space->machine, "MONO.IP0.ALT") & 0x0a); |
| 371 | 360 | return (result & ~0x10) | ((soundsgood_status_r(space, 0) << 4) & 0x10); |
| 372 | 361 | } |
| r10886 | r10887 | |
| 374 | 363 | |
| 375 | 364 | static WRITE8_HANDLER( stargrds_op5_w ) |
| 376 | 365 | { |
| 366 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 377 | 367 | /* bit 1 controls input muxing on port 0 */ |
| 378 | input_mux = (data >> 1) & 1; | |
| 368 | state->input_mux = (data >> 1) & 1; | |
| 379 | 369 | |
| 380 | 370 | /* bit 2 controls light #0 */ |
| 381 | 371 | /* bit 3 controls light #1 */ |
| r10886 | r10887 | |
| 414 | 404 | |
| 415 | 405 | static READ8_HANDLER( spyhunt_ip2_r ) |
| 416 | 406 | { |
| 407 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 417 | 408 | /* multiplexed steering wheel/gas pedal */ |
| 418 | return input_port_read(space->machine, input_mux ? "SSIO.IP2.ALT" : "SSIO.IP2"); | |
| 409 | return input_port_read(space->machine, state->input_mux ? "SSIO.IP2.ALT" : "SSIO.IP2"); | |
| 419 | 410 | } |
| 420 | 411 | |
| 421 | 412 | |
| 422 | 413 | static WRITE8_HANDLER( spyhunt_op4_w ) |
| 423 | 414 | { |
| 415 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 424 | 416 | /* Spy Hunter uses port 4 for talking to the Chip Squeak Deluxe */ |
| 425 | 417 | /* (and for toggling the lamps and muxing the analog inputs) */ |
| 426 | 418 | |
| 427 | 419 | /* mux select is in bit 7 */ |
| 428 | input_mux = (data >> 7) & 1; | |
| 420 | state->input_mux = (data >> 7) & 1; | |
| 429 | 421 | |
| 430 | 422 | /* |
| 431 | 423 | Lamp Driver: |
| r10886 | r10887 | |
| 436 | 428 | demuxer. The eight outputs directly control 8 lamps. |
| 437 | 429 | */ |
| 438 | 430 | /* bit 5 = STR1 (J1-13) */ |
| 439 | if (((last_op4 ^ data) & 0x20) && !(data & 0x20)) | |
| 431 | if (((state->last_op4 ^ data) & 0x20) && !(data & 0x20)) | |
| 440 | 432 | { |
| 441 | 433 | static const char *const lampname[8] = |
| 442 | 434 | { |
| r10886 | r10887 | |
| 449 | 441 | /* bit 0 -> J1-12 (A0) */ |
| 450 | 442 | output_set_value(lampname[data & 7], (data >> 3) & 1); |
| 451 | 443 | } |
| 452 | last_op4 = data; | |
| 444 | state->last_op4 = data; | |
| 453 | 445 | |
| 454 | 446 | /* low 5 bits go to control the Chip Squeak Deluxe */ |
| 455 | 447 | csdeluxe_data_w(space, offset, data); |
| r10886 | r10887 | |
| 465 | 457 | |
| 466 | 458 | static READ8_HANDLER( turbotag_ip2_r ) |
| 467 | 459 | { |
| 460 | mcr3_state *state = space->machine->driver_data<mcr3_state>(); | |
| 468 | 461 | /* multiplexed steering wheel/gas pedal */ |
| 469 | if (input_mux) | |
| 462 | if (state->input_mux) | |
| 470 | 463 | return input_port_read(space->machine, "SSIO.IP2.ALT"); |
| 471 | 464 | |
| 472 | 465 | return input_port_read(space->machine, "SSIO.IP2") + 5 * (space->machine->primary_screen->frame_number() & 1); |
| r10886 | r10887 | |
| 533 | 526 | ADDRESS_MAP_UNMAP_HIGH |
| 534 | 527 | AM_RANGE(0x0000, 0xdfff) AM_ROM |
| 535 | 528 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(spyhunt_videoram_w) AM_BASE_MEMBER(mcr3_state, videoram) |
| 536 | AM_RANGE(0xe800, 0xebff) AM_MIRROR(0x0400) AM_RAM_WRITE(spyhunt_alpharam_w) AM_BASE( | |
| 529 | AM_RANGE(0xe800, 0xebff) AM_MIRROR(0x0400) AM_RAM_WRITE(spyhunt_alpharam_w) AM_BASE_MEMBER(mcr3_state, spyhunt_alpharam) | |
| 537 | 530 | AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram") |
| 538 | 531 | AM_RANGE(0xf800, 0xf9ff) AM_RAM AM_BASE_SIZE_MEMBER(mcr3_state, spriteram, spriteram_size) |
| 539 | 532 | AM_RANGE(0xfa00, 0xfa7f) AM_MIRROR(0x0180) AM_WRITE(mcr3_paletteram_w) AM_BASE_GENERIC(paletteram) |
| r10886 | r10887 | |
| 1536 | 1529 | |
| 1537 | 1530 | static void mcr_common_init(running_machine *machine, int sound_board) |
| 1538 | 1531 | { |
| 1532 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 1539 | 1533 | mcr_sound_init(machine, sound_board); |
| 1540 | 1534 | |
| 1541 | state_save_register_global(machine, input_mux); | |
| 1542 | state_save_register_global(machine, latched_input); | |
| 1543 | state_save_register_global(machine, last_op4); | |
| 1535 | state_save_register_global(machine, state->input_mux); | |
| 1536 | state_save_register_global(machine, state->latched_input); | |
| 1537 | state_save_register_global(machine, state->last_op4); | |
| 1544 | 1538 | } |
| 1545 | 1539 | |
| 1546 | 1540 | |
| r10886 | r10887 | |
| 1562 | 1556 | |
| 1563 | 1557 | static DRIVER_INIT( maxrpm ) |
| 1564 | 1558 | { |
| 1559 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 1565 | 1560 | mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK); |
| 1566 | 1561 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x01, 0x01, 0, 0, maxrpm_ip1_r); |
| 1567 | 1562 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x02, 0x02, 0, 0, maxrpm_ip2_r); |
| 1568 | 1563 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x05, 0x05, 0, 0, maxrpm_op5_w); |
| 1569 | 1564 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, maxrpm_op6_w); |
| 1570 | 1565 | |
| 1571 | state_save_register_global(machine, maxrpm_adc_control); | |
| 1572 | state_save_register_global(machine, maxrpm_adc_select); | |
| 1573 | state_save_register_global(machine, maxrpm_last_shift); | |
| 1574 | state_save_register_global(machine, maxrpm_p1_shift); | |
| 1575 | state_save_register_global(machine, maxrpm_p2_shift); | |
| 1566 | state_save_register_global(machine, state->maxrpm_adc_control); | |
| 1567 | state_save_register_global(machine, state->maxrpm_adc_select); | |
| 1568 | state_save_register_global(machine, state->maxrpm_last_shift); | |
| 1569 | state_save_register_global(machine, state->maxrpm_p1_shift); | |
| 1570 | state_save_register_global(machine, state->maxrpm_p2_shift); | |
| 1576 | 1571 | } |
| 1577 | 1572 | |
| 1578 | 1573 | |
| r10886 | r10887 | |
| 1604 | 1599 | |
| 1605 | 1600 | static DRIVER_INIT( spyhunt ) |
| 1606 | 1601 | { |
| 1602 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 1607 | 1603 | mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); |
| 1608 | 1604 | ssio_set_custom_input(1, 0x60, spyhunt_ip1_r); |
| 1609 | 1605 | ssio_set_custom_input(2, 0xff, spyhunt_ip2_r); |
| 1610 | 1606 | ssio_set_custom_output(4, 0xff, spyhunt_op4_w); |
| 1611 | 1607 | |
| 1612 | spyhunt_sprite_color_mask = 0x00; | |
| 1613 | spyhunt_scroll_offset = 16; | |
| 1608 | state->spyhunt_sprite_color_mask = 0x00; | |
| 1609 | state->spyhunt_scroll_offset = 16; | |
| 1614 | 1610 | } |
| 1615 | 1611 | |
| 1616 | 1612 | |
| 1617 | 1613 | static DRIVER_INIT( crater ) |
| 1618 | 1614 | { |
| 1615 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 1619 | 1616 | mcr_common_init(machine, MCR_SSIO); |
| 1620 | 1617 | |
| 1621 | spyhunt_sprite_color_mask = 0x03; | |
| 1622 | spyhunt_scroll_offset = 96; | |
| 1618 | state->spyhunt_sprite_color_mask = 0x03; | |
| 1619 | state->spyhunt_scroll_offset = 96; | |
| 1623 | 1620 | } |
| 1624 | 1621 | |
| 1625 | 1622 | |
| 1626 | 1623 | static DRIVER_INIT( turbotag ) |
| 1627 | 1624 | { |
| 1625 | mcr3_state *state = machine->driver_data<mcr3_state>(); | |
| 1628 | 1626 | mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); |
| 1629 | 1627 | ssio_set_custom_input(1, 0x60, spyhunt_ip1_r); |
| 1630 | 1628 | ssio_set_custom_input(2, 0xff, turbotag_ip2_r); |
| 1631 | 1629 | ssio_set_custom_output(4, 0xff, spyhunt_op4_w); |
| 1632 | 1630 | |
| 1633 | spyhunt_sprite_color_mask = 0x00; | |
| 1634 | spyhunt_scroll_offset = 88; | |
| 1631 | state->spyhunt_sprite_color_mask = 0x00; | |
| 1632 | state->spyhunt_scroll_offset = 88; | |
| 1635 | 1633 | |
| 1636 | 1634 | /* the SSIO Z80 doesn't have any program to execute */ |
| 1637 | 1635 | machine->device<cpu_device>("csdcpu")->suspend(SUSPEND_REASON_DISABLE, 1); |
| r10886 | r10887 | |
|---|---|---|
| 71 | 71 | #include "cpu/z80/z80daisy.h" |
| 72 | 72 | #include "cpu/m6805/m6805.h" |
| 73 | 73 | |
| 74 | static tilemap_t *tilemap1; | |
| 75 | static tilemap_t *tilemap2; | |
| 76 | 74 | |
| 77 | static UINT8 *vram1; | |
| 78 | static UINT8 *vram2; | |
| 75 | class pipeline_state : public driver_device | |
| 76 | { | |
| 77 | public: | |
| 78 | pipeline_state(running_machine &machine, const driver_device_config_base &config) | |
| 79 | : driver_device(machine, config) { } | |
| 79 | 80 | |
| 80 | static UINT8 vidctrl; | |
| 81 | static UINT8 *palram; | |
| 82 | static UINT8 toMCU, fromMCU, ddrA; | |
| 81 | tilemap_t *tilemap1; | |
| 82 | tilemap_t *tilemap2; | |
| 83 | UINT8 *vram1; | |
| 84 | UINT8 *vram2; | |
| 85 | UINT8 vidctrl; | |
| 86 | UINT8 *palram; | |
| 87 | UINT8 toMCU; | |
| 88 | UINT8 fromMCU; | |
| 89 | UINT8 ddrA; | |
| 90 | }; | |
| 83 | 91 | |
| 92 | ||
| 84 | 93 | static TILE_GET_INFO( get_tile_info ) |
| 85 | 94 | { |
| 86 | int code = vram2[tile_index]+vram2[tile_index+0x800]*256; | |
| 95 | pipeline_state *state = machine->driver_data<pipeline_state>(); | |
| 96 | int code = state->vram2[tile_index]+state->vram2[tile_index+0x800]*256; | |
| 87 | 97 | SET_TILE_INFO( |
| 88 | 98 | 0, |
| 89 | 99 | code, |
| r10886 | r10887 | |
| 93 | 103 | |
| 94 | 104 | static TILE_GET_INFO( get_tile_info2 ) |
| 95 | 105 | { |
| 96 | int code =vram1[tile_index]+((vram1[tile_index+0x800]>>4))*256; | |
| 97 | int color=((vram1[tile_index+0x800])&0xf); | |
| 106 | pipeline_state *state = machine->driver_data<pipeline_state>(); | |
| 107 | int code =state->vram1[tile_index]+((state->vram1[tile_index+0x800]>>4))*256; | |
| 108 | int color=((state->vram1[tile_index+0x800])&0xf); | |
| 98 | 109 | SET_TILE_INFO |
| 99 | 110 | ( |
| 100 | 111 | 1, |
| r10886 | r10887 | |
| 106 | 117 | |
| 107 | 118 | static VIDEO_START ( pipeline ) |
| 108 | 119 | { |
| 109 | palram=auto_alloc_array(machine, UINT8, 0x1000); | |
| 110 | tilemap1 = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,64,32 ); | |
| 111 | tilemap2 = tilemap_create( machine, get_tile_info2,tilemap_scan_rows,8,8,64,32 ); | |
| 112 | tilemap_set_transparent_pen(tilemap2,0); | |
| 120 | pipeline_state *state = machine->driver_data<pipeline_state>(); | |
| 121 | state->palram=auto_alloc_array(machine, UINT8, 0x1000); | |
| 122 | state->tilemap1 = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,64,32 ); | |
| 123 | state->tilemap2 = tilemap_create( machine, get_tile_info2,tilemap_scan_rows,8,8,64,32 ); | |
| 124 | tilemap_set_transparent_pen(state->tilemap2,0); | |
| 113 | 125 | } |
| 114 | 126 | |
| 115 | 127 | static SCREEN_UPDATE( pipeline ) |
| 116 | 128 | { |
| 117 | tilemap_draw(bitmap,cliprect,tilemap1, 0,0); | |
| 118 | tilemap_draw(bitmap,cliprect,tilemap2, 0,0); | |
| 129 | pipeline_state *state = screen->machine->driver_data<pipeline_state>(); | |
| 130 | tilemap_draw(bitmap,cliprect,state->tilemap1, 0,0); | |
| 131 | tilemap_draw(bitmap,cliprect,state->tilemap2, 0,0); | |
| 119 | 132 | return 0; |
| 120 | 133 | } |
| 121 | 134 | |
| 122 | 135 | |
| 123 | 136 | static WRITE8_DEVICE_HANDLER(vidctrl_w) |
| 124 | 137 | { |
| 125 | vidctrl=data; | |
| 138 | pipeline_state *state = device->machine->driver_data<pipeline_state>(); | |
| 139 | state->vidctrl=data; | |
| 126 | 140 | } |
| 127 | 141 | |
| 128 | 142 | static WRITE8_HANDLER(vram2_w) |
| 129 | 143 | { |
| 130 | if(!(vidctrl&1)) | |
| 144 | pipeline_state *state = space->machine->driver_data<pipeline_state>(); | |
| 145 | if(!(state->vidctrl&1)) | |
| 131 | 146 | { |
| 132 | tilemap_mark_tile_dirty(tilemap1,offset&0x7ff); | |
| 133 | vram2[offset]=data; | |
| 147 | tilemap_mark_tile_dirty(state->tilemap1,offset&0x7ff); | |
| 148 | state->vram2[offset]=data; | |
| 134 | 149 | } |
| 135 | 150 | else |
| 136 | 151 | { |
| 137 | palram[offset]=data; | |
| 152 | state->palram[offset]=data; | |
| 138 | 153 | if(offset<0x300) |
| 139 | 154 | { |
| 140 | 155 | offset&=0xff; |
| 141 | palette_set_color_rgb(space->machine, offset, pal6bit(palram[offset]), pal6bit(palram[offset+0x100]), pal6bit(palram[offset+0x200])); | |
| 156 | palette_set_color_rgb(space->machine, offset, pal6bit(state->palram[offset]), pal6bit(state->palram[offset+0x100]), pal6bit(state->palram[offset+0x200])); | |
| 142 | 157 | } |
| 143 | 158 | } |
| 144 | 159 | } |
| 145 | 160 | |
| 146 | 161 | static WRITE8_HANDLER(vram1_w) |
| 147 | 162 | { |
| 148 | tilemap_mark_tile_dirty(tilemap2,offset&0x7ff); | |
| 149 | vram1[offset]=data; | |
| 163 | pipeline_state *state = space->machine->driver_data<pipeline_state>(); | |
| 164 | tilemap_mark_tile_dirty(state->tilemap2,offset&0x7ff); | |
| 165 | state->vram1[offset]=data; | |
| 150 | 166 | } |
| 151 | 167 | |
| 152 | 168 | static READ8_DEVICE_HANDLER(protection_r) |
| 153 | 169 | { |
| 154 | return fromMCU; | |
| 170 | pipeline_state *state = device->machine->driver_data<pipeline_state>(); | |
| 171 | return state->fromMCU; | |
| 155 | 172 | } |
| 156 | 173 | |
| 157 | 174 | static TIMER_CALLBACK( protection_deferred_w ) |
| 158 | 175 | { |
| 159 | toMCU = param; | |
| 176 | pipeline_state *state = machine->driver_data<pipeline_state>(); | |
| 177 | state->toMCU = param; | |
| 160 | 178 | } |
| 161 | 179 | |
| 162 | 180 | static WRITE8_DEVICE_HANDLER(protection_w) |
| r10886 | r10887 | |
| 168 | 186 | static ADDRESS_MAP_START( cpu0_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 169 | 187 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 170 | 188 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 171 | AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_BASE(&vram1) | |
| 172 | AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_BASE(&vram2) | |
| 189 | AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_BASE_MEMBER(pipeline_state, vram1) | |
| 190 | AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_BASE_MEMBER(pipeline_state, vram2) | |
| 173 | 191 | AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) |
| 174 | 192 | AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) |
| 175 | 193 | AM_RANGE(0xb830, 0xb830) AM_NOP |
| r10886 | r10887 | |
| 190 | 208 | |
| 191 | 209 | static WRITE8_HANDLER(mcu_portA_w) |
| 192 | 210 | { |
| 193 | fromMCU=data; | |
| 211 | pipeline_state *state = space->machine->driver_data<pipeline_state>(); | |
| 212 | state->fromMCU=data; | |
| 194 | 213 | } |
| 195 | 214 | |
| 196 | 215 | static READ8_HANDLER(mcu_portA_r) |
| 197 | 216 | { |
| 198 | return (fromMCU&ddrA)|(toMCU& ~ddrA); | |
| 217 | pipeline_state *state = space->machine->driver_data<pipeline_state>(); | |
| 218 | return (state->fromMCU&state->ddrA)|(state->toMCU& ~state->ddrA); | |
| 199 | 219 | } |
| 200 | 220 | |
| 201 | 221 | static WRITE8_HANDLER(mcu_ddrA_w) |
| 202 | 222 | { |
| 203 | ddrA=data; | |
| 223 | pipeline_state *state = space->machine->driver_data<pipeline_state>(); | |
| 224 | state->ddrA=data; | |
| 204 | 225 | } |
| 205 | 226 | |
| 206 | 227 | static ADDRESS_MAP_START( mcu_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 360 | 381 | } |
| 361 | 382 | } |
| 362 | 383 | |
| 363 | static MACHINE_CONFIG_START( pipeline, | |
| 384 | static MACHINE_CONFIG_START( pipeline, p | |
| 364 | 385 | /* basic machine hardware */ |
| 365 | 386 | |
| 366 | 387 | MCFG_CPU_ADD("maincpu", Z80, 7372800/2) |
| r10886 | r10887 | |
|---|---|---|
| 47 | 47 | UINT8 mux_data; |
| 48 | 48 | UINT32 adpcm_pos[2]; |
| 49 | 49 | UINT8 adpcm_idle[2]; |
| 50 | UINT8 trigger1; | |
| 51 | UINT8 adpcm_data1; | |
| 52 | UINT8 trigger2; | |
| 53 | UINT8 adpcm_data2; | |
| 50 | 54 | }; |
| 51 | 55 | |
| 52 | 56 | |
| r10886 | r10887 | |
| 276 | 280 | static void kfr_adpcm1_int(device_t *device) |
| 277 | 281 | { |
| 278 | 282 | kungfur_state *state = device->machine->driver_data<kungfur_state>(); |
| 279 | static UINT8 trigger,adpcm_data; | |
| 280 | 283 | |
| 281 | 284 | if (state->adpcm_pos[0] >= 0x40000 || state->adpcm_idle[0]) |
| 282 | 285 | { |
| 283 | 286 | msm5205_reset_w(device->machine->device("adpcm1"),1); |
| 284 | trigger = 0; | |
| 287 | state->trigger1 = 0; | |
| 285 | 288 | } |
| 286 | 289 | else |
| 287 | 290 | { |
| 288 | 291 | UINT8 *ROM = device->machine->region("adpcm1")->base(); |
| 289 | 292 | |
| 290 | adpcm_data = ((trigger ? (ROM[state->adpcm_pos[0]] & 0x0f) : (ROM[state->adpcm_pos[0]] & 0xf0)>>4) ); | |
| 291 | msm5205_data_w(device->machine->device("adpcm1"),adpcm_data & 0xf); | |
| 292 | trigger^=1; | |
| 293 | if(trigger == 0) | |
| 293 | state->adpcm_data1 = ((state->trigger1 ? (ROM[state->adpcm_pos[0]] & 0x0f) : (ROM[state->adpcm_pos[0]] & 0xf0)>>4) ); | |
| 294 | msm5205_data_w(device->machine->device("adpcm1"), state->adpcm_data1 & 0xf); | |
| 295 | state->trigger1 ^= 1; | |
| 296 | if(state->trigger1 == 0) | |
| 294 | 297 | { |
| 295 | 298 | state->adpcm_pos[0]++; |
| 296 | 299 | if((ROM[state->adpcm_pos[0]] & 0xff) == 0xff) |
| r10886 | r10887 | |
| 303 | 306 | static void kfr_adpcm2_int(device_t *device) |
| 304 | 307 | { |
| 305 | 308 | kungfur_state *state = device->machine->driver_data<kungfur_state>(); |
| 306 | static UINT8 trigger,adpcm_data; | |
| 307 | 309 | |
| 308 | 310 | if (state->adpcm_pos[1] >= 0x10000 || state->adpcm_idle[1]) |
| 309 | 311 | { |
| 310 | 312 | msm5205_reset_w(device->machine->device("adpcm2"),1); |
| 311 | trigger = 0; | |
| 313 | state->trigger2 = 0; | |
| 312 | 314 | } |
| 313 | 315 | else |
| 314 | 316 | { |
| 315 | 317 | UINT8 *ROM = device->machine->region("adpcm2")->base(); |
| 316 | 318 | |
| 317 | adpcm_data = ((trigger ? (ROM[state->adpcm_pos[1]] & 0x0f) : (ROM[state->adpcm_pos[1]] & 0xf0)>>4) ); | |
| 318 | msm5205_data_w(device->machine->device("adpcm2"),adpcm_data & 0xf); | |
| 319 | trigger^=1; | |
| 320 | if(trigger == 0) | |
| 319 | state->adpcm_data2 = ((state->trigger2 ? (ROM[state->adpcm_pos[1]] & 0x0f) : (ROM[state->adpcm_pos[1]] & 0xf0)>>4) ); | |
| 320 | msm5205_data_w(device->machine->device("adpcm2"), state->adpcm_data2 & 0xf); | |
| 321 | state->trigger2 ^= 1; | |
| 322 | if(state->trigger2 == 0) | |
| 321 | 323 | { |
| 322 | 324 | state->adpcm_pos[1]++; |
| 323 | 325 | if((ROM[state->adpcm_pos[1]] & 0xff) == 0xff) |
| r10886 | r10887 | |
|---|---|---|
| 35 | 35 | #include "sound/okim6295.h" |
| 36 | 36 | #include "video/generic.h" |
| 37 | 37 | |
| 38 | static UINT8* janshi_vram1; | |
| 39 | static UINT8* janshi_vram2; | |
| 40 | static UINT8* janshi_back_vram; | |
| 41 | static UINT8* janshi_crtc_regs; | |
| 42 | static UINT8* janshi_unk1; | |
| 43 | static UINT8* janshi_widthflags; | |
| 44 | static UINT8* janshi_unk2; | |
| 45 | 38 | |
| 39 | class pinkiri8_state : public driver_device | |
| 40 | { | |
| 41 | public: | |
| 42 | pinkiri8_state(running_machine &machine, const driver_device_config_base &config) | |
| 43 | : driver_device(machine, config) { } | |
| 44 | ||
| 45 | UINT8* janshi_vram1; | |
| 46 | UINT8* janshi_vram2; | |
| 47 | UINT8* janshi_back_vram; | |
| 48 | UINT8* janshi_crtc_regs; | |
| 49 | UINT8* janshi_unk1; | |
| 50 | UINT8* janshi_widthflags; | |
| 51 | UINT8* janshi_unk2; | |
| 52 | UINT32 vram_addr; | |
| 53 | int prev_writes; | |
| 54 | UINT8 mux_data; | |
| 55 | UINT8 prot_read_index; | |
| 56 | UINT8 prot_char[6]; | |
| 57 | UINT8 prot_index; | |
| 58 | }; | |
| 59 | ||
| 60 | ||
| 46 | 61 | static ADDRESS_MAP_START( janshi_vdp_map8, 0, 8 ) |
| 47 | 62 | |
| 48 | AM_RANGE(0xfc0000, 0xfc1fff) AM_RAM AM_BASE(&janshi_back_vram) // bg tilemap? | |
| 49 | AM_RANGE(0xfc2000, 0xfc2fff) AM_RAM AM_BASE(&janshi_vram1) // xpos, colour, tile number etc. | |
| 63 | AM_RANGE(0xfc0000, 0xfc1fff) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_back_vram) // bg tilemap? | |
| 64 | AM_RANGE(0xfc2000, 0xfc2fff) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_vram1) // xpos, colour, tile number etc. | |
| 50 | 65 | |
| 51 | AM_RANGE(0xfc3700, 0xfc377f) AM_RAM AM_BASE(&janshi_unk1) // ?? height related? | |
| 52 | AM_RANGE(0xfc3780, 0xfc37bf) AM_RAM AM_BASE(&janshi_widthflags) | |
| 53 | AM_RANGE(0xfc37c0, 0xfc37ff) AM_RAM AM_BASE(&janshi_unk2) // 2x increasing tables 00 10 20 30 etc. | |
| 66 | AM_RANGE(0xfc3700, 0xfc377f) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_unk1) // ?? height related? | |
| 67 | AM_RANGE(0xfc3780, 0xfc37bf) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_widthflags) | |
| 68 | AM_RANGE(0xfc37c0, 0xfc37ff) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_unk2) // 2x increasing tables 00 10 20 30 etc. | |
| 54 | 69 | |
| 55 | AM_RANGE(0xfc3800, 0xfc3fff) AM_RAM AM_BASE( | |
| 70 | AM_RANGE(0xfc3800, 0xfc3fff) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_vram2) // y pos + unknown | |
| 56 | 71 | |
| 57 | 72 | AM_RANGE(0xff0000, 0xff07ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w) AM_BASE_GENERIC(paletteram) |
| 58 | 73 | AM_RANGE(0xff2000, 0xff27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w) AM_BASE_GENERIC(paletteram2) |
| 59 | 74 | |
| 60 | AM_RANGE(0xff6000, 0xff601f) AM_RAM AM_BASE( | |
| 75 | AM_RANGE(0xff6000, 0xff601f) AM_RAM AM_BASE_MEMBER(pinkiri8_state, janshi_crtc_regs) | |
| 61 | 76 | ADDRESS_MAP_END |
| 62 | 77 | |
| 63 | 78 | |
| r10886 | r10887 | |
| 149 | 164 | |
| 150 | 165 | |
| 151 | 166 | |
| 152 | static UINT32 vram_addr; | |
| 153 | 167 | |
| 154 | 168 | static VIDEO_START( pinkiri8 ) |
| 155 | 169 | { |
| r10886 | r10887 | |
| 191 | 205 | |
| 192 | 206 | static SCREEN_UPDATE( pinkiri8 ) |
| 193 | 207 | { |
| 194 | static int col_bank; | |
| 208 | pinkiri8_state *state = screen->machine->driver_data<pinkiri8_state>(); | |
| 209 | int col_bank; | |
| 195 | 210 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 196 | 211 | |
| 197 | | |
| 212 | | |
| 198 | 213 | |
| 199 | 214 | if (!strcmp(screen->machine->gamedrv->name,"janshi")) game_type_hack = 1; |
| 200 | 215 | |
| r10886 | r10887 | |
| 207 | 222 | for (i=0x00;i<0x40;i+=2) |
| 208 | 223 | { |
| 209 | 224 | |
| 210 | printf("%02x, ", janshi_widthflags[i+1]); | |
| 225 | printf("%02x, ", state->janshi_widthflags[i+1]); | |
| 211 | 226 | |
| 212 | 227 | count2++; |
| 213 | 228 | |
| r10886 | r10887 | |
| 225 | 240 | |
| 226 | 241 | |
| 227 | 242 | |
| 228 | //popmessage("%02x",janshi_crtc_regs[0x0a]); | |
| 229 | col_bank = (janshi_crtc_regs[0x0a] & 0x40) >> 6; | |
| 243 | //popmessage("%02x",state->janshi_crtc_regs[0x0a]); | |
| 244 | col_bank = (state->janshi_crtc_regs[0x0a] & 0x40) >> 6; | |
| 230 | 245 | |
| 231 | 246 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 232 | 247 | |
| r10886 | r10887 | |
| 240 | 255 | { |
| 241 | 256 | for(x=0;x<32;x++) |
| 242 | 257 | { |
| 243 | tile = janshi_back_vram[count+1]<<8 | janshi_back_vram[count+0]; | |
| 244 | attr = janshi_back_vram[count+2] ^ 0xf0; | |
| 258 | tile = state->janshi_back_vram[count+1]<<8 | state->janshi_back_vram[count+0]; | |
| 259 | attr = state->janshi_back_vram[count+2] ^ 0xf0; | |
| 245 | 260 | col = (attr >> 4) | 0x10; |
| 246 | 261 | |
| 247 | 262 | drawgfx_transpen(bitmap,cliprect,gfx,tile,col,0,0,x*16,y*8,0); |
| r10886 | r10887 | |
| 277 | 292 | |
| 278 | 293 | */ |
| 279 | 294 | |
| 280 | spr_offs = ((janshi_vram1[(i*4)+0] & 0xff) | (janshi_vram1[(i*4)+1]<<8)) & 0xffff; | |
| 281 | col = (janshi_vram1[(i*4)+2] & 0xf8) >> 3; | |
| 282 | x = janshi_vram1[(i*4)+3]; | |
| 295 | spr_offs = ((state->janshi_vram1[(i*4)+0] & 0xff) | (state->janshi_vram1[(i*4)+1]<<8)) & 0xffff; | |
| 296 | col = (state->janshi_vram1[(i*4)+2] & 0xf8) >> 3; | |
| 297 | x = state->janshi_vram1[(i*4)+3]; | |
| 283 | 298 | |
| 284 | 299 | x &= 0xff; |
| 285 | 300 | x *= 2; |
| 286 | 301 | |
| 287 | unk2 = janshi_vram2[(i*2)+1]; | |
| 288 | y = (janshi_vram2[(i*2)+0]); | |
| 302 | unk2 = state->janshi_vram2[(i*2)+1]; | |
| 303 | y = (state->janshi_vram2[(i*2)+0]); | |
| 289 | 304 | |
| 290 | 305 | y = 0x100-y; |
| 291 | 306 | |
| r10886 | r10887 | |
| 298 | 313 | |
| 299 | 314 | |
| 300 | 315 | // these bits seem to somehow determine the sprite height / widths for the sprite ram region? |
| 301 | int bit = janshi_widthflags[(i/0x20)*2 + 1]; | |
| 316 | int bit = state->janshi_widthflags[(i/0x20)*2 + 1]; | |
| 302 | 317 | |
| 303 | 318 | if (bit) |
| 304 | 319 | { |
| r10886 | r10887 | |
| 406 | 421 | //data & 0x80 is probably NMI mask |
| 407 | 422 | } |
| 408 | 423 | |
| 409 | static int prev_writes = 0; | |
| 410 | 424 | |
| 411 | 425 | #define LOG_VRAM 0 |
| 412 | 426 | |
| 413 | 427 | static WRITE8_HANDLER( pinkiri8_vram_w ) |
| 414 | 428 | { |
| 429 | pinkiri8_state *state = space->machine->driver_data<pinkiri8_state>(); | |
| 415 | 430 | switch(offset) |
| 416 | 431 | { |
| 417 | 432 | case 0: |
| 418 | vram_addr = (data << 0) | (vram_addr&0xffff00); | |
| 419 | if (LOG_VRAM) printf("\n prev writes was %04x\n\naddress set to %04x -\n", prev_writes, vram_addr ); | |
| 420 | prev_writes = 0; | |
| 433 | state->vram_addr = (data << 0) | (state->vram_addr&0xffff00); | |
| 434 | if (LOG_VRAM) printf("\n prev writes was %04x\n\naddress set to %04x -\n", state->prev_writes, state->vram_addr ); | |
| 435 | state->prev_writes = 0; | |
| 421 | 436 | break; |
| 422 | 437 | |
| 423 | 438 | case 1: |
| 424 | vram_addr = (data << 8) | (vram_addr & 0xff00ff); | |
| 425 | if (LOG_VRAM)printf("\naddress set to %04x\n", vram_addr); | |
| 439 | state->vram_addr = (data << 8) | (state->vram_addr & 0xff00ff); | |
| 440 | if (LOG_VRAM)printf("\naddress set to %04x\n", state->vram_addr); | |
| 426 | 441 | break; |
| 427 | 442 | |
| 428 | 443 | case 2: |
| 429 | vram_addr = (data << 16) | (vram_addr & 0x00ffff); | |
| 430 | if (LOG_VRAM)printf("\naddress set to %04x\n", vram_addr); | |
| 444 | state->vram_addr = (data << 16) | (state->vram_addr & 0x00ffff); | |
| 445 | if (LOG_VRAM)printf("\naddress set to %04x\n", state->vram_addr); | |
| 431 | 446 | break; |
| 432 | 447 | |
| 433 | 448 | case 3: |
| r10886 | r10887 | |
| 435 | 450 | address_space *vdp_space = space->machine->device<janshi_vdp_device>("janshivdp")->space(); |
| 436 | 451 | |
| 437 | 452 | if (LOG_VRAM) printf("%02x ", data); |
| 438 | prev_writes++; | |
| 439 | vram_addr++; | |
| 453 | state->prev_writes++; | |
| 454 | state->vram_addr++; | |
| 440 | 455 | |
| 441 | vdp_space->write_byte(vram_addr, data); | |
| 456 | vdp_space->write_byte(state->vram_addr, data); | |
| 442 | 457 | break; |
| 443 | 458 | } |
| 444 | 459 | } |
| 445 | 460 | |
| 446 | static UINT8 mux_data; | |
| 447 | 461 | |
| 448 | 462 | static WRITE8_HANDLER( mux_w ) |
| 449 | 463 | { |
| 450 | mux_data = data; | |
| 464 | pinkiri8_state *state = space->machine->driver_data<pinkiri8_state>(); | |
| 465 | state->mux_data = data; | |
| 451 | 466 | } |
| 452 | 467 | |
| 453 | 468 | static READ8_HANDLER( mux_p2_r ) |
| 454 | 469 | { |
| 455 | switch(mux_data) | |
| 470 | pinkiri8_state *state = space->machine->driver_data<pinkiri8_state>(); | |
| 471 | switch(state->mux_data) | |
| 456 | 472 | { |
| 457 | 473 | case 0x01: return input_port_read(space->machine, "PL2_01"); |
| 458 | 474 | case 0x02: return input_port_read(space->machine, "PL2_02"); |
| r10886 | r10887 | |
| 466 | 482 | |
| 467 | 483 | static READ8_HANDLER( mux_p1_r ) |
| 468 | 484 | { |
| 469 | switch(mux_data) | |
| 485 | pinkiri8_state *state = space->machine->driver_data<pinkiri8_state>(); | |
| 486 | switch(state->mux_data) | |
| 470 | 487 | { |
| 471 | 488 | case 0x01: return input_port_read(space->machine, "PL1_01"); |
| 472 | 489 | case 0x02: return input_port_read(space->machine, "PL1_02"); |
| r10886 | r10887 | |
| 1107 | 1124 | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 0x100 ) |
| 1108 | 1125 | GFXDECODE_END |
| 1109 | 1126 | |
| 1110 | static MACHINE_CONFIG_START( pinkiri8, | |
| 1127 | static MACHINE_CONFIG_START( pinkiri8, p | |
| 1111 | 1128 | MCFG_CPU_ADD("maincpu",Z180,16000000) |
| 1112 | 1129 | MCFG_CPU_PROGRAM_MAP(pinkiri8_map) |
| 1113 | 1130 | MCFG_CPU_IO_MAP(pinkiri8_io) |
| r10886 | r10887 | |
| 1189 | 1206 | ROM_LOAD( "eagle.6", 0x00000, 0x40000, CRC(8197034d) SHA1(b501dc7a27b1faad1361c309afd726da14b8b5f5) ) |
| 1190 | 1207 | ROM_END |
| 1191 | 1208 | |
| 1192 | static UINT8 prot_read_index; | |
| 1193 | 1209 | |
| 1194 | 1210 | static READ8_HANDLER( ronjan_prot_r ) |
| 1195 | 1211 | { |
| 1212 | pinkiri8_state *state = space->machine->driver_data<pinkiri8_state>(); | |
| 1196 | 1213 | static const char wing_str[6] = { 'W', 'I', 'N', 'G', '8', '9' }; |
| 1197 | 1214 | |
| 1198 | prot_read_index++; | |
| 1215 | state->prot_read_index++; | |
| 1199 | 1216 | |
| 1200 | if(prot_read_index & 1) | |
| 1217 | if(state->prot_read_index & 1) | |
| 1201 | 1218 | return 0xff; //value is discarded |
| 1202 | 1219 | |
| 1203 | return wing_str[(prot_read_index >> 1)-1]; | |
| 1220 | return wing_str[(state->prot_read_index >> 1)-1]; | |
| 1204 | 1221 | } |
| 1205 | 1222 | |
| 1206 | 1223 | static WRITE8_HANDLER( ronjan_prot_w ) |
| 1207 | 1224 | { |
| 1208 | stat | |
| 1225 | pinkiri8_state | |
| 1209 | 1226 | |
| 1210 | 1227 | if(data == 0) |
| 1211 | 1228 | { |
| 1212 | prot_index = 0; | |
| 1229 | state->prot_index = 0; | |
| 1213 | 1230 | } |
| 1214 | 1231 | else |
| 1215 | 1232 | { |
| 1216 | prot_char[prot_index] = data; | |
| 1217 | prot_index++; | |
| 1233 | state->prot_char[state->prot_index] = data; | |
| 1234 | state->prot_index++; | |
| 1218 | 1235 | |
| 1219 | if(prot_char[0] == 'E' && prot_char[1] == 'R' && prot_char[2] == 'R' && prot_char[3] == 'O' && prot_char[4] == 'R') | |
| 1220 | prot_read_index = 0; | |
| 1236 | if(state->prot_char[0] == 'E' && state->prot_char[1] == 'R' && state->prot_char[2] == 'R' && state->prot_char[3] == 'O' && state->prot_char[4] == 'R') | |
| 1237 | state->prot_read_index = 0; | |
| 1221 | 1238 | } |
| 1222 | 1239 | } |
| 1223 | 1240 |
| r10886 | r10887 | |
|---|---|---|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
| 259 | static int wdog; | |
| 260 | ||
| 261 | 259 | static WRITE8_HANDLER( watchdog1_w ) |
| 262 | 260 | { |
| 263 | wdog |= 1; | |
| 264 | if (wdog == 3) | |
| 261 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 262 | state->wdog |= 1; | |
| 263 | if (state->wdog == 3) | |
| 265 | 264 | { |
| 266 | wdog = 0; | |
| 265 | state->wdog = 0; | |
| 267 | 266 | watchdog_reset_w(space,0,0); |
| 268 | 267 | } |
| 269 | 268 | } |
| 270 | 269 | |
| 271 | 270 | static WRITE8_HANDLER( watchdog2_w ) |
| 272 | 271 | { |
| 273 | wdog |= 2; | |
| 274 | if (wdog == 3) | |
| 272 | namcos86_state *state = space->machine->driver_data<namcos86_state>(); | |
| 273 | state->wdog |= 2; | |
| 274 | if (state->wdog == 3) | |
| 275 | 275 | { |
| 276 | wdog = 0; | |
| 276 | state->wdog = 0; | |
| 277 | 277 | watchdog_reset_w(space,0,0); |
| 278 | 278 | } |
| 279 | 279 | } |
| r10886 | r10887 | |
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | static ADDRESS_MAP_START( cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 337 | AM_RANGE(0x0000, 0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) AM_BASE(&rthunder_videoram1) | |
| 338 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) AM_BASE(&rthunder_videoram2) | |
| 337 | AM_RANGE(0x0000, 0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) AM_BASE_MEMBER(namcos86_state, rthunder_videoram1) | |
| 338 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) AM_BASE_MEMBER(namcos86_state, rthunder_videoram2) | |
| 339 | 339 | |
| 340 | 340 | AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ |
| 341 | 341 | |
| r10886 | r10887 | |
| 365 | 365 | |
| 366 | 366 | #define CPU2_MEMORY(NAME,ADDR_SPRITE,ADDR_VIDEO1,ADDR_VIDEO2,ADDR_ROM,ADDR_BANK,ADDR_WDOG,ADDR_INT) \ |
| 367 | 367 | static ADDRESS_MAP_START( NAME##_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) \ |
| 368 | AM_RANGE(ADDR_SPRITE+0x0000, ADDR_SPRITE+0x1fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w) AM_BASE( | |
| 368 | AM_RANGE(ADDR_SPRITE+0x0000, ADDR_SPRITE+0x1fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w) AM_BASE_MEMBER(namcos86_state, rthunder_spriteram) \ | |
| 369 | 369 | AM_RANGE(ADDR_VIDEO1+0x0000, ADDR_VIDEO1+0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) \ |
| 370 | 370 | AM_RANGE(ADDR_VIDEO2+0x0000, ADDR_VIDEO2+0x1fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) \ |
| 371 | 371 | AM_RANGE(ADDR_ROM+0x0000, ADDR_ROM+0x1fff) AM_ROMBANK("bank2") \ |
| r10886 | r10887 | |
|---|---|---|
| 15 | 15 | #include "sound/dac.h" |
| 16 | 16 | #include "machine/nvram.h" |
| 17 | 17 | |
| 18 | static int chsuper_tilexor; | |
| 19 | 18 | |
| 19 | class chsuper_state : public driver_device | |
| 20 | { | |
| 21 | public: | |
| 22 | chsuper_state(running_machine &machine, const driver_device_config_base &config) | |
| 23 | : driver_device(machine, config) { } | |
| 24 | ||
| 25 | int tilexor; | |
| 26 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 27 | }; | |
| 28 | ||
| 29 | ||
| 30 | ||
| 20 | 31 | static VIDEO_START(chsuper) |
| 21 | 32 | { |
| 22 | 33 | } |
| 23 | 34 | |
| 24 | 35 | static SCREEN_UPDATE(chsuper) |
| 25 | 36 | { |
| 37 | //chsuper_state *state = screen->machine->driver_data<chsuper_state>(); | |
| 26 | 38 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 27 | 39 | UINT8 *vram = screen->machine->region("vram")->base(); |
| 28 | 40 | int count = 0x0000; |
| r10886 | r10887 | |
| 34 | 46 | { |
| 35 | 47 | int tile = ((vram[count+1]<<8) | vram[count]) & 0xffff; |
| 36 | 48 | |
| 37 | //tile ^= | |
| 49 | //tile ^= | |
| 38 | 50 | |
| 39 | 51 | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*4,y*8); |
| 40 | 52 | count+=2; |
| r10886 | r10887 | |
| 46 | 58 | |
| 47 | 59 | static WRITE8_HANDLER( paletteram_io_w ) |
| 48 | 60 | { |
| 49 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 50 | ||
| 61 | chsuper_state *state = space->machine->driver_data<chsuper_state>(); | |
| 51 | 62 | switch(offset) |
| 52 | 63 | { |
| 53 | 64 | case 0: |
| 54 | pal | |
| 65 | state->pal.offs = data; | |
| 55 | 66 | break; |
| 56 | 67 | case 2: |
| 57 | | |
| 68 | s | |
| 58 | 69 | break; |
| 59 | 70 | case 1: |
| 60 | switch( | |
| 71 | switch(s | |
| 61 | 72 | { |
| 62 | 73 | case 0: |
| 63 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 64 | internal_pal_offs++; | |
| 74 | state->pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 75 | state->pal.offs_internal++; | |
| 65 | 76 | break; |
| 66 | 77 | case 1: |
| 67 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 68 | internal_pal_offs++; | |
| 78 | state->pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 79 | state->pal.offs_internal++; | |
| 69 | 80 | break; |
| 70 | 81 | case 2: |
| 71 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 72 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 73 | internal_pal_offs = 0; | |
| 74 | pal_offs++; | |
| 82 | state->pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 83 | palette_set_color(space->machine, state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 84 | state->pal.offs_internal = 0; | |
| 85 | state->pal.offs++; | |
| 75 | 86 | break; |
| 76 | 87 | } |
| 77 | 88 | |
| r10886 | r10887 | |
| 190 | 201 | GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 0, 1 ) |
| 191 | 202 | GFXDECODE_END |
| 192 | 203 | |
| 193 | static MACHINE_CONFIG_START( chsuper, | |
| 204 | static MACHINE_CONFIG_START( chsuper, chsuper_stat | |
| 194 | 205 | |
| 195 | 206 | /* basic machine hardware */ |
| 196 | 207 | MCFG_CPU_ADD("maincpu", Z180, XTAL_12MHz / 2) /* HD64180RP8, 8 MHz? */ |
| r10886 | r10887 | |
| 269 | 280 | |
| 270 | 281 | static DRIVER_INIT( chsuper2 ) |
| 271 | 282 | { |
| 283 | chsuper_state *state = machine->driver_data<chsuper_state>(); | |
| 272 | 284 | UINT8 *buffer; |
| 273 | 285 | UINT8 *rom = machine->region("gfx1")->base(); |
| 274 | 286 | int i; |
| 275 | 287 | |
| 276 | | |
| 288 | | |
| 277 | 289 | |
| 278 | 290 | buffer = auto_alloc_array(machine, UINT8, 0x100000); |
| 279 | 291 | |
| r10886 | r10887 | |
| 281 | 293 | { |
| 282 | 294 | int j; |
| 283 | 295 | |
| 284 | j = i ^ ( | |
| 296 | j = i ^ ( | |
| 285 | 297 | |
| 286 | 298 | buffer[j] = rom[i]; |
| 287 | 299 | } |
| 288 | 300 | |
| 289 | 301 | memcpy(rom,buffer,0x100000); |
| 290 | 302 | |
| 291 | | |
| 303 | | |
| 292 | 304 | } |
| 293 | 305 | |
| 294 | 306 | static DRIVER_INIT( chsuper3 ) |
| 295 | 307 | { |
| 308 | chsuper_state *state = machine->driver_data<chsuper_state>(); | |
| 296 | 309 | UINT8 *buffer; |
| 297 | 310 | UINT8 *rom = machine->region("gfx1")->base(); |
| 298 | 311 | int i; |
| 299 | 312 | |
| 300 | | |
| 313 | | |
| 301 | 314 | |
| 302 | 315 | buffer = auto_alloc_array(machine, UINT8, 0x100000); |
| 303 | 316 | |
| r10886 | r10887 | |
| 305 | 318 | { |
| 306 | 319 | int j; |
| 307 | 320 | |
| 308 | j = i ^ ( | |
| 321 | j = i ^ ( | |
| 309 | 322 | |
| 310 | 323 | buffer[j] = rom[i]; |
| 311 | 324 | } |
| 312 | 325 | |
| 313 | 326 | memcpy(rom,buffer,0x100000); |
| 314 | 327 | |
| 315 | | |
| 328 | | |
| 316 | 329 | } |
| 317 | 330 | |
| 318 | 331 | static DRIVER_INIT( chmpnum ) |
| 319 | 332 | { |
| 333 | chsuper_state *state = machine->driver_data<chsuper_state>(); | |
| 320 | 334 | UINT8 *buffer; |
| 321 | 335 | UINT8 *rom = machine->region("gfx1")->base(); |
| 322 | 336 | int i; |
| 323 | 337 | |
| 324 | | |
| 338 | | |
| 325 | 339 | |
| 326 | 340 | buffer = auto_alloc_array(machine, UINT8, 0x100000); |
| 327 | 341 | |
| r10886 | r10887 | |
| 329 | 343 | { |
| 330 | 344 | int j; |
| 331 | 345 | |
| 332 | j = i ^ ( | |
| 346 | j = i ^ ( | |
| 333 | 347 | |
| 334 | 348 | j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); |
| 335 | 349 | j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); |
| r10886 | r10887 | |
| 340 | 354 | |
| 341 | 355 | memcpy(rom,buffer,0x100000); |
| 342 | 356 | |
| 343 | | |
| 357 | | |
| 344 | 358 | } |
| 345 | 359 | |
| 346 | 360 |
| r10886 | r10887 | |
|---|---|---|
| 13 | 13 | #include "cpu/z80/z80.h" |
| 14 | 14 | #include "sound/speaker.h" |
| 15 | 15 | |
| 16 | /************************************* | |
| 17 | * | |
| 18 | * Globals | |
| 19 | * | |
| 20 | *************************************/ | |
| 21 | 16 | |
| 22 | static UINT8 *spectrum_video_ram; | |
| 23 | static int spectrum_frame_number; /* Used for handling FLASH 1 */ | |
| 24 | static int spectrum_flash_invert; | |
| 25 | static UINT8 spectrum_port_fe; | |
| 26 | static UINT8 nmi_enable = 0; | |
| 17 | class photon2_state : public driver_device | |
| 18 | { | |
| 19 | public: | |
| 20 | photon2_state(running_machine &machine, const driver_device_config_base &config) | |
| 21 | : driver_device(machine, config) { } | |
| 27 | 22 | |
| 23 | UINT8 *spectrum_video_ram; | |
| 24 | int spectrum_frame_number; | |
| 25 | int spectrum_flash_invert; | |
| 26 | UINT8 spectrum_port_fe; | |
| 27 | UINT8 nmi_enable; | |
| 28 | }; | |
| 28 | 29 | |
| 30 | ||
| 29 | 31 | /************************************* |
| 30 | 32 | * |
| 31 | 33 | * Video (copied from MESS apart from support |
| r10886 | r10887 | |
| 79 | 81 | |
| 80 | 82 | static VIDEO_START( spectrum ) |
| 81 | 83 | { |
| 82 | spectrum_frame_number = 0; | |
| 83 | spectrum_flash_invert = 0; | |
| 84 | photon2_state *state = machine->driver_data<photon2_state>(); | |
| 85 | state->spectrum_frame_number = 0; | |
| 86 | state->spectrum_flash_invert = 0; | |
| 84 | 87 | } |
| 85 | 88 | |
| 86 | 89 | /* return the color to be used inverting FLASHing colors if necessary */ |
| r10886 | r10887 | |
| 96 | 99 | independent of frame skip etc. */ |
| 97 | 100 | static SCREEN_EOF( spectrum ) |
| 98 | 101 | { |
| 99 | spectrum_frame_number++; | |
| 100 | if (spectrum_frame_number >= 25) | |
| 102 | photon2_state *state = machine->driver_data<photon2_state>(); | |
| 103 | state->spectrum_frame_number++; | |
| 104 | if (state->spectrum_frame_number >= 25) | |
| 101 | 105 | { |
| 102 | spectrum_frame_number = 0; | |
| 103 | spectrum_flash_invert = !spectrum_flash_invert; | |
| 106 | state->spectrum_frame_number = 0; | |
| 107 | state->spectrum_flash_invert = !state->spectrum_flash_invert; | |
| 104 | 108 | } |
| 105 | 109 | } |
| 106 | 110 | |
| r10886 | r10887 | |
| 111 | 115 | |
| 112 | 116 | static SCREEN_UPDATE( spectrum ) |
| 113 | 117 | { |
| 118 | photon2_state *state = screen->machine->driver_data<photon2_state>(); | |
| 114 | 119 | /* for now do a full-refresh */ |
| 115 | 120 | int x, y, b, scrx, scry; |
| 116 | 121 | unsigned short ink, pap; |
| 117 | 122 | unsigned char *attr, *scr; |
| 118 | 123 | // int full_refresh = 1; |
| 119 | 124 | |
| 120 | scr=spectrum_video_ram; | |
| 125 | scr=state->spectrum_video_ram; | |
| 121 | 126 | |
| 122 | bitmap_fill(bitmap, cliprect, spectrum_port_fe & 0x07); | |
| 127 | bitmap_fill(bitmap, cliprect, state->spectrum_port_fe & 0x07); | |
| 123 | 128 | |
| 124 | 129 | for (y=0; y<192; y++) |
| 125 | 130 | { |
| 126 | 131 | scrx=SPEC_LEFT_BORDER; |
| 127 | 132 | scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); |
| 128 | attr=spectrum_video_ram + ((scry>>3)*32) + 0x1800; | |
| 133 | attr=state->spectrum_video_ram + ((scry>>3)*32) + 0x1800; | |
| 129 | 134 | |
| 130 | 135 | for (x=0;x<32;x++) |
| 131 | 136 | { |
| 132 | 137 | /* Get ink and paper colour with bright */ |
| 133 | if (spectrum_flash_invert && (*attr & 0x80)) | |
| 138 | if (state->spectrum_flash_invert && (*attr & 0x80)) | |
| 134 | 139 | { |
| 135 | 140 | ink=((*attr)>>3) & 0x0f; |
| 136 | 141 | pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); |
| r10886 | r10887 | |
| 192 | 197 | |
| 193 | 198 | static WRITE8_HANDLER(photon2_fe_w) |
| 194 | 199 | { |
| 200 | photon2_state *state = space->machine->driver_data<photon2_state>(); | |
| 195 | 201 | device_t *speaker = space->machine->device("speaker"); |
| 196 | spectrum_port_fe = data; | |
| 202 | state->spectrum_port_fe = data; | |
| 197 | 203 | |
| 198 | 204 | speaker_level_w(speaker, BIT(data,4)); |
| 199 | 205 | } |
| 200 | 206 | |
| 201 | 207 | static WRITE8_HANDLER(photon2_misc_w) |
| 202 | 208 | { |
| 203 | nmi_enable = !BIT(data,5); | |
| 209 | photon2_state *state = space->machine->driver_data<photon2_state>(); | |
| 210 | state->nmi_enable = !BIT(data,5); | |
| 204 | 211 | } |
| 205 | 212 | |
| 206 | 213 | /************************************* |
| r10886 | r10887 | |
| 211 | 218 | |
| 212 | 219 | static ADDRESS_MAP_START (spectrum_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 213 | 220 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") |
| 214 | AM_RANGE(0x4000, 0x5aff) AM_RAM AM_BASE( | |
| 221 | AM_RANGE(0x4000, 0x5aff) AM_RAM AM_BASE_MEMBER(photon2_state, spectrum_video_ram ) | |
| 215 | 222 | AM_RANGE(0x5b00, 0xffff) AM_RAM |
| 216 | 223 | ADDRESS_MAP_END |
| 217 | 224 | |
| r10886 | r10887 | |
| 278 | 285 | |
| 279 | 286 | static INTERRUPT_GEN( spec_interrupt_hack ) |
| 280 | 287 | { |
| 288 | photon2_state *state = device->machine->driver_data<photon2_state>(); | |
| 281 | 289 | if (cpu_getiloops(device) == 1) |
| 282 | 290 | { |
| 283 | 291 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 284 | 292 | } |
| 285 | 293 | else |
| 286 | 294 | { |
| 287 | if ( nmi_enable ) | |
| 295 | if ( state->nmi_enable ) | |
| 288 | 296 | { |
| 289 | 297 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 290 | 298 | } |
| r10886 | r10887 | |
| 296 | 304 | memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base()); |
| 297 | 305 | } |
| 298 | 306 | |
| 299 | static MACHINE_CONFIG_START( photon2, | |
| 307 | static MACHINE_CONFIG_START( photon2, photon2_stat | |
| 300 | 308 | /* basic machine hardware */ |
| 301 | 309 | MCFG_CPU_ADD("maincpu", Z80, 3500000) /* 3.5 MHz */ |
| 302 | 310 | MCFG_CPU_PROGRAM_MAP(spectrum_mem) |
| r10886 | r10887 | |
|---|---|---|
| 64 | 64 | #include "sound/ay8910.h" |
| 65 | 65 | |
| 66 | 66 | |
| 67 | class nsmpoker_state : public driver_device | |
| 68 | { | |
| 69 | public: | |
| 70 | nsmpoker_state(running_machine &machine, const driver_device_config_base &config) | |
| 71 | : driver_device(machine, config) { } | |
| 72 | ||
| 73 | UINT8 *videoram; | |
| 74 | UINT8 *colorram; | |
| 75 | tilemap_t *bg_tilemap; | |
| 76 | }; | |
| 77 | ||
| 78 | ||
| 67 | 79 | /************************* |
| 68 | 80 | * Video Hardware * |
| 69 | 81 | *************************/ |
| 70 | 82 | |
| 71 | static UINT8 *videoram; | |
| 72 | static UINT8 *colorram; | |
| 73 | static tilemap_t *bg_tilemap; | |
| 74 | 83 | |
| 75 | ||
| 76 | 84 | static WRITE8_HANDLER( nsmpoker_videoram_w ) |
| 77 | 85 | { |
| 78 | videoram[offset] = data; | |
| 79 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 86 | nsmpoker_state *state = space->machine->driver_data<nsmpoker_state>(); | |
| 87 | state->videoram[offset] = data; | |
| 88 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 80 | 89 | } |
| 81 | 90 | |
| 82 | 91 | |
| 83 | 92 | static WRITE8_HANDLER( nsmpoker_colorram_w ) |
| 84 | 93 | { |
| 85 | colorram[offset] = data; | |
| 86 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 94 | nsmpoker_state *state = space->machine->driver_data<nsmpoker_state>(); | |
| 95 | state->colorram[offset] = data; | |
| 96 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 87 | 97 | } |
| 88 | 98 | |
| 89 | 99 | |
| 90 | 100 | static TILE_GET_INFO( get_bg_tile_info ) |
| 91 | 101 | { |
| 102 | nsmpoker_state *state = machine->driver_data<nsmpoker_state>(); | |
| 92 | 103 | /* - bits - |
| 93 | 104 | 7654 3210 |
| 94 | 105 | ---- ---- bank select. |
| 95 | 106 | ---- ---- color code. |
| 96 | 107 | ---- ---- seems unused. |
| 97 | 108 | */ |
| 98 | // int attr = colorram[tile_index]; | |
| 99 | int code = videoram[tile_index]; | |
| 109 | // int attr = state->colorram[tile_index]; | |
| 110 | int code = state->videoram[tile_index]; | |
| 100 | 111 | // int bank = (attr & 0x08) >> 3; |
| 101 | 112 | // int color = (attr & 0x03); |
| 102 | 113 | |
| r10886 | r10887 | |
| 106 | 117 | |
| 107 | 118 | static VIDEO_START( nsmpoker ) |
| 108 | 119 | { |
| 109 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 120 | nsmpoker_state *state = machine->driver_data<nsmpoker_state>(); | |
| 121 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 110 | 122 | } |
| 111 | 123 | |
| 112 | 124 | |
| 113 | 125 | static SCREEN_UPDATE( nsmpoker ) |
| 114 | 126 | { |
| 115 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 127 | nsmpoker_state *state = screen->machine->driver_data<nsmpoker_state>(); | |
| 128 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 116 | 129 | return 0; |
| 117 | 130 | } |
| 118 | 131 | |
| r10886 | r10887 | |
| 151 | 164 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 152 | 165 | AM_RANGE(0x9000, 0xafff) AM_RAM // OK... cleared at beginning. |
| 153 | 166 | AM_RANGE(0xb000, 0xcfff) AM_ROM // WRONG... just to map the last rom somewhere. |
| 154 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(nsmpoker_videoram_w) AM_BASE(&videoram) // WRONG... just a placeholder. | |
| 155 | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(nsmpoker_colorram_w) AM_BASE(&colorram) // WRONG... just a placeholder. | |
| 167 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(nsmpoker_videoram_w) AM_BASE_MEMBER(nsmpoker_state, videoram) // WRONG... just a placeholder. | |
| 168 | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(nsmpoker_colorram_w) AM_BASE_MEMBER(nsmpoker_state, colorram) // WRONG... just a placeholder. | |
| 156 | 169 | ADDRESS_MAP_END |
| 157 | 170 | |
| 158 | 171 | static ADDRESS_MAP_START( nsmpoker_portmap, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 374 | 387 | * Machine Drivers * |
| 375 | 388 | *************************/ |
| 376 | 389 | |
| 377 | static MACHINE_CONFIG_START( nsmpoker, | |
| 390 | static MACHINE_CONFIG_START( nsmpoker, nsmpoker_stat | |
| 378 | 391 | |
| 379 | 392 | /* basic machine hardware */ |
| 380 | 393 | MCFG_CPU_ADD("maincpu", TMS9995, MASTER_CLOCK/2) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 414 | 414 | //#include "machine/z80pio.h" |
| 415 | 415 | |
| 416 | 416 | |
| 417 | class avt_state : public driver_device | |
| 418 | { | |
| 419 | public: | |
| 420 | avt_state(running_machine &machine, const driver_device_config_base &config) | |
| 421 | : driver_device(machine, config) { } | |
| 422 | ||
| 423 | UINT8 *videoram; | |
| 424 | UINT8 *colorram; | |
| 425 | tilemap_t *bg_tilemap; | |
| 426 | }; | |
| 427 | ||
| 428 | ||
| 429 | ||
| 417 | 430 | /********************************************* |
| 418 | 431 | * Video Hardware * |
| 419 | 432 | *********************************************/ |
| 420 | 433 | |
| 421 | static UINT8 *videoram; | |
| 422 | static UINT8 *colorram; | |
| 423 | static tilemap_t *bg_tilemap; | |
| 424 | 434 | |
| 425 | ||
| 426 | 435 | static WRITE8_HANDLER( avt_videoram_w ) |
| 427 | 436 | { |
| 428 | videoram[offset] = data; | |
| 429 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 437 | avt_state *state = space->machine->driver_data<avt_state>(); | |
| 438 | state->videoram[offset] = data; | |
| 439 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 430 | 440 | } |
| 431 | 441 | |
| 432 | 442 | |
| 433 | 443 | static WRITE8_HANDLER( avt_colorram_w ) |
| 434 | 444 | { |
| 435 | colorram[offset] = data; | |
| 436 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 445 | avt_state *state = space->machine->driver_data<avt_state>(); | |
| 446 | state->colorram[offset] = data; | |
| 447 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 437 | 448 | } |
| 438 | 449 | |
| 439 | 450 | |
| 440 | 451 | static TILE_GET_INFO( get_bg_tile_info ) |
| 441 | 452 | { |
| 453 | avt_state *state = machine->driver_data<avt_state>(); | |
| 442 | 454 | /* - bits - |
| 443 | 455 | 7654 3210 |
| 444 | 456 | xxxx ---- color code. |
| 445 | 457 | ---- xxxx seems unused. |
| 446 | 458 | */ |
| 447 | int attr = colorram[tile_index]; | |
| 448 | int code = videoram[tile_index]; | |
| 459 | int attr = state->colorram[tile_index]; | |
| 460 | int code = state->videoram[tile_index]; | |
| 449 | 461 | int color = (attr & 0xf0)>>4; |
| 450 | 462 | |
| 451 | 463 | SET_TILE_INFO( 0, code, color, 0); |
| r10886 | r10887 | |
| 454 | 466 | |
| 455 | 467 | static VIDEO_START( avt ) |
| 456 | 468 | { |
| 457 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 28, 32); | |
| 469 | avt_state *state = machine->driver_data<avt_state>(); | |
| 470 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 28, 32); | |
| 458 | 471 | } |
| 459 | 472 | |
| 460 | 473 | |
| 461 | 474 | static SCREEN_UPDATE( avt ) |
| 462 | 475 | { |
| 463 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 476 | avt_state *state = screen->machine->driver_data<avt_state>(); | |
| 477 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 464 | 478 | return 0; |
| 465 | 479 | } |
| 466 | 480 | |
| r10886 | r10887 | |
| 535 | 549 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 536 | 550 | AM_RANGE(0x6000, 0x7fff) AM_RAM |
| 537 | 551 | AM_RANGE(0x8000, 0x9fff) AM_RAM // AM_SHARE("nvram") |
| 538 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(avt_videoram_w) AM_BASE(&videoram) | |
| 539 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(avt_colorram_w) AM_BASE(&colorram) | |
| 552 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(avt_videoram_w) AM_BASE_MEMBER(avt_state, videoram) | |
| 553 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(avt_colorram_w) AM_BASE_MEMBER(avt_state, colorram) | |
| 540 | 554 | ADDRESS_MAP_END |
| 541 | 555 | |
| 542 | 556 | static ADDRESS_MAP_START( avt_portmap, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 796 | 810 | * Machine Drivers * |
| 797 | 811 | *********************************************/ |
| 798 | 812 | |
| 799 | static MACHINE_CONFIG_START( avt, | |
| 813 | static MACHINE_CONFIG_START( avt, a | |
| 800 | 814 | |
| 801 | 815 | /* basic machine hardware */ |
| 802 | 816 | MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 161 | 161 | /* misc */ |
| 162 | 162 | UINT8 mux_data; |
| 163 | 163 | UINT8 register_active; |
| 164 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 164 | 165 | |
| 165 | 166 | /* devices */ |
| 166 | 167 | device_t *maincpu; |
| r10886 | r10887 | |
| 415 | 416 | |
| 416 | 417 | static READ8_DEVICE_HANDLER(t2_r) |
| 417 | 418 | { |
| 418 | static UINT8 res; | |
| 419 | static int h,w; | |
| 419 | UINT8 res; | |
| 420 | int h,w; | |
| 420 | 421 | res = 0; |
| 421 | 422 | h = device->machine->primary_screen->height(); |
| 422 | 423 | w = device->machine->primary_screen->width(); |
| r10886 | r10887 | |
| 464 | 465 | |
| 465 | 466 | static WRITE8_HANDLER( ramdac_io_w ) |
| 466 | 467 | { |
| 467 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 468 | ||
| 468 | adp_state *state = space->machine->driver_data<adp_state>(); | |
| 469 | 469 | switch(offset) |
| 470 | 470 | { |
| 471 | 471 | case 0: |
| 472 | pal_offs = data; | |
| 473 | internal_pal_offs = 0; | |
| 472 | state->pal.offs = data; | |
| 473 | state->pal.offs_internal = 0; | |
| 474 | 474 | break; |
| 475 | 475 | case 2: |
| 476 | 476 | //mask pen reg |
| 477 | 477 | break; |
| 478 | 478 | case 1: |
| 479 | switch( | |
| 479 | switch(s | |
| 480 | 480 | { |
| 481 | 481 | case 0: |
| 482 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 483 | internal_pal_offs++; | |
| 482 | state->pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 483 | state->pal.offs_internal++; | |
| 484 | 484 | break; |
| 485 | 485 | case 1: |
| 486 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 487 | internal_pal_offs++; | |
| 486 | state->pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 487 | state->pal.offs_internal++; | |
| 488 | 488 | break; |
| 489 | 489 | case 2: |
| 490 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 491 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 492 | internal_pal_offs = 0; | |
| 493 | pal_offs++; | |
| 494 | pal_offs&=0xff; | |
| 490 | state->pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 491 | palette_set_color(space->machine, state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 492 | state->pal.offs_internal = 0; | |
| 493 | state->pal.offs++; | |
| 494 | state->pal.offs&=0xff; | |
| 495 | 495 | break; |
| 496 | 496 | } |
| 497 | 497 |
| r10886 | r10887 | |
|---|---|---|
| 70 | 70 | #include "sound/hc55516.h" |
| 71 | 71 | #include "sound/beep.h" |
| 72 | 72 | |
| 73 | ||
| 74 | class pcxt_state : public driver_device | |
| 75 | { | |
| 76 | public: | |
| 77 | pcxt_state(running_machine &machine, const driver_device_config_base &config) | |
| 78 | : driver_device(machine, config) { } | |
| 79 | ||
| 80 | UINT8 *vga_vram; | |
| 81 | UINT8 *work_ram; | |
| 82 | UINT8 video_regs[0x19]; | |
| 83 | UINT8 *vga_mode; | |
| 84 | UINT8 hv_blank; | |
| 85 | UINT8 *vga_bg_bank; | |
| 86 | int bank; | |
| 87 | int lastvalue; | |
| 88 | UINT8 video_index; | |
| 89 | UINT8 disk_data[2]; | |
| 90 | UINT8 port_b_data; | |
| 91 | UINT8 wss1_data; | |
| 92 | UINT8 wss2_data; | |
| 93 | UINT8 status; | |
| 94 | UINT8 clr_status; | |
| 95 | UINT8 drive_data; | |
| 96 | int dma_channel; | |
| 97 | UINT8 dma_offset[2][4]; | |
| 98 | UINT8 at_pages[0x10]; | |
| 99 | ||
| 100 | device_t *pit8253; | |
| 101 | device_t *pic8259_1; | |
| 102 | device_t *pic8259_2; | |
| 103 | device_t *dma8237_1; | |
| 104 | device_t *dma8237_2; | |
| 105 | }; | |
| 106 | ||
| 107 | ||
| 73 | 108 | #define SET_VISIBLE_AREA(_x_,_y_) \ |
| 74 | 109 | { \ |
| 75 | 110 | rectangle visarea; \ |
| r10886 | r10887 | |
| 81 | 116 | } \ |
| 82 | 117 | |
| 83 | 118 | |
| 84 | static UINT8 *vga_vram,*work_ram; | |
| 85 | static UINT8 video_regs[0x19]; | |
| 86 | static UINT8 *vga_mode; | |
| 87 | static UINT8 hv_blank; | |
| 88 | static UINT8 *vga_bg_bank; | |
| 89 | ||
| 90 | static int bank; | |
| 91 | static int lastvalue; | |
| 92 | ||
| 93 | 119 | /*Add here Video regs defines...*/ |
| 94 | 120 | |
| 95 | 121 | |
| r10886 | r10887 | |
| 113 | 139 | ---- x--- Vertical Retrace |
| 114 | 140 | ---- ---x Horizontal Retrace |
| 115 | 141 | */ |
| 116 | static UINT8 res; | |
| 117 | static int h,w; | |
| 142 | UINT8 res; | |
| 143 | int h,w; | |
| 118 | 144 | res = 0; |
| 119 | 145 | h = space->machine->primary_screen->height(); |
| 120 | 146 | w = space->machine->primary_screen->width(); |
| r10886 | r10887 | |
| 134 | 160 | /*TODO: non-black colours should use the bright versions*/ |
| 135 | 161 | static void cga_graphic_bitmap(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs) |
| 136 | 162 | { |
| 137 | static UINT16 x,y; | |
| 138 | static UINT32 offs; | |
| 163 | pcxt_state *state = machine->driver_data<pcxt_state>(); | |
| 164 | UINT16 x,y; | |
| 165 | UINT32 offs; | |
| 139 | 166 | |
| 140 | 167 | SET_VISIBLE_AREA(320,200); |
| 141 | 168 | offs = map_offs; |
| 142 | 169 | for(y=0;y<200;y+=2) |
| 143 | 170 | for(x=0;x<320;x+=4) |
| 144 | 171 | { |
| 145 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 146 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 147 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 148 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 172 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((state->vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 173 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((state->vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 174 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((state->vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 175 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((state->vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 149 | 176 | offs++; |
| 150 | 177 | } |
| 151 | 178 | |
| r10886 | r10887 | |
| 153 | 180 | for(y=1;y<200;y+=2) |
| 154 | 181 | for(x=0;x<320;x+=4) |
| 155 | 182 | { |
| 156 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 157 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 158 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 159 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 183 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((state->vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 184 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((state->vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 185 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((state->vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 186 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((state->vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 160 | 187 | offs++; |
| 161 | 188 | } |
| 162 | 189 | |
| r10886 | r10887 | |
| 166 | 193 | |
| 167 | 194 | static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs,UINT8 gfx_num) |
| 168 | 195 | { |
| 169 | static UINT32 offs,x,y,max_x,max_y; | |
| 196 | pcxt_state *state = machine->driver_data<pcxt_state>(); | |
| 197 | UINT32 offs,x,y,max_x,max_y; | |
| 170 | 198 | |
| 171 | 199 | /*define the visible area*/ |
| 172 | 200 | switch(size) |
| r10886 | r10887 | |
| 181 | 209 | max_x = 80; |
| 182 | 210 | max_y = 25; |
| 183 | 211 | break; |
| 212 | default: | |
| 213 | fatalerror("Unknown size"); | |
| 184 | 214 | } |
| 185 | 215 | |
| 186 | 216 | offs = map_offs; |
| r10886 | r10887 | |
| 188 | 218 | for(y=0;y<max_y;y++) |
| 189 | 219 | for(x=0;x<max_x;x++) |
| 190 | 220 | { |
| 191 | int tile = vga_vram[offs] & 0xff; | |
| 192 | int color = vga_vram[offs+1] & 0xff; | |
| 221 | int tile = state->vga_vram[offs] & 0xff; | |
| 222 | int color = state->vga_vram[offs+1] & 0xff; | |
| 193 | 223 | |
| 194 | 224 | drawgfx_transpen(bitmap,cliprect,machine->gfx[gfx_num], |
| 195 | 225 | tile, |
| r10886 | r10887 | |
| 205 | 235 | |
| 206 | 236 | static SCREEN_UPDATE( filetto ) |
| 207 | 237 | { |
| 238 | pcxt_state *state = screen->machine->driver_data<pcxt_state>(); | |
| 208 | 239 | /* xx1x xxxx Attribute bit 7. 0=blink, 1=Intesity |
| 209 | 240 | xxx1 xxxx 640x200 mode |
| 210 | 241 | xxxx 1xxx Enable video signal |
| r10886 | r10887 | |
| 214 | 245 | */ |
| 215 | 246 | bitmap_fill(bitmap, cliprect, 0); |
| 216 | 247 | |
| 217 | if(vga_mode[0] & 8) | |
| 248 | if(state->vga_mode[0] & 8) | |
| 218 | 249 | { |
| 219 | if(vga_mode[0] & 2) | |
| 250 | if(state->vga_mode[0] & 2) | |
| 220 | 251 | cga_graphic_bitmap(screen->machine,bitmap,cliprect,0,0x18000); |
| 221 | 252 | else |
| 222 | 253 | { |
| 223 | switch(vga_mode[0] & 1) | |
| 254 | switch(state->vga_mode[0] & 1) | |
| 224 | 255 | { |
| 225 | 256 | case 0x00: |
| 226 | 257 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_320x200,0x18000,2); |
| r10886 | r10887 | |
| 237 | 268 | |
| 238 | 269 | static void vga_bitmap_layer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) |
| 239 | 270 | { |
| 271 | pcxt_state *state = machine->driver_data<pcxt_state>(); | |
| 240 | 272 | int x,y,z; |
| 241 | 273 | UINT8 *region = machine->region("user1")->base(); |
| 242 | | |
| 274 | | |
| 243 | 275 | |
| 244 | 276 | /*TODO: might be a different descramble algorythm plus plain bg bank*/ |
| 245 | cur_bank = (((8-vga_bg_bank[0]) & 0x1f)*0x10000); | |
| 277 | cur_bank = (((8-state->vga_bg_bank[0]) & 0x1f)*0x10000); | |
| 246 | 278 | |
| 247 | 279 | for(y=0;y<200;y+=8) |
| 248 | 280 | { |
| r10886 | r10887 | |
| 257 | 289 | /*S3 Video card,VGA*/ |
| 258 | 290 | static SCREEN_UPDATE( tetriskr ) |
| 259 | 291 | { |
| 292 | pcxt_state *state = screen->machine->driver_data<pcxt_state>(); | |
| 260 | 293 | bitmap_fill(bitmap, cliprect, 0); |
| 261 | 294 | |
| 262 | if(vga_mode[0] & 8) | |
| 295 | if(state->vga_mode[0] & 8) | |
| 263 | 296 | { |
| 264 | if(vga_mode[0] & 2) | |
| 297 | if(state->vga_mode[0] & 2) | |
| 265 | 298 | cga_graphic_bitmap(screen->machine,bitmap,cliprect,0,0x18000); |
| 266 | 299 | else |
| 267 | 300 | { |
| 268 | 301 | vga_bitmap_layer(screen->machine,bitmap,cliprect); |
| 269 | 302 | |
| 270 | switch(vga_mode[0] & 1) | |
| 303 | switch(state->vga_mode[0] & 1) | |
| 271 | 304 | { |
| 272 | 305 | case 0x00: |
| 273 | 306 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_320x200,0x18000,0); |
| r10886 | r10887 | |
| 290 | 323 | |
| 291 | 324 | static WRITE8_HANDLER( vga_regs_w ) |
| 292 | 325 | { |
| 293 | stat | |
| 326 | pcxt_state | |
| 294 | 327 | |
| 295 | 328 | if(offset == 0) |
| 296 | 329 | { |
| 297 | video_index = data; | |
| 330 | state->video_index = data; | |
| 298 | 331 | } |
| 299 | 332 | if(offset == 1) |
| 300 | 333 | { |
| 301 | if(video_index <= 0x18) | |
| 334 | if(state->video_index <= 0x18) | |
| 302 | 335 | { |
| 303 | video_regs[video_index] = data; | |
| 304 | //logerror("write %02x to video register [%02x]",data,video_index); | |
| 336 | state->video_regs[state->video_index] = data; | |
| 337 | //logerror("write %02x to video register [%02x]",data,state->video_index); | |
| 305 | 338 | } |
| 306 | 339 | else |
| 307 | logerror("(PC=%05x) Warning: Undefined VGA reg port write (I=%02x D=%02x)\n",cpu_get_pc(space->cpu),video_index,data); | |
| 340 | logerror("(PC=%05x) Warning: Undefined VGA reg port write (I=%02x D=%02x)\n",cpu_get_pc(space->cpu),state->video_index,data); | |
| 308 | 341 | } |
| 309 | 342 | } |
| 310 | 343 | |
| 311 | 344 | static WRITE8_HANDLER( vga_vram_w ) |
| 312 | 345 | { |
| 313 | vga_vram[offset] = data; | |
| 346 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 347 | state->vga_vram[offset] = data; | |
| 314 | 348 | } |
| 315 | 349 | |
| 316 | 350 | /*end of Video HW file*/ |
| 317 | 351 | |
| 318 | static struct { | |
| 319 | device_t *pit8253; | |
| 320 | device_t *pic8259_1; | |
| 321 | device_t *pic8259_2; | |
| 322 | device_t *dma8237_1; | |
| 323 | device_t *dma8237_2; | |
| 324 | } filetto_devices; | |
| 325 | 352 | |
| 326 | 353 | |
| 327 | static UINT8 disk_data[2]; | |
| 328 | 354 | |
| 329 | 355 | static READ8_HANDLER( disk_iobank_r ) |
| 330 | 356 | { |
| 357 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 331 | 358 | //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(space->cpu)); |
| 332 | 359 | //if(offset == 0) return input_port_read(space->machine, "DSW"); |
| 333 | 360 | if(offset == 1) return input_port_read(space->machine, "IN1"); |
| 334 | 361 | |
| 335 | return disk_data[offset]; | |
| 362 | return state->disk_data[offset]; | |
| 336 | 363 | } |
| 337 | 364 | |
| 338 | 365 | static WRITE8_HANDLER( disk_iobank_w ) |
| 339 | 366 | { |
| 367 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 340 | 368 | /* |
| 341 | 369 | BIOS does a single out $0310,$F0 on reset |
| 342 | 370 | |
| r10886 | r10887 | |
| 367 | 395 | } |
| 368 | 396 | else |
| 369 | 397 | { |
| 370 | if((lastvalue == 0xF0) && (data == 0xF2)) | |
| 398 | if((state->lastvalue == 0xF0) && (data == 0xF2)) | |
| 371 | 399 | newbank = 0; |
| 372 | else if ((lastvalue == 0xF1) && (data == 0xF2)) | |
| 400 | else if ((state->lastvalue == 0xF1) && (data == 0xF2)) | |
| 373 | 401 | newbank = 1; |
| 374 | else if ((lastvalue == 0xF0) && (data == 0xF3)) | |
| 402 | else if ((state->lastvalue == 0xF0) && (data == 0xF3)) | |
| 375 | 403 | newbank = 2; |
| 376 | else if ((lastvalue == 0xF1) && (data == 0xF3)) | |
| 404 | else if ((state->lastvalue == 0xF1) && (data == 0xF3)) | |
| 377 | 405 | newbank = 3; |
| 378 | 406 | } |
| 379 | 407 | |
| 380 | 408 | // printf("newbank = %d\n", newbank); |
| 381 | 409 | |
| 382 | if (newbank != bank) | |
| 410 | if (newbank != state->bank) | |
| 383 | 411 | { |
| 384 | bank = newbank; | |
| 385 | memory_set_bankptr(space->machine, "bank1",space->machine->region("user1")->base() + 0x10000 * bank ); | |
| 412 | state->bank = newbank; | |
| 413 | memory_set_bankptr(space->machine, "bank1",space->machine->region("user1")->base() + 0x10000 * state->bank ); | |
| 386 | 414 | } |
| 387 | 415 | |
| 388 | lastvalue = data; | |
| 416 | state->lastvalue = data; | |
| 389 | 417 | |
| 390 | disk_data[offset] = data; | |
| 418 | state->disk_data[offset] = data; | |
| 391 | 419 | } |
| 392 | 420 | |
| 393 | 421 | /********************************* |
| r10886 | r10887 | |
| 413 | 441 | } |
| 414 | 442 | }; |
| 415 | 443 | |
| 416 | static UINT8 port_b_data; | |
| 417 | static UINT8 wss1_data,wss2_data; | |
| 418 | 444 | |
| 419 | 445 | static READ8_DEVICE_HANDLER( port_a_r ) |
| 420 | 446 | { |
| 421 | if(!(port_b_data & 0x80))//??? | |
| 447 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 448 | if(!(state->port_b_data & 0x80))//??? | |
| 422 | 449 | { |
| 423 | 450 | /* |
| 424 | 451 | x--- ---- Undefined (Always 0) |
| r10886 | r10887 | |
| 428 | 455 | ---- --x- 8087 NDP installed |
| 429 | 456 | ---- ---x Undefined (Always 1) |
| 430 | 457 | */ |
| 431 | return wss1_data; | |
| 458 | return state->wss1_data; | |
| 432 | 459 | } |
| 433 | 460 | else//keyboard emulation |
| 434 | 461 | { |
| r10886 | r10887 | |
| 440 | 467 | |
| 441 | 468 | static READ8_DEVICE_HANDLER( port_b_r ) |
| 442 | 469 | { |
| 443 | return port_b_data; | |
| 470 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 471 | return state->port_b_data; | |
| 444 | 472 | } |
| 445 | 473 | |
| 446 | 474 | static READ8_DEVICE_HANDLER( port_c_r ) |
| 447 | 475 | { |
| 448 | return wss2_data;//??? | |
| 476 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 477 | return state->wss2_data;//??? | |
| 449 | 478 | } |
| 450 | 479 | |
| 451 | 480 | /*'buzzer' sound routes here*/ |
| r10886 | r10887 | |
| 453 | 482 | /* The Korean Tetris uses it as a regular buzzer,probably the sound is all in there...*/ |
| 454 | 483 | static WRITE8_DEVICE_HANDLER( port_b_w ) |
| 455 | 484 | { |
| 456 | port_b_data = data; | |
| 485 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 486 | state->port_b_data = data; | |
| 457 | 487 | // device_t *beep = device->machine->device("beep"); |
| 458 | 488 | // device_t *cvsd = device->machine->device("cvsd"); |
| 459 | 489 | // hc55516_digit_w(cvsd, data); |
| 460 | 490 | // popmessage("%02x\n",data); |
| 461 | 491 | // beep_set_state(beep, 0); |
| 462 | 492 | // beep_set_state(beep, 1); |
| 463 | // beep_set_frequency(beep, port_b_data); | |
| 493 | // beep_set_frequency(beep, state->port_b_data); | |
| 464 | 494 | } |
| 465 | 495 | |
| 466 | 496 | static WRITE8_DEVICE_HANDLER( wss_1_w ) |
| 467 | 497 | { |
| 468 | wss1_data = data; | |
| 498 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 499 | state->wss1_data = data; | |
| 469 | 500 | } |
| 470 | 501 | |
| 471 | 502 | static WRITE8_DEVICE_HANDLER( wss_2_w ) |
| 472 | 503 | { |
| 473 | wss2_data = data; | |
| 504 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 505 | state->wss2_data = data; | |
| 474 | 506 | } |
| 475 | 507 | |
| 476 | 508 | static WRITE8_DEVICE_HANDLER( sys_reset_w ) |
| r10886 | r10887 | |
| 501 | 533 | |
| 502 | 534 | /*Floppy Disk Controller 765 device*/ |
| 503 | 535 | /*Currently we only emulate it at a point that the BIOS will pass the checks*/ |
| 504 | static UINT8 status; | |
| 505 | 536 | |
| 506 | 537 | #define FDC_BUSY 0x10 |
| 507 | 538 | #define FDC_WRITE 0x40 |
| r10886 | r10887 | |
| 509 | 540 | |
| 510 | 541 | static READ8_HANDLER( fdc765_status_r ) |
| 511 | 542 | { |
| 512 | static UINT8 tmp,clr_status; | |
| 543 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 544 | UINT8 tmp; | |
| 513 | 545 | // popmessage("Read FDC status @ PC=%05x",cpu_get_pc(space->cpu)); |
| 514 | tmp = status | 0x80; | |
| 515 | clr_status++; | |
| 516 | if(clr_status == 0x10) | |
| 546 | tmp = state->status | 0x80; | |
| 547 | state->clr_status++; | |
| 548 | if(state->clr_status == 0x10) | |
| 517 | 549 | { |
| 518 | status = 0; | |
| 519 | clr_status = 0; | |
| 550 | state->status = 0; | |
| 551 | state->clr_status = 0; | |
| 520 | 552 | } |
| 521 | 553 | return tmp; |
| 522 | 554 | } |
| 523 | 555 | |
| 524 | 556 | static READ8_HANDLER( fdc765_data_r ) |
| 525 | 557 | { |
| 526 | status = (FDC_READ); | |
| 558 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 559 | state->status = (FDC_READ); | |
| 527 | 560 | return 0xc0; |
| 528 | 561 | } |
| 529 | 562 | |
| 530 | 563 | static WRITE8_HANDLER( fdc765_data_w ) |
| 531 | 564 | { |
| 532 | status = (FDC_WRITE); | |
| 565 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 566 | state->status = (FDC_WRITE); | |
| 533 | 567 | } |
| 534 | 568 | |
| 535 | static UINT8 drive_data; | |
| 536 | 569 | |
| 537 | 570 | static WRITE8_HANDLER( drive_selection_w ) |
| 538 | 571 | { |
| 539 | drive_data = data; | |
| 572 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 573 | state->drive_data = data; | |
| 540 | 574 | /*write to this area then expects that location [43e] has the bit 7 activated*/ |
| 541 | work_ram[0x3e] = 0x80; | |
| 575 | state->work_ram[0x3e] = 0x80; | |
| 542 | 576 | } |
| 543 | 577 | |
| 544 | 578 | /****************** |
| 545 | 579 | DMA8237 Controller |
| 546 | 580 | ******************/ |
| 547 | 581 | |
| 548 | static int dma_channel; | |
| 549 | static UINT8 dma_offset[2][4]; | |
| 550 | static UINT8 at_pages[0x10]; | |
| 551 | 582 | |
| 552 | 583 | static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed ) |
| 553 | 584 | { |
| r10886 | r10887 | |
| 560 | 591 | |
| 561 | 592 | static READ8_HANDLER( pc_dma_read_byte ) |
| 562 | 593 | { |
| 563 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 594 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 595 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 564 | 596 | & 0xFF0000; |
| 565 | 597 | |
| 566 | 598 | return space->read_byte(page_offset + offset); |
| r10886 | r10887 | |
| 569 | 601 | |
| 570 | 602 | static WRITE8_HANDLER( pc_dma_write_byte ) |
| 571 | 603 | { |
| 572 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 604 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 605 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 573 | 606 | & 0xFF0000; |
| 574 | 607 | |
| 575 | 608 | space->write_byte(page_offset + offset, data); |
| r10886 | r10887 | |
| 577 | 610 | |
| 578 | 611 | static READ8_HANDLER(dma_page_select_r) |
| 579 | 612 | { |
| 580 | UINT8 data = at_pages[offset % 0x10]; | |
| 613 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 614 | UINT8 data = state->at_pages[offset % 0x10]; | |
| 581 | 615 | |
| 582 | 616 | switch(offset % 8) { |
| 583 | 617 | case 1: |
| 584 | data = dma_offset[(offset / 8) & 1][2]; | |
| 618 | data = state->dma_offset[(offset / 8) & 1][2]; | |
| 585 | 619 | break; |
| 586 | 620 | case 2: |
| 587 | data = dma_offset[(offset / 8) & 1][3]; | |
| 621 | data = state->dma_offset[(offset / 8) & 1][3]; | |
| 588 | 622 | break; |
| 589 | 623 | case 3: |
| 590 | data = dma_offset[(offset / 8) & 1][1]; | |
| 624 | data = state->dma_offset[(offset / 8) & 1][1]; | |
| 591 | 625 | break; |
| 592 | 626 | case 7: |
| 593 | data = dma_offset[(offset / 8) & 1][0]; | |
| 627 | data = state->dma_offset[(offset / 8) & 1][0]; | |
| 594 | 628 | break; |
| 595 | 629 | } |
| 596 | 630 | return data; |
| r10886 | r10887 | |
| 599 | 633 | |
| 600 | 634 | static WRITE8_HANDLER(dma_page_select_w) |
| 601 | 635 | { |
| 602 | at_pages[offset % 0x10] = data; | |
| 636 | pcxt_state *state = space->machine->driver_data<pcxt_state>(); | |
| 637 | state->at_pages[offset % 0x10] = data; | |
| 603 | 638 | |
| 604 | 639 | switch(offset % 8) { |
| 605 | 640 | case 1: |
| 606 | dma_offset[(offset / 8) & 1][2] = data; | |
| 641 | state->dma_offset[(offset / 8) & 1][2] = data; | |
| 607 | 642 | break; |
| 608 | 643 | case 2: |
| 609 | dma_offset[(offset / 8) & 1][3] = data; | |
| 644 | state->dma_offset[(offset / 8) & 1][3] = data; | |
| 610 | 645 | break; |
| 611 | 646 | case 3: |
| 612 | dma_offset[(offset / 8) & 1][1] = data; | |
| 647 | state->dma_offset[(offset / 8) & 1][1] = data; | |
| 613 | 648 | break; |
| 614 | 649 | case 7: |
| 615 | dma_offset[(offset / 8) & 1][0] = data; | |
| 650 | state->dma_offset[(offset / 8) & 1][0] = data; | |
| 616 | 651 | break; |
| 617 | 652 | } |
| 618 | 653 | } |
| 619 | 654 | |
| 620 | 655 | static void set_dma_channel(device_t *device, int channel, int state) |
| 621 | 656 | { |
| 622 | if (!state) dma_channel = channel; | |
| 657 | pcxt_state *drvstate = device->machine->driver_data<pcxt_state>(); | |
| 658 | if (!state) drvstate->dma_channel = channel; | |
| 623 | 659 | } |
| 624 | 660 | |
| 625 | 661 | static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); } |
| r10886 | r10887 | |
| 659 | 695 | |
| 660 | 696 | static IRQ_CALLBACK(irq_callback) |
| 661 | 697 | { |
| 698 | pcxt_state *state = device->machine->driver_data<pcxt_state>(); | |
| 662 | 699 | int r = 0; |
| 663 | r = pic8259_acknowledge( | |
| 700 | r = pic8259_acknowledge(s | |
| 664 | 701 | if (r==0) |
| 665 | 702 | { |
| 666 | r = pic8259_acknowledge( | |
| 703 | r = pic8259_acknowledge(s | |
| 667 | 704 | } |
| 668 | 705 | return r; |
| 669 | 706 | } |
| 670 | 707 | |
| 671 | 708 | static ADDRESS_MAP_START( filetto_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 672 | 709 | AM_RANGE(0x00000, 0x003ff) AM_RAM //irq vectors |
| 673 | AM_RANGE(0x00400, 0x007ff) AM_RAM AM_BASE( | |
| 710 | AM_RANGE(0x00400, 0x007ff) AM_RAM AM_BASE_MEMBER(pcxt_state, work_ram) | |
| 674 | 711 | AM_RANGE(0x00800, 0x9ffff) AM_RAM //work RAM 640KB |
| 675 | AM_RANGE(0xa0000, 0xbffff) AM_RAM_WRITE(vga_vram_w) AM_BASE( | |
| 712 | AM_RANGE(0xa0000, 0xbffff) AM_RAM_WRITE(vga_vram_w) AM_BASE_MEMBER(pcxt_state, vga_vram)//VGA RAM | |
| 676 | 713 | AM_RANGE(0xc0000, 0xcffff) AM_ROMBANK("bank1") |
| 677 | 714 | AM_RANGE(0xf0000, 0xfffff) AM_ROM |
| 678 | 715 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 697 | 734 | AM_RANGE(0x03bc, 0x03bf) AM_RAM //printer port |
| 698 | 735 | AM_RANGE(0x03b4, 0x03b5) AM_READWRITE(vga_regs_r,vga_regs_w) //various VGA/CGA/EGA regs |
| 699 | 736 | AM_RANGE(0x03d4, 0x03d5) AM_READWRITE(vga_regs_r,vga_regs_w) //mirror of above |
| 700 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE( | |
| 737 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE_MEMBER(pcxt_state, vga_mode) | |
| 701 | 738 | AM_RANGE(0x03ba, 0x03bb) AM_READ(vga_hvretrace_r)//Controls H-Blank/V-Blank |
| 702 | 739 | AM_RANGE(0x03da, 0x03db) AM_READ(vga_hvretrace_r)//mirror of above |
| 703 | 740 | AM_RANGE(0x03f2, 0x03f2) AM_WRITE(drive_selection_w) |
| r10886 | r10887 | |
| 723 | 760 | // AM_RANGE(0x0310, 0x0311) AM_READWRITE(disk_iobank_r,disk_iobank_w) //Prototyping card |
| 724 | 761 | // AM_RANGE(0x0312, 0x0312) AM_READ_PORT("IN0") //Prototyping card,read only |
| 725 | 762 | AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port |
| 726 | AM_RANGE(0x03c0, 0x03c0) AM_RAM AM_BASE( | |
| 763 | AM_RANGE(0x03c0, 0x03c0) AM_RAM AM_BASE_MEMBER(pcxt_state, vga_bg_bank) | |
| 727 | 764 | AM_RANGE(0x03c8, 0x03c8) AM_READ_PORT("IN0") |
| 728 | 765 | AM_RANGE(0x03c9, 0x03c9) AM_READ_PORT("IN1") |
| 729 | 766 | // AM_RANGE(0x03ce, 0x03ce) AM_READ_PORT("IN1") |
| 730 | 767 | AM_RANGE(0x03bc, 0x03bf) AM_RAM //printer port |
| 731 | 768 | AM_RANGE(0x03b4, 0x03b5) AM_READWRITE(vga_regs_r,vga_regs_w) //various VGA/CGA/EGA regs |
| 732 | 769 | AM_RANGE(0x03d4, 0x03d5) AM_READWRITE(vga_regs_r,vga_regs_w) //mirror of above |
| 733 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE( | |
| 770 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE_MEMBER(pcxt_state, vga_mode) | |
| 734 | 771 | AM_RANGE(0x03ba, 0x03bb) AM_READ(vga_hvretrace_r)//Controls H-Blank/V-Blank |
| 735 | 772 | AM_RANGE(0x03da, 0x03db) AM_READ(vga_hvretrace_r)//mirror of above |
| 736 | 773 | AM_RANGE(0x03f2, 0x03f2) AM_WRITE(drive_selection_w) |
| r10886 | r10887 | |
| 906 | 943 | |
| 907 | 944 | static MACHINE_RESET( filetto ) |
| 908 | 945 | { |
| 909 | bank = -1; | |
| 910 | lastvalue = -1; | |
| 911 | hv_blank = 0; | |
| 946 | pcxt_state *state = machine->driver_data<pcxt_state>(); | |
| 947 | state->bank = -1; | |
| 948 | state->lastvalue = -1; | |
| 949 | state->hv_blank = 0; | |
| 912 | 950 | cpu_set_irq_callback(machine->device("maincpu"), irq_callback); |
| 913 | filetto_devices.pit8253 = machine->device( "pit8253" ); | |
| 914 | filetto_devices.pic8259_1 = machine->device( "pic8259_1" ); | |
| 915 | filetto_devices.pic8259_2 = machine->device( "pic8259_2" ); | |
| 916 | filetto_devices.dma8237_1 = machine->device( "dma8237_1" ); | |
| 917 | filetto_devices.dma8237_2 = machine->device( "dma8237_2" ); | |
| 951 | state->pit8253 = machine->device( "pit8253" ); | |
| 952 | state->pic8259_1 = machine->device( "pic8259_1" ); | |
| 953 | state->pic8259_2 = machine->device( "pic8259_2" ); | |
| 954 | state->dma8237_1 = machine->device( "dma8237_1" ); | |
| 955 | state->dma8237_2 = machine->device( "dma8237_2" ); | |
| 918 | 956 | } |
| 919 | 957 | |
| 920 | static MACHINE_CONFIG_START( filetto, | |
| 958 | static MACHINE_CONFIG_START( filetto, p | |
| 921 | 959 | MCFG_CPU_ADD("maincpu", I8088, 8000000) //or regular PC-XT 14318180/3 clock? |
| 922 | 960 | MCFG_CPU_PROGRAM_MAP(filetto_map) |
| 923 | 961 | MCFG_CPU_IO_MAP(filetto_io) |
| r10886 | r10887 | |
| 964 | 1002 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) |
| 965 | 1003 | MACHINE_CONFIG_END |
| 966 | 1004 | |
| 967 | static MACHINE_CONFIG_START( tetriskr, | |
| 1005 | static MACHINE_CONFIG_START( tetriskr, p | |
| 968 | 1006 | MCFG_CPU_ADD("maincpu", I8088, 14318180/3) |
| 969 | 1007 | MCFG_CPU_PROGRAM_MAP(filetto_map) |
| 970 | 1008 | MCFG_CPU_IO_MAP(tetriskr_io) |
| r10886 | r10887 | |
|---|---|---|
| 55 | 55 | #include "machine/nvram.h" |
| 56 | 56 | #include "video/resnet.h" |
| 57 | 57 | |
| 58 | static UINT8* dderby_vidchars; | |
| 59 | static UINT8* scroll_ram; | |
| 60 | static UINT8* dderby_vidattribs; | |
| 61 | static UINT8* sprite_ram; | |
| 62 | static UINT8 *racetrack_tilemap_rom; | |
| 63 | static tilemap_t *racetrack_tilemap; | |
| 64 | 58 | |
| 59 | class dmndrby_state : public driver_device | |
| 60 | { | |
| 61 | public: | |
| 62 | dmndrby_state(running_machine &machine, const driver_device_config_base &config) | |
| 63 | : driver_device(machine, config) { } | |
| 64 | ||
| 65 | UINT8* dderby_vidchars; | |
| 66 | UINT8* scroll_ram; | |
| 67 | UINT8* dderby_vidattribs; | |
| 68 | UINT8* sprite_ram; | |
| 69 | UINT8 *racetrack_tilemap_rom; | |
| 70 | tilemap_t *racetrack_tilemap; | |
| 71 | UINT8 io_port[8]; | |
| 72 | int bg; | |
| 73 | }; | |
| 74 | ||
| 75 | ||
| 65 | 76 | static WRITE8_HANDLER( dderby_sound_w ) |
| 66 | 77 | { |
| 67 | 78 | soundlatch_w(space,0,data); |
| 68 | 79 | cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); |
| 69 | 80 | } |
| 70 | 81 | |
| 71 | static UINT8 io_port[8]; | |
| 72 | 82 | |
| 73 | 83 | static READ8_HANDLER( input_r ) |
| 74 | 84 | { |
| r10886 | r10887 | |
| 89 | 99 | |
| 90 | 100 | static WRITE8_HANDLER( output_w ) |
| 91 | 101 | { |
| 102 | dmndrby_state *state = space->machine->driver_data<dmndrby_state>(); | |
| 92 | 103 | /* |
| 93 | 104 | ---- x--- refill meter [4] |
| 94 | 105 | ---- x--- token out meter [5] |
| r10886 | r10887 | |
| 100 | 111 | ---- --x- coin lockout [0-3] |
| 101 | 112 | ---- ---x lamp [0-6] |
| 102 | 113 | */ |
| 103 | io_port[offset] = data; | |
| 104 | // popmessage("%02x|%02x|%02x|%02x|%02x|%02x|%02x|%02x|",io_port[0],io_port[1],io_port[2],io_port[3],io_port[4],io_port[5],io_port[6],io_port[7]); | |
| 114 | state->io_port[offset] = data; | |
| 115 | // popmessage("%02x|%02x|%02x|%02x|%02x|%02x|%02x|%02x|",state->io_port[0],state->io_port[1],state->io_port[2],state->io_port[3],state->io_port[4],state->io_port[5],state->io_port[6],state->io_port[7]); | |
| 105 | 116 | } |
| 106 | 117 | |
| 107 | 118 | static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 115 | 126 | AM_RANGE(0xca01, 0xca01) AM_WRITENOP //watchdog |
| 116 | 127 | AM_RANGE(0xca02, 0xca02) AM_RAM_WRITE(dderby_sound_w) |
| 117 | 128 | AM_RANGE(0xca03, 0xca03) AM_WRITENOP//(timer_irq_w) //??? |
| 118 | AM_RANGE(0xcc00, 0xcc05) AM_RAM AM_BASE(&scroll_ram) | |
| 119 | AM_RANGE(0xce08, 0xce1f) AM_RAM AM_BASE(&sprite_ram) // horse sprites | |
| 120 | AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE(&dderby_vidchars) // char ram | |
| 121 | AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_BASE(&dderby_vidattribs) // colours/ attrib ram | |
| 129 | AM_RANGE(0xcc00, 0xcc05) AM_RAM AM_BASE_MEMBER(dmndrby_state, scroll_ram) | |
| 130 | AM_RANGE(0xce08, 0xce1f) AM_RAM AM_BASE_MEMBER(dmndrby_state, sprite_ram) // horse sprites | |
| 131 | AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE_MEMBER(dmndrby_state, dderby_vidchars) // char ram | |
| 132 | AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_BASE_MEMBER(dmndrby_state, dderby_vidattribs) // colours/ attrib ram | |
| 122 | 133 | ADDRESS_MAP_END |
| 123 | 134 | |
| 124 | 135 | static ADDRESS_MAP_START( dderby_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 302 | 313 | |
| 303 | 314 | static TILE_GET_INFO( get_dmndrby_tile_info ) |
| 304 | 315 | { |
| 305 | int code = racetrack_tilemap_rom[tile_index]; | |
| 306 | int attr = racetrack_tilemap_rom[tile_index+0x2000]; | |
| 316 | dmndrby_state *state = machine->driver_data<dmndrby_state>(); | |
| 317 | int code = state->racetrack_tilemap_rom[tile_index]; | |
| 318 | int attr = state->racetrack_tilemap_rom[tile_index+0x2000]; | |
| 307 | 319 | |
| 308 | 320 | int col = attr&0x1f; |
| 309 | 321 | int flipx = (attr&0x40)>>6; |
| r10886 | r10887 | |
| 319 | 331 | |
| 320 | 332 | static VIDEO_START(dderby) |
| 321 | 333 | { |
| 322 | racetrack_tilemap_rom = machine->region("user1")->base(); | |
| 323 | racetrack_tilemap = tilemap_create(machine,get_dmndrby_tile_info,tilemap_scan_rows,16,16, 16, 512); | |
| 324 | tilemap_mark_all_tiles_dirty(racetrack_tilemap); | |
| 334 | dmndrby_state *state = machine->driver_data<dmndrby_state>(); | |
| 335 | state->racetrack_tilemap_rom = machine->region("user1")->base(); | |
| 336 | state->racetrack_tilemap = tilemap_create(machine,get_dmndrby_tile_info,tilemap_scan_rows,16,16, 16, 512); | |
| 337 | tilemap_mark_all_tiles_dirty(state->racetrack_tilemap); | |
| 325 | 338 | |
| 326 | 339 | } |
| 327 | 340 | |
| 328 | 341 | static SCREEN_UPDATE(dderby) |
| 329 | 342 | { |
| 343 | dmndrby_state *state = screen->machine->driver_data<dmndrby_state>(); | |
| 330 | 344 | int x,y,count; |
| 331 | 345 | int off,scrolly; |
| 332 | static int bg; | |
| 333 | 346 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 334 | 347 | const gfx_element *sprites = screen->machine->gfx[1]; |
| 335 | 348 | const gfx_element *track = screen->machine->gfx[2]; |
| r10886 | r10887 | |
| 343 | 356 | can we draw it with the tilemap? maybe not, the layout is a litle strange |
| 344 | 357 | |
| 345 | 358 | */ |
| 346 | // base = scroll_ram[0]; | |
| 359 | // base = state->scroll_ram[0]; | |
| 347 | 360 | |
| 348 | off=0x1900-(bg*0x100)+(scroll_ram[1])*0x100; | |
| 349 | scrolly = 0xff-(scroll_ram[0]); | |
| 350 | if(scroll_ram[1]==0xff) off=0x1800; | |
| 361 | off=0x1900-(state->bg*0x100)+(state->scroll_ram[1])*0x100; | |
| 362 | scrolly = 0xff-(state->scroll_ram[0]); | |
| 363 | if(state->scroll_ram[1]==0xff) off=0x1800; | |
| 351 | 364 | for(x=0;x<16;x++) { |
| 352 | 365 | for(y=0;y<16;y++) { |
| 353 | int chr = racetrack_tilemap_rom[off]; | |
| 354 | int col = racetrack_tilemap_rom[off+0x2000]&0x1f; | |
| 355 | int flipx = racetrack_tilemap_rom[off+0x2000]&0x40; | |
| 366 | int chr = state->racetrack_tilemap_rom[off]; | |
| 367 | int col = state->racetrack_tilemap_rom[off+0x2000]&0x1f; | |
| 368 | int flipx = state->racetrack_tilemap_rom[off+0x2000]&0x40; | |
| 356 | 369 | drawgfx_opaque(bitmap,cliprect,track,chr,col,flipx,0,y*16+scrolly,x*16); |
| 357 | 370 | // draw another bit of track |
| 358 | 371 | // a rubbish way of doing it |
| 359 | chr = racetrack_tilemap_rom[off-0x100]; | |
| 360 | col = racetrack_tilemap_rom[off+0x1f00]&0x1f; | |
| 361 | flipx = racetrack_tilemap_rom[off+0x1f00]&0x40; | |
| 372 | chr = state->racetrack_tilemap_rom[off-0x100]; | |
| 373 | col = state->racetrack_tilemap_rom[off+0x1f00]&0x1f; | |
| 374 | flipx = state->racetrack_tilemap_rom[off+0x1f00]&0x40; | |
| 362 | 375 | drawgfx_opaque(bitmap,cliprect,track,chr,col,flipx,0,y*16-256+scrolly,x*16); |
| 363 | 376 | off++; |
| 364 | 377 | } |
| r10886 | r10887 | |
| 379 | 392 | int a=0; |
| 380 | 393 | int b=0; |
| 381 | 394 | int base = count*4; |
| 382 | int sprx=sprite_ram[base+3]; | |
| 383 | int spry=sprite_ram[base+2]; | |
| 384 | //sprite_ram[base+1]; | |
| 385 | int col = (sprite_ram[base+1]&0x1f); | |
| 386 | int anim = (sprite_ram[base]&0x3)*0x40; // animation frame - probably wrong but seems right | |
| 387 | int horse = (sprite_ram[base+1]&0x7)*8+7; // horse label from 1 - 6 | |
| 395 | int sprx=state->sprite_ram[base+3]; | |
| 396 | int spry=state->sprite_ram[base+2]; | |
| 397 | //state->sprite_ram[base+1]; | |
| 398 | int col = (state->sprite_ram[base+1]&0x1f); | |
| 399 | int anim = (state->sprite_ram[base]&0x3)*0x40; // animation frame - probably wrong but seems right | |
| 400 | int horse = (state->sprite_ram[base+1]&0x7)*8+7; // horse label from 1 - 6 | |
| 388 | 401 | |
| 389 | 402 | for (a=0;a<8 ;a++) |
| 390 | 403 | { |
| r10886 | r10887 | |
| 407 | 420 | for(x=0;x<32;x++) |
| 408 | 421 | { |
| 409 | 422 | int tileno,bank,color; |
| 410 | tileno=dderby_vidchars[count]; | |
| 411 | bank=(dderby_vidattribs[count]&0x20)>>5; | |
| 423 | tileno=state->dderby_vidchars[count]; | |
| 424 | bank=(state->dderby_vidattribs[count]&0x20)>>5; | |
| 412 | 425 | tileno|=(bank<<8); |
| 413 | color=((dderby_vidattribs[count])&0x1f); | |
| 426 | color=((state->dderby_vidattribs[count])&0x1f); | |
| 414 | 427 | |
| 415 | 428 | drawgfx_transpen(bitmap,cliprect,gfx,tileno,color,0,0,x*8,y*8,(tileno == 0x38) ? 0 : -1); |
| 416 | 429 | |
| r10886 | r10887 | |
| 487 | 500 | cputag_set_input_line_and_vector(device->machine, "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h */ |
| 488 | 501 | } |
| 489 | 502 | |
| 490 | static MACHINE_CONFIG_START( dderby, dr | |
| 503 | static MACHINE_CONFIG_START( dderby, dmndrby | |
| 491 | 504 | /* basic machine hardware */ |
| 492 | 505 | MCFG_CPU_ADD("maincpu", Z80,4000000) /* ? MHz */ |
| 493 | 506 | MCFG_CPU_PROGRAM_MAP(memmap) |
| r10886 | r10887 | |
|---|---|---|
| 66 | 66 | #include "roul.lh" |
| 67 | 67 | #include "machine/nvram.h" |
| 68 | 68 | |
| 69 | ||
| 70 | class roul_state : public driver_device | |
| 71 | { | |
| 72 | public: | |
| 73 | roul_state(running_machine &machine, const driver_device_config_base &config) | |
| 74 | : driver_device(machine, config) { } | |
| 75 | ||
| 76 | UINT8 reg[0x10]; | |
| 77 | UINT8 *videobuf; | |
| 78 | UINT8 lamp_old; | |
| 79 | }; | |
| 80 | ||
| 81 | ||
| 69 | 82 | #define VIDEOBUF_SIZE 256*256 |
| 70 | 83 | |
| 71 | static UINT8 reg[0x10]; | |
| 72 | static UINT8 *videobuf; | |
| 73 | 84 | |
| 74 | static UINT8 lamp_old = 0; | |
| 75 | ||
| 76 | 85 | static PALETTE_INIT( roul ) |
| 77 | 86 | { |
| 78 | 87 | int bit6, bit7, bit0, bit1, r, g, b; |
| r10886 | r10887 | |
| 112 | 121 | |
| 113 | 122 | static WRITE8_HANDLER( blitter_cmd_w ) |
| 114 | 123 | { |
| 115 | reg[offset] = data; | |
| 124 | roul_state *state = space->machine->driver_data<roul_state>(); | |
| 125 | state->reg[offset] = data; | |
| 116 | 126 | if (offset==2) |
| 117 | 127 | { |
| 118 | 128 | int i,j; |
| 119 | int width = reg[2]; | |
| 120 | int y = reg[0]; | |
| 121 | int x = reg[1]; | |
| 122 | int color = reg[3] & 0x0f; | |
| 129 | int width = state->reg[2]; | |
| 130 | int y = state->reg[0]; | |
| 131 | int x = state->reg[1]; | |
| 132 | int color = state->reg[3] & 0x0f; | |
| 123 | 133 | int xdirection = 1, ydirection = 1; |
| 124 | 134 | |
| 125 | if (reg[3] & 0x10) ydirection = -1; | |
| 126 | if (reg[3] & 0x20) xdirection = -1; | |
| 135 | if (state->reg[3] & 0x10) ydirection = -1; | |
| 136 | if (state->reg[3] & 0x20) xdirection = -1; | |
| 127 | 137 | |
| 128 | 138 | if (width == 0x00) width = 0x100; |
| 129 | 139 | |
| 130 | switch(reg[3] & 0xc0) | |
| 140 | switch(state->reg[3] & 0xc0) | |
| 131 | 141 | { |
| 132 | case 0x00: // reg[4] used? | |
| 142 | case 0x00: // state->reg[4] used? | |
| 133 | 143 | for (i = - width / 2; i < width / 2; i++) |
| 134 | 144 | for (j = - width / 2; j < width / 2; j++) |
| 135 | videobuf[(y + j) * 256 + x + i] = color; | |
| 136 | logerror("Blitter command 0 : [%02x][%02x][%02x][%02x][%02x]\n",reg[0],reg[1],reg[2],reg[3],reg[4]); | |
| 145 | state->videobuf[(y + j) * 256 + x + i] = color; | |
| 146 | logerror("Blitter command 0 : [%02x][%02x][%02x][%02x][%02x]\n",state->reg[0],state->reg[1],state->reg[2],state->reg[3],state->reg[4]); | |
| 137 | 147 | break; |
| 138 | case 0x40: // vertical line - reg[4] not used | |
| 148 | case 0x40: // vertical line - state->reg[4] not used | |
| 139 | 149 | for (i = 0; i < width; i++ ) |
| 140 | videobuf[(y + i * ydirection) * 256 + x] = color; | |
| 150 | state->videobuf[(y + i * ydirection) * 256 + x] = color; | |
| 141 | 151 | break; |
| 142 | case 0x80: // horizontal line - reg[4] not used | |
| 152 | case 0x80: // horizontal line - state->reg[4] not used | |
| 143 | 153 | for (i = 0; i < width; i++ ) |
| 144 | videobuf[y * 256 + x + i * xdirection] = color; | |
| 154 | state->videobuf[y * 256 + x + i * xdirection] = color; | |
| 145 | 155 | break; |
| 146 | case 0xc0: // diagonal line - reg[4] not used | |
| 156 | case 0xc0: // diagonal line - state->reg[4] not used | |
| 147 | 157 | for (i = 0; i < width; i++ ) |
| 148 | videobuf[(y + i * ydirection) * 256 + x + i * xdirection] = color; | |
| 158 | state->videobuf[(y + i * ydirection) * 256 + x + i * xdirection] = color; | |
| 149 | 159 | } |
| 150 | 160 | } |
| 151 | 161 | |
| r10886 | r10887 | |
| 159 | 169 | |
| 160 | 170 | static WRITE8_HANDLER( ball_w ) |
| 161 | 171 | { |
| 172 | roul_state *state = space->machine->driver_data<roul_state>(); | |
| 162 | 173 | int lamp = data; |
| 163 | 174 | |
| 164 | 175 | output_set_lamp_value(data, 1); |
| 165 | output_set_lamp_value(lamp_old, 0); | |
| 166 | lamp_old = lamp; | |
| 176 | output_set_lamp_value(state->lamp_old, 0); | |
| 177 | state->lamp_old = lamp; | |
| 167 | 178 | } |
| 168 | 179 | |
| 169 | 180 | static ADDRESS_MAP_START( roul_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 195 | 206 | |
| 196 | 207 | static VIDEO_START(roul) |
| 197 | 208 | { |
| 198 | videobuf = auto_alloc_array_clear(machine, UINT8, VIDEOBUF_SIZE); | |
| 209 | roul_state *state = machine->driver_data<roul_state>(); | |
| 210 | state->videobuf = auto_alloc_array_clear(machine, UINT8, VIDEOBUF_SIZE); | |
| 199 | 211 | } |
| 200 | 212 | |
| 201 | 213 | static SCREEN_UPDATE(roul) |
| 202 | 214 | { |
| 215 | roul_state *state = screen->machine->driver_data<roul_state>(); | |
| 203 | 216 | int i,j; |
| 204 | 217 | for (i = 0; i < 256; i++) |
| 205 | 218 | for (j = 0; j < 256; j++) |
| 206 | *BITMAP_ADDR16(bitmap, j, i) = videobuf[j * 256 + 255 - i]; | |
| 219 | *BITMAP_ADDR16(bitmap, j, i) = state->videobuf[j * 256 + 255 - i]; | |
| 207 | 220 | return 0; |
| 208 | 221 | } |
| 209 | 222 | |
| r10886 | r10887 | |
| 257 | 270 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 258 | 271 | INPUT_PORTS_END |
| 259 | 272 | |
| 260 | static MACHINE_CONFIG_START( roul, | |
| 273 | static MACHINE_CONFIG_START( roul, | |
| 261 | 274 | /* basic machine hardware */ |
| 262 | 275 | MCFG_CPU_ADD("maincpu", Z80, 4000000) |
| 263 | 276 | MCFG_CPU_PROGRAM_MAP(roul_map) |
| r10886 | r10887 | |
|---|---|---|
| 3444 | 3444 | |
| 3445 | 3445 | GAMEL(1977, depthch, 0, depthch, depthch, 0, ROT0, "Gremlin", "Depthcharge", GAME_IMPERFECT_SOUND, layout_depthch ) |
| 3446 | 3446 | GAMEL(1977, depthcho, depthch, depthch, depthch, 0, ROT0, "Gremlin", "Depthcharge (older)", GAME_IMPERFECT_SOUND, layout_depthch ) |
| 3447 | GAME( | |
| 3447 | GAMEL( | |
| 3448 | 3448 | GAME( 1977, safari, 0, safari, safari, 0, ROT0, "Gremlin", "Safari (set 1)", GAME_NO_SOUND ) |
| 3449 | 3449 | GAME( 1977, safaria, safari, safari, safari, 0, ROT0, "Gremlin", "Safari (set 2, bootleg?)", GAME_NO_SOUND ) // on a bootleg board, but seems a different code revision too |
| 3450 | 3450 | GAME( 1978, frogs, 0, frogs, frogs, 0, ROT0, "Gremlin", "Frogs", GAME_IMPERFECT_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 402 | 402 | #include "machine/nvram.h" |
| 403 | 403 | |
| 404 | 404 | |
| 405 | class magicfly_state : public driver_device | |
| 406 | { | |
| 407 | public: | |
| 408 | magicfly_state(running_machine &machine, const driver_device_config_base &config) | |
| 409 | : driver_device(machine, config) { } | |
| 410 | ||
| 411 | UINT8 *videoram; | |
| 412 | UINT8 *colorram; | |
| 413 | tilemap_t *bg_tilemap; | |
| 414 | int input_selector; | |
| 415 | }; | |
| 416 | ||
| 417 | ||
| 405 | 418 | /************************* |
| 406 | 419 | * Video Hardware * |
| 407 | 420 | *************************/ |
| 408 | 421 | |
| 409 | static UINT8 *videoram; | |
| 410 | static UINT8 *colorram; | |
| 411 | static tilemap_t *bg_tilemap; | |
| 412 | 422 | |
| 413 | 423 | static WRITE8_HANDLER( magicfly_videoram_w ) |
| 414 | 424 | { |
| 415 | videoram[offset] = data; | |
| 416 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 425 | magicfly_state *state = space->machine->driver_data<magicfly_state>(); | |
| 426 | state->videoram[offset] = data; | |
| 427 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 417 | 428 | } |
| 418 | 429 | |
| 419 | 430 | static WRITE8_HANDLER( magicfly_colorram_w ) |
| 420 | 431 | { |
| 421 | colorram[offset] = data; | |
| 422 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 432 | magicfly_state *state = space->machine->driver_data<magicfly_state>(); | |
| 433 | state->colorram[offset] = data; | |
| 434 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 423 | 435 | } |
| 424 | 436 | |
| 425 | 437 | static TILE_GET_INFO( get_magicfly_tile_info ) |
| 426 | 438 | { |
| 439 | magicfly_state *state = machine->driver_data<magicfly_state>(); | |
| 427 | 440 | /* - bits - |
| 428 | 441 | 7654 3210 |
| 429 | 442 | ---- -xxx Tiles color. |
| r10886 | r10887 | |
| 433 | 446 | x--- ---- Mirrored from bit 3. The code check this one to boot the game. |
| 434 | 447 | |
| 435 | 448 | */ |
| 436 | int attr = colorram[tile_index]; | |
| 437 | int code = videoram[tile_index]; | |
| 449 | int attr = state->colorram[tile_index]; | |
| 450 | int code = state->videoram[tile_index]; | |
| 438 | 451 | int bank = (attr & 0x10) >> 4; /* bit 4 switch the gfx banks */ |
| 439 | 452 | int color = attr & 0x07; /* bits 0-2 for color */ |
| 440 | 453 | |
| 441 | 454 | /* Seems that bit 7 is mirrored from bit 3 to have a normal boot */ |
| 442 | 455 | /* Boot only check the first color RAM offset */ |
| 443 | 456 | |
| 444 | colorram[0] = colorram[0] | ((colorram[0] & 0x08) << 4); /* only for 1st offset */ | |
| 445 | //colorram[tile_index] = attr | ((attr & 0x08) << 4); /* for the whole color RAM */ | |
| 457 | state->colorram[0] = state->colorram[0] | ((state->colorram[0] & 0x08) << 4); /* only for 1st offset */ | |
| 458 | //state->colorram[tile_index] = attr | ((attr & 0x08) << 4); /* for the whole color RAM */ | |
| 446 | 459 | |
| 447 | 460 | SET_TILE_INFO(bank, code, color, 0); |
| 448 | 461 | } |
| 449 | 462 | |
| 450 | 463 | static VIDEO_START(magicfly) |
| 451 | 464 | { |
| 452 | bg_tilemap = tilemap_create(machine, get_magicfly_tile_info, tilemap_scan_rows, 8, 8, 32, 29); | |
| 465 | magicfly_state *state = machine->driver_data<magicfly_state>(); | |
| 466 | state->bg_tilemap = tilemap_create(machine, get_magicfly_tile_info, tilemap_scan_rows, 8, 8, 32, 29); | |
| 453 | 467 | } |
| 454 | 468 | |
| 455 | 469 | static TILE_GET_INFO( get_7mezzo_tile_info ) |
| 456 | 470 | { |
| 471 | magicfly_state *state = machine->driver_data<magicfly_state>(); | |
| 457 | 472 | /* - bits - |
| 458 | 473 | 7654 3210 |
| 459 | 474 | ---- -xxx Tiles color. |
| r10886 | r10887 | |
| 463 | 478 | x--- ---- Mirrored from bit 2. The code check this one to boot the game. |
| 464 | 479 | |
| 465 | 480 | */ |
| 466 | int attr = colorram[tile_index]; | |
| 467 | int code = videoram[tile_index]; | |
| 481 | int attr = state->colorram[tile_index]; | |
| 482 | int code = state->videoram[tile_index]; | |
| 468 | 483 | int bank = (attr & 0x10) >> 4; /* bit 4 switch the gfx banks */ |
| 469 | 484 | int color = attr & 0x07; /* bits 0-2 for color */ |
| 470 | 485 | |
| 471 | 486 | /* Seems that bit 7 is mirrored from bit 2 to have a normal boot */ |
| 472 | 487 | /* Boot only check the first color RAM offset */ |
| 473 | 488 | |
| 474 | colorram[0] = colorram[0] | ((colorram[0] & 0x04) << 5); /* only for 1st offset */ | |
| 475 | //colorram[tile_index] = attr | ((attr & 0x04) << 5); /* for the whole color RAM */ | |
| 489 | state->colorram[0] = state->colorram[0] | ((state->colorram[0] & 0x04) << 5); /* only for 1st offset */ | |
| 490 | //state->colorram[tile_index] = attr | ((attr & 0x04) << 5); /* for the whole color RAM */ | |
| 476 | 491 | |
| 477 | 492 | SET_TILE_INFO(bank, code, color, 0); |
| 478 | 493 | } |
| 479 | 494 | |
| 480 | 495 | static VIDEO_START( 7mezzo ) |
| 481 | 496 | { |
| 482 | bg_tilemap = tilemap_create(machine, get_7mezzo_tile_info, tilemap_scan_rows, 8, 8, 32, 29); | |
| 497 | magicfly_state *state = machine->driver_data<magicfly_state>(); | |
| 498 | state->bg_tilemap = tilemap_create(machine, get_7mezzo_tile_info, tilemap_scan_rows, 8, 8, 32, 29); | |
| 483 | 499 | } |
| 484 | 500 | |
| 485 | 501 | static SCREEN_UPDATE( magicfly ) |
| 486 | 502 | { |
| 487 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 503 | magicfly_state *state = screen->machine->driver_data<magicfly_state>(); | |
| 504 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 488 | 505 | return 0; |
| 489 | 506 | } |
| 490 | 507 | |
| r10886 | r10887 | |
| 515 | 532 | * R/W Handlers * |
| 516 | 533 | ******************************/ |
| 517 | 534 | |
| 518 | static int input_selector = 0; | |
| 519 | 535 | |
| 520 | 536 | static READ8_HANDLER( mux_port_r ) |
| 521 | 537 | { |
| 522 | switch( input_selector ) | |
| 538 | magicfly_state *state = space->machine->driver_data<magicfly_state>(); | |
| 539 | switch( state->input_selector ) | |
| 523 | 540 | { |
| 524 | 541 | case 0x01: return input_port_read(space->machine, "IN0-0"); |
| 525 | 542 | case 0x02: return input_port_read(space->machine, "IN0-1"); |
| r10886 | r10887 | |
| 532 | 549 | |
| 533 | 550 | static WRITE8_HANDLER( mux_port_w ) |
| 534 | 551 | { |
| 552 | magicfly_state *state = space->machine->driver_data<magicfly_state>(); | |
| 535 | 553 | /* - bits - |
| 536 | 554 | 7654 3210 |
| 537 | 555 | ---- xxxx Input selector. |
| r10886 | r10887 | |
| 541 | 559 | x--- ---- Sound DAC. |
| 542 | 560 | |
| 543 | 561 | */ |
| 544 | input_selector = data & 0x0f; /* Input Selector */ | |
| 562 | state->input_selector = data & 0x0f; /* Input Selector */ | |
| 545 | 563 | |
| 546 | 564 | dac_data_w(space->machine->device("dac"), data & 0x80); /* Sound DAC */ |
| 547 | 565 | |
| r10886 | r10887 | |
| 559 | 577 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") /* MK48Z02B NVRAM */ |
| 560 | 578 | AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w) |
| 561 | 579 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 562 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(magicfly_videoram_w) AM_BASE(&videoram) /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */ | |
| 563 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(magicfly_colorram_w) AM_BASE(&colorram) /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */ | |
| 580 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(magicfly_videoram_w) AM_BASE_MEMBER(magicfly_state, videoram) /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */ | |
| 581 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(magicfly_colorram_w) AM_BASE_MEMBER(magicfly_state, colorram) /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */ | |
| 564 | 582 | AM_RANGE(0x2800, 0x2800) AM_READ(mux_port_r) /* multiplexed input port */ |
| 565 | 583 | AM_RANGE(0x3000, 0x3000) AM_WRITE(mux_port_w) /* output port */ |
| 566 | 584 | AM_RANGE(0xc000, 0xffff) AM_ROM /* ROM space */ |
| r10886 | r10887 | |
| 756 | 774 | * Machine Drivers * |
| 757 | 775 | *************************/ |
| 758 | 776 | |
| 759 | static MACHINE_CONFIG_START( magicfly, | |
| 777 | static MACHINE_CONFIG_START( magicfly, magi | |
| 760 | 778 | |
| 761 | 779 | /* basic machine hardware */ |
| 762 | 780 | MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/12) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 132 | 132 | #include "sound/c140.h" |
| 133 | 133 | #include "rendlay.h" |
| 134 | 134 | |
| 135 | static UINT32 *mpSharedRAM0; | |
| 136 | //static UINT32 *mpSharedRAM1; | |
| 137 | static UINT32 *gal3_nvmem; | |
| 138 | static size_t gal3_nvmem_size; | |
| 139 | static UINT16 namcos21_video_enable; | |
| 140 | static UINT16 *rsoSharedRAM; | |
| 141 | 135 | |
| 142 | static UINT32 led_mst; //Diagnostic LEDs | |
| 143 | static UINT32 led_slv; | |
| 136 | class gal3_state : public driver_device | |
| 137 | { | |
| 138 | public: | |
| 139 | gal3_state(running_machine &machine, const driver_device_config_base &config) | |
| 140 | : driver_device(machine, config) { } | |
| 144 | 141 | |
| 142 | UINT32 *mpSharedRAM0; | |
| 143 | //UINT32 *mpSharedRAM1; | |
| 144 | UINT32 *nvmem; | |
| 145 | size_t nvmem_size; | |
| 146 | UINT16 namcos21_video_enable; | |
| 147 | UINT16 *rsoSharedRAM; | |
| 148 | UINT32 led_mst; | |
| 149 | UINT32 led_slv; | |
| 150 | }; | |
| 151 | ||
| 152 | ||
| 145 | 153 | static VIDEO_START(gal3) |
| 146 | 154 | { |
| 147 | 155 | namco_obj_init(machine, |
| r10886 | r10887 | |
| 172 | 180 | |
| 173 | 181 | static SCREEN_UPDATE(gal3) |
| 174 | 182 | { |
| 183 | gal3_state *state = screen->machine->driver_data<gal3_state>(); | |
| 175 | 184 | int i; |
| 176 | 185 | char mst[18], slv[18]; |
| 177 | 186 | static int pivot = 15; |
| r10886 | r10887 | |
| 196 | 205 | |
| 197 | 206 | // CPU Diag LEDs |
| 198 | 207 | mst[17]='\0', slv[17]='\0'; |
| 199 | /// printf("mst=0x%x\tslv=0x%x\n", led_mst, led_slv); | |
| 208 | /// printf("mst=0x%x\tslv=0x%x\n", state->led_mst, state->led_slv); | |
| 200 | 209 | for(i=16;i<32;i++) |
| 201 | 210 | { |
| 202 | 211 | int t; |
| r10886 | r10887 | |
| 206 | 215 | t=i+1; |
| 207 | 216 | mst[8]=' '; slv[8]=' '; |
| 208 | 217 | |
| 209 | if(led_mst&(1<<i)) | |
| 218 | if(state->led_mst&(1<<i)) | |
| 210 | 219 | mst[t-16]='*'; |
| 211 | 220 | else |
| 212 | 221 | mst[t-16]='O'; |
| 213 | 222 | |
| 214 | if(led_slv&(1<<i)) | |
| 223 | if(state->led_slv&(1<<i)) | |
| 215 | 224 | slv[t-16]='*'; |
| 216 | 225 | else |
| 217 | 226 | slv[t-16]='O'; |
| r10886 | r10887 | |
| 225 | 234 | |
| 226 | 235 | static NVRAM_HANDLER( gal3 ) |
| 227 | 236 | { |
| 237 | gal3_state *state = machine->driver_data<gal3_state>(); | |
| 228 | 238 | int i; |
| 229 | 239 | UINT8 data[4]; |
| 230 | 240 | if( read_or_write ) |
| 231 | 241 | { |
| 232 | for( i=0; i< | |
| 242 | for( i=0; i<state->nvmem_size/4; i++ ) | |
| 233 | 243 | { |
| 234 | UINT32 dword = | |
| 244 | UINT32 dword = state->nvmem[i]; | |
| 235 | 245 | data[0] = dword>>24; |
| 236 | 246 | data[1] = (dword&0x00ff0000)>>16; |
| 237 | 247 | data[2] = (dword&0x0000ff00)>>8; |
| r10886 | r10887 | |
| 243 | 253 | { |
| 244 | 254 | if( file ) |
| 245 | 255 | { |
| 246 | for( i=0; i< | |
| 256 | for( i=0; i<state->nvmem_size/4; i++ ) | |
| 247 | 257 | { |
| 248 | 258 | file->read( data, 4 ); |
| 249 | | |
| 259 | state->nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; | |
| 250 | 260 | } |
| 251 | 261 | } |
| 252 | 262 | else |
| 253 | 263 | { |
| 254 | 264 | /* fill in the default values */ |
| 255 | memset( | |
| 265 | memset( state->nvmem, 0x00, state->nvmem_size ); | |
| 256 | 266 | } |
| 257 | 267 | } |
| 258 | 268 | } |
| r10886 | r10887 | |
| 261 | 271 | |
| 262 | 272 | static READ32_HANDLER( shareram0_r ) |
| 263 | 273 | { |
| 264 | return mpSharedRAM0[offset]; | |
| 274 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 275 | return state->mpSharedRAM0[offset]; | |
| 265 | 276 | } |
| 266 | 277 | |
| 267 | 278 | static WRITE32_HANDLER( shareram0_w ) |
| 268 | 279 | { |
| 269 | COMBINE_DATA( &mpSharedRAM0[offset] ); | |
| 280 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 281 | COMBINE_DATA( &state->mpSharedRAM0[offset] ); | |
| 270 | 282 | } |
| 271 | /* | |
| 283 | ||
| 284 | #if 0 | |
| 272 | 285 | static READ32_HANDLER( shareram1_r ) |
| 273 | 286 | { |
| 274 | return mpSharedRAM1[offset]; | |
| 287 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 288 | return state->mpSharedRAM1[offset]; | |
| 275 | 289 | } |
| 276 | 290 | |
| 277 | 291 | static WRITE32_HANDLER( shareram1_w ) |
| 278 | 292 | { |
| 279 | COMBINE_DATA( &mpSharedRAM1[offset] ); | |
| 280 | }*/ | |
| 293 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 294 | COMBINE_DATA( &state->mpSharedRAM1[offset] ); | |
| 295 | } | |
| 296 | #endif | |
| 281 | 297 | |
| 282 | 298 | /***************************************************************************************/ |
| 283 | 299 | |
| 284 | 300 | static READ32_HANDLER( led_mst_r ) |
| 285 | 301 | { |
| 286 | return led_mst; | |
| 302 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 303 | return state->led_mst; | |
| 287 | 304 | } |
| 288 | 305 | |
| 289 | 306 | static WRITE32_HANDLER( led_mst_w ) |
| 290 | 307 | { |
| 291 | COMBINE_DATA(&led_mst); | |
| 308 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 309 | COMBINE_DATA(&state->led_mst); | |
| 292 | 310 | } |
| 293 | 311 | |
| 294 | 312 | static READ32_HANDLER( led_slv_r ) |
| 295 | 313 | { |
| 296 | return led_slv; | |
| 314 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 315 | return state->led_slv; | |
| 297 | 316 | } |
| 298 | 317 | |
| 299 | 318 | static WRITE32_HANDLER( led_slv_w ) |
| 300 | 319 | { |
| 301 | COMBINE_DATA(&led_slv); | |
| 320 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 321 | COMBINE_DATA(&state->led_slv); | |
| 302 | 322 | } |
| 303 | 323 | |
| 304 | 324 | /* palette memory handlers */ |
| r10886 | r10887 | |
| 321 | 341 | |
| 322 | 342 | static READ32_HANDLER(namcos21_video_enable_r) |
| 323 | 343 | { |
| 324 | return namcos21_video_enable<<16; | |
| 344 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 345 | return state->namcos21_video_enable<<16; | |
| 325 | 346 | } |
| 326 | 347 | |
| 327 | 348 | static WRITE32_HANDLER(namcos21_video_enable_w) |
| 328 | 349 | { |
| 350 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 329 | 351 | UINT32 v; |
| 330 | v = namcos21_video_enable<<16; | |
| 352 | v = state->namcos21_video_enable<<16; | |
| 331 | 353 | COMBINE_DATA( &v ); // 0xff53, instead of 0x40 in namcos21 |
| 332 | namcos21_video_enable = v>>16; | |
| 354 | state->namcos21_video_enable = v>>16; | |
| 333 | 355 | } |
| 334 | 356 | |
| 335 | 357 | static READ32_HANDLER(rso_r) |
| 336 | 358 | { |
| 359 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 337 | 360 | /*store $5555 @$0046, and readback @$0000 |
| 338 | 361 | read @$0144 and store at A6_21e & A4_5c |
| 339 | 362 | Check @$009a==1 to start DEMO |
| 340 | 363 | HACK*/ |
| 341 | 364 | offset *= 2; |
| 342 | return (rsoSharedRAM[offset]<<16)|rsoSharedRAM[offset+1]; | |
| 365 | return (state->rsoSharedRAM[offset]<<16)|state->rsoSharedRAM[offset+1]; | |
| 343 | 366 | } |
| 344 | 367 | |
| 345 | 368 | static WRITE32_HANDLER(rso_w) |
| 346 | 369 | { |
| 370 | gal3_state *state = space->machine->driver_data<gal3_state>(); | |
| 347 | 371 | UINT32 v; |
| 348 | 372 | offset *= 2; |
| 349 | v = (rsoSharedRAM[offset]<<16)|rsoSharedRAM[offset+1]; | |
| 373 | v = (state->rsoSharedRAM[offset]<<16)|state->rsoSharedRAM[offset+1]; | |
| 350 | 374 | COMBINE_DATA( &v ); |
| 351 | rsoSharedRAM[offset+0] = v>>16; | |
| 352 | rsoSharedRAM[offset+1] = v&0xffff; | |
| 375 | state->rsoSharedRAM[offset+0] = v>>16; | |
| 376 | state->rsoSharedRAM[offset+1] = v&0xffff; | |
| 353 | 377 | } |
| 354 | 378 | |
| 355 | 379 | static ADDRESS_MAP_START( cpu_mst_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 356 | 380 | AM_RANGE(0x00000000, 0x001fffff) AM_ROM |
| 357 | AM_RANGE(0x20000000, 0x20001fff) AM_RAM AM_BASE( | |
| 381 | AM_RANGE(0x20000000, 0x20001fff) AM_RAM AM_BASE_MEMBER( | |
| 358 | 382 | /// AM_RANGE(0x40000000, 0x4000ffff) AM_WRITE() // |
| 359 | 383 | AM_RANGE(0x44000000, 0x44000003) AM_READ_PORT("DSW_CPU_mst" ) |
| 360 | 384 | AM_RANGE(0x44800000, 0x44800003) AM_READ(led_mst_r) AM_WRITE(led_mst_w) //LEDs |
| 361 | 385 | AM_RANGE(0x48000000, 0x48000003) AM_READNOP //irq1 v-blank ack |
| 362 | 386 | AM_RANGE(0x4c000000, 0x4c000003) AM_READNOP //irq3 ack |
| 363 | AM_RANGE(0x60000000, 0x60007fff) AM_READ(shareram0_r) AM_WRITE(shareram0_w) AM_BASE( | |
| 387 | AM_RANGE(0x60000000, 0x60007fff) AM_READ(shareram0_r) AM_WRITE(shareram0_w) AM_BASE_MEMBER(gal3_state, mpSharedRAM0) //CRAM | |
| 364 | 388 | AM_RANGE(0x60010000, 0x60017fff) AM_READ(shareram0_r) AM_WRITE(shareram0_w) //Mirror |
| 365 | 389 | AM_RANGE(0x80000000, 0x8007ffff) AM_RAM //512K Local RAM |
| 366 | 390 | /// AM_RANGE(0xc0000000, 0xc000000b) AM_WRITENOP //upload? |
| r10886 | r10887 | |
| 431 | 455 | AM_RANGE(0x2c3800, 0x2c3801) AM_RAM //? |
| 432 | 456 | AM_RANGE(0x2c4000, 0x2c4001) AM_RAM //? |
| 433 | 457 | |
| 434 | AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE( | |
| 458 | AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE_MEMBER(gal3_state, rsoSharedRAM) //shared RAM | |
| 435 | 459 | |
| 436 | 460 | AM_RANGE(0x400000, 0x400017) AM_RAM //MC68681? |
| 437 | 461 | AM_RANGE(0x480000, 0x480017) AM_RAM //? |
| r10886 | r10887 | |
| 624 | 648 | C140_TYPE_SYSTEM21_B |
| 625 | 649 | }; |
| 626 | 650 | |
| 627 | static MACHINE_CONFIG_START( gal3, | |
| 651 | static MACHINE_CONFIG_START( gal3, gal3 | |
| 628 | 652 | MCFG_CPU_ADD("cpumst", M68020, 49152000/2) |
| 629 | 653 | MCFG_CPU_PROGRAM_MAP(cpu_mst_map) |
| 630 | 654 | MCFG_CPU_VBLANK_INT("lscreen", irq1_line_hold) |
| r10886 | r10887 | |
|---|---|---|
| 18 | 18 | #include "machine/8255ppi.h" |
| 19 | 19 | #include "sound/ay8910.h" |
| 20 | 20 | |
| 21 | static UINT8 *vram, *cram; | |
| 22 | 21 | |
| 22 | class rgum_state : public driver_device | |
| 23 | { | |
| 24 | public: | |
| 25 | rgum_state(running_machine &machine, const driver_device_config_base &config) | |
| 26 | : driver_device(machine, config) { } | |
| 27 | ||
| 28 | UINT8 *vram; | |
| 29 | UINT8 *cram; | |
| 30 | UINT8 hbeat; | |
| 31 | }; | |
| 32 | ||
| 33 | ||
| 23 | 34 | static VIDEO_START(royalgum) |
| 24 | 35 | { |
| 25 | ||
| 26 | 36 | } |
| 27 | 37 | |
| 28 | 38 | static SCREEN_UPDATE(royalgum) |
| 29 | 39 | { |
| 40 | rgum_state *state = screen->machine->driver_data<rgum_state>(); | |
| 30 | 41 | int x,y,count; |
| 31 | 42 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 32 | 43 | |
| r10886 | r10887 | |
| 36 | 47 | { |
| 37 | 48 | for(x=0;x<66;x++) |
| 38 | 49 | { |
| 39 | int tile = vram[count] | ((cram[count] & 0xf) <<8); | |
| 50 | int tile = state->vram[count] | ((state->cram[count] & 0xf) <<8); | |
| 40 | 51 | |
| 41 | 52 | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8); |
| 42 | 53 | |
| r10886 | r10887 | |
| 61 | 72 | |
| 62 | 73 | AM_RANGE(0x3000, 0x3003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) |
| 63 | 74 | |
| 64 | AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&vram) | |
| 65 | AM_RANGE(0x5000, 0x57ff) AM_RAM AM_BASE(&cram) | |
| 75 | AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE_MEMBER(rgum_state, vram) | |
| 76 | AM_RANGE(0x5000, 0x57ff) AM_RAM AM_BASE_MEMBER(rgum_state, cram) | |
| 66 | 77 | |
| 67 | 78 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 68 | 79 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 70 | 81 | |
| 71 | 82 | static CUSTOM_INPUT( rgum_heartbeat_r ) |
| 72 | 83 | { |
| 73 | stat | |
| 84 | rgum_state | |
| 74 | 85 | |
| 75 | hbeat ^= 1; | |
| 86 | state->hbeat ^= 1; | |
| 76 | 87 | |
| 77 | return hbeat; | |
| 88 | return state->hbeat; | |
| 78 | 89 | } |
| 79 | 90 | |
| 80 | 91 | |
| r10886 | r10887 | |
| 249 | 260 | DEVCB_NULL |
| 250 | 261 | }; |
| 251 | 262 | |
| 252 | static MACHINE_CONFIG_START( rgum, | |
| 263 | static MACHINE_CONFIG_START( rgum, | |
| 253 | 264 | /* basic machine hardware */ |
| 254 | 265 | MCFG_CPU_ADD("maincpu", M65C02,24000000/16) /* ? MHz */ |
| 255 | 266 | MCFG_CPU_PROGRAM_MAP(rgum_map) |
| r10886 | r10887 | |
|---|---|---|
| 53 | 53 | 837-13544-01 |
| 54 | 54 | 171-7772F |
| 55 | 55 | 837-13707 (sticker) |
| 56 | (C) SEGA 1999 | |
| 56 | (C) SEGA 1999 | |
| 57 | 57 | |---------------------------------------------------| |
| 58 | 58 | | CN1 CN3 | |
| 59 | 59 | |PC910 62256 EPF8452AQC160-3 | |
| r10886 | r10887 | |
| 61 | 61 | |A179B 315-6188.IC31 3771 3773| |
| 62 | 62 | |ADM485 BIOS.IC27 5264165 5264165 | |
| 63 | 63 | | 5264165 |-----| 5264165 | |
| 64 | | CN3 |POWER| | | |
| 65 | | |VR2 | 33.3333MHZ | | |
| 64 | | CN2 | SH4 | | | |
| 65 | | | | 33.3333MHZ | | |
| 66 | 66 | |CN26 |-----| 27MHZ| |
| 67 | 67 | | CY2308SC-3| |
| 68 | 68 | | KM416S4030 |------| HY57V161610 | |
| 69 | | | SH4 | HY57V161610 | | |
| 70 | | C844G 315-6232 | | 32MHZ | | |
| 69 | | | POWER| HY57V161610 | | |
| 70 | | C844G 315-6232 | VR2 | 32MHZ | | |
| 71 | 71 | | 33.8688MHZ |------| HY57V161610 | |
| 72 | 72 | | xMHz HY57V161610 | |
| 73 | 73 | | PCM1725 JP1 62256 | |
| r10886 | r10887 | |
| 103 | 103 | 62256 - 32kx8 SRAM |
| 104 | 104 | PCM1725 - Burr-Brown PCM1725 |
| 105 | 105 | xMHz - Small round XTAL (possibly 32.768kHz for a clock?) |
| 106 | SH4 - Hitachi SH4 CPU (BGAxxx, with heatsink and fan) | |
| 107 | POWERVR2 - POWERVR2 video generator (BGAxxx, with heatsink) | |
| 106 | SH4 - Hitachi SH4 CPU (BGAxxx, with heatsink) | |
| 107 | POWERVR2 - POWERVR2 video generator (BGAxxx, with heatsink and fan) | |
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | Filter Board |
| r10886 | r10887 | |
|---|---|---|
| 943 | 943 | GAME( 1979, asteroid1,asteroid, asteroid, asteroid, 0, ROT0, "Atari", "Asteroids (rev 1)", GAME_SUPPORTS_SAVE ) |
| 944 | 944 | GAME( 1979, asteroidb,asteroid, asteroid, asteroidb,asteroidb,ROT0, "bootleg", "Asteroids (bootleg on Lunar Lander hardware)", GAME_SUPPORTS_SAVE ) |
| 945 | 945 | GAME( 1979, asterock, asteroid, asterock, asterock, asterock, ROT0, "bootleg (Sidam)", "Asterock", GAME_SUPPORTS_SAVE ) |
| 946 | GAME( 1979, meteorts, asteroid, asteroid, asteroid, 0, ROT0, "bootleg (VGG)", "Meteorites", GAME_SUPPORTS_SAVE ) | |
| 947 | GAME( 1980, meteorho, asteroid, asteroid, asteroid, 0, ROT0, "bootleg (Hoei)", "Meteor", GAME_SUPPORTS_SAVE ) | |
| 946 | GAME( 1979, meteorts, asteroid, asteroid, asteroid, 0, ROT0, "bootleg (VGG)", "Meteorites (bootleg of Asteroids)", GAME_SUPPORTS_SAVE ) | |
| 947 | GAME( 1980, meteorho, asteroid, asteroid, asteroid, 0, ROT0, "bootleg (Hoei)", "Meteor (bootleg of Asteroids)", GAME_SUPPORTS_SAVE ) | |
| 948 | 948 | GAMEL(1980, astdelux, 0, astdelux, astdelux, 0, ROT0, "Atari", "Asteroids Deluxe (rev 3)", GAME_SUPPORTS_SAVE, layout_ho88ffff ) |
| 949 | 949 | GAMEL(1980, astdelux2,astdelux, astdelux, astdelux, 0, ROT0, "Atari", "Asteroids Deluxe (rev 2)", GAME_SUPPORTS_SAVE, layout_ho88ffff ) |
| 950 | 950 | GAMEL(1980, astdelux1,astdelux, astdelux, astdelux, 0, ROT0, "Atari", "Asteroids Deluxe (rev 1)", GAME_SUPPORTS_SAVE, layout_ho88ffff ) |
| r10886 | r10887 | |
|---|---|---|
| 44 | 44 | #include "sound/2151intf.h" |
| 45 | 45 | #include "sound/okim6295.h" |
| 46 | 46 | |
| 47 | static UINT16 *tiles = NULL, *wram; | |
| 48 | static UINT32 *tiles32 = NULL, *wram32; | |
| 49 | static int flip_bit, flipscreen = 0; | |
| 50 | static int palshift; | |
| 51 | 47 | |
| 52 | static int semicom_prot_idx; | |
| 53 | static int semicom_prot_which = 0; | |
| 54 | static UINT16 semicom_prot_data[2]; | |
| 48 | class vamphalf_state : public driver_device | |
| 49 | { | |
| 50 | public: | |
| 51 | vamphalf_state(running_machine &machine, const driver_device_config_base &config) | |
| 52 | : driver_device(machine, config) { } | |
| 55 | 53 | |
| 56 | static UINT16 finalgdr_backupram_bank; | |
| 57 | static UINT8 *finalgdr_backupram; | |
| 54 | UINT16 *tiles; | |
| 55 | UINT16 *wram; | |
| 56 | UINT32 *tiles32; | |
| 57 | UINT32 *wram32; | |
| 58 | int flip_bit; | |
| 59 | int flipscreen; | |
| 60 | int palshift; | |
| 61 | int semicom_prot_idx; | |
| 62 | int semicom_prot_which; | |
| 63 | UINT16 semicom_prot_data[2]; | |
| 64 | UINT16 finalgdr_backupram_bank; | |
| 65 | UINT8 *finalgdr_backupram; | |
| 66 | }; | |
| 58 | 67 | |
| 68 | ||
| 59 | 69 | static READ16_DEVICE_HANDLER( eeprom_r ) |
| 60 | 70 | { |
| 61 | 71 | if(offset) |
| r10886 | r10887 | |
| 97 | 107 | |
| 98 | 108 | static WRITE16_HANDLER( flipscreen_w ) |
| 99 | 109 | { |
| 110 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 100 | 111 | if(offset) |
| 101 | 112 | { |
| 102 | flipscreen = data & flip_bit; | |
| 113 | state->flipscreen = data & state->flip_bit; | |
| 103 | 114 | } |
| 104 | 115 | } |
| 105 | 116 | |
| 106 | 117 | static WRITE32_HANDLER( flipscreen32_w ) |
| 107 | 118 | { |
| 108 | flipscreen = data & flip_bit; | |
| 119 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 120 | state->flipscreen = data & state->flip_bit; | |
| 109 | 121 | } |
| 110 | 122 | |
| 111 | 123 | static WRITE16_HANDLER( jmpbreak_flipscreen_w ) |
| 112 | 124 | { |
| 113 | flipscreen = data & 0x8000; | |
| 125 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 126 | state->flipscreen = data & 0x8000; | |
| 114 | 127 | } |
| 115 | 128 | |
| 116 | 129 | |
| r10886 | r10887 | |
| 129 | 142 | |
| 130 | 143 | static READ32_HANDLER( wyvernwg_prot_r ) |
| 131 | 144 | { |
| 132 | semicom_prot_idx--; | |
| 133 | return (semicom_prot_data[semicom_prot_which] & (1 << semicom_prot_idx)) >> semicom_prot_idx; | |
| 145 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 146 | state->semicom_prot_idx--; | |
| 147 | return (state->semicom_prot_data[state->semicom_prot_which] & (1 << state->semicom_prot_idx)) >> state->semicom_prot_idx; | |
| 134 | 148 | } |
| 135 | 149 | |
| 136 | 150 | static WRITE32_HANDLER( wyvernwg_prot_w ) |
| 137 | 151 | { |
| 138 | semicom_prot_which = data & 1; | |
| 139 | semicom_prot_idx = 8; | |
| 152 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 153 | state->semicom_prot_which = data & 1; | |
| 154 | state->semicom_prot_idx = 8; | |
| 140 | 155 | } |
| 141 | 156 | |
| 142 | 157 | static READ32_HANDLER( finalgdr_prot_r ) |
| 143 | 158 | { |
| 144 | semicom_prot_idx--; | |
| 145 | return (semicom_prot_data[semicom_prot_which] & (1 << semicom_prot_idx)) ? 0x8000 : 0; | |
| 159 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 160 | state->semicom_prot_idx--; | |
| 161 | return (state->semicom_prot_data[state->semicom_prot_which] & (1 << state->semicom_prot_idx)) ? 0x8000 : 0; | |
| 146 | 162 | } |
| 147 | 163 | |
| 148 | 164 | static WRITE32_HANDLER( finalgdr_prot_w ) |
| 149 | 165 | { |
| 166 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 150 | 167 | /* |
| 151 | 168 | 41C6 |
| 152 | 169 | 967E |
| r10886 | r10887 | |
| 154 | 171 | F94B |
| 155 | 172 | */ |
| 156 | 173 | if(data == 0x41c6 || data == 0x446b) |
| 157 | semicom_prot_which = 0; | |
| 174 | state->semicom_prot_which = 0; | |
| 158 | 175 | else |
| 159 | semicom_prot_which = 1; | |
| 176 | state->semicom_prot_which = 1; | |
| 160 | 177 | |
| 161 | semicom_prot_idx = 8; | |
| 178 | state->semicom_prot_idx = 8; | |
| 162 | 179 | } |
| 163 | 180 | |
| 164 | 181 | static WRITE32_DEVICE_HANDLER( finalgdr_oki_bank_w ) |
| r10886 | r10887 | |
| 168 | 185 | |
| 169 | 186 | static WRITE32_HANDLER( finalgdr_backupram_bank_w ) |
| 170 | 187 | { |
| 171 | finalgdr_backupram_bank = (data & 0xff000000) >> 24; | |
| 188 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 189 | state->finalgdr_backupram_bank = (data & 0xff000000) >> 24; | |
| 172 | 190 | } |
| 173 | 191 | |
| 174 | 192 | static READ32_HANDLER( finalgdr_backupram_r ) |
| 175 | 193 | { |
| 176 | return finalgdr_backupram[offset + finalgdr_backupram_bank * 0x80] << 24; | |
| 194 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 195 | return state->finalgdr_backupram[offset + state->finalgdr_backupram_bank * 0x80] << 24; | |
| 177 | 196 | } |
| 178 | 197 | |
| 179 | 198 | static WRITE32_HANDLER( finalgdr_backupram_w ) |
| 180 | 199 | { |
| 181 | finalgdr_backupram[offset + finalgdr_backupram_bank * 0x80] = data >> 24; | |
| 200 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 201 | state->finalgdr_backupram[offset + state->finalgdr_backupram_bank * 0x80] = data >> 24; | |
| 182 | 202 | } |
| 183 | 203 | |
| 184 | 204 | static WRITE32_HANDLER( finalgdr_prize_w ) |
| r10886 | r10887 | |
| 206 | 226 | |
| 207 | 227 | |
| 208 | 228 | static ADDRESS_MAP_START( common_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 209 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(&wram) | |
| 210 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(&tiles) | |
| 229 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, wram) | |
| 230 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, tiles) | |
| 211 | 231 | AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) |
| 212 | 232 | AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0) |
| 213 | 233 | ADDRESS_MAP_END |
| 214 | 234 | |
| 215 | 235 | static ADDRESS_MAP_START( common_32bit_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 216 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(&wram32) | |
| 217 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(&tiles32) | |
| 236 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, wram32) | |
| 237 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, tiles32) | |
| 218 | 238 | AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram32_w) AM_BASE_GENERIC(paletteram) |
| 219 | 239 | AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0) |
| 220 | 240 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 329 | 349 | ADDRESS_MAP_END |
| 330 | 350 | |
| 331 | 351 | static ADDRESS_MAP_START( aoh_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 332 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(&wram32) | |
| 333 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(&tiles32) | |
| 352 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, wram32) | |
| 353 | AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE_MEMBER(vamphalf_state, tiles32) | |
| 334 | 354 | AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram32_w) AM_BASE_GENERIC(paletteram) |
| 335 | 355 | AM_RANGE(0x80210000, 0x80210003) AM_READ_PORT("SYSTEM") |
| 336 | 356 | AM_RANGE(0x80220000, 0x80220003) AM_READ_PORT("P1_P2") |
| r10886 | r10887 | |
| 367 | 387 | */ |
| 368 | 388 | static void draw_sprites(screen_device *screen, bitmap_t *bitmap) |
| 369 | 389 | { |
| 390 | vamphalf_state *state = screen->machine->driver_data<vamphalf_state>(); | |
| 370 | 391 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 371 | 392 | UINT32 cnt; |
| 372 | 393 | int block, offs; |
| r10886 | r10887 | |
| 378 | 399 | |
| 379 | 400 | for (block=0; block<0x8000; block+=0x800) |
| 380 | 401 | { |
| 381 | if(flipscreen) | |
| 402 | if(state->flipscreen) | |
| 382 | 403 | { |
| 383 | 404 | clip.min_y = 256 - (16-(block/0x800))*16; |
| 384 | 405 | clip.max_y = 256 - ((16-(block/0x800))*16)+15; |
| r10886 | r10887 | |
| 394 | 415 | offs = (block + cnt) / 2; |
| 395 | 416 | |
| 396 | 417 | // 16bit version |
| 397 | if(tiles != NULL) | |
| 418 | if(state->tiles != NULL) | |
| 398 | 419 | { |
| 399 | if(tiles[offs] & 0x0100) continue; | |
| 420 | if(state->tiles[offs] & 0x0100) continue; | |
| 400 | 421 | |
| 401 | code = tiles[offs+1]; | |
| 402 | color = (tiles[offs+2] >> palshift) & 0x7f; | |
| 422 | code = state->tiles[offs+1]; | |
| 423 | color = (state->tiles[offs+2] >> state->palshift) & 0x7f; | |
| 403 | 424 | |
| 404 | x = tiles[offs+3] & 0x01ff; | |
| 405 | y = 256 - (tiles[offs] & 0x00ff); | |
| 425 | x = state->tiles[offs+3] & 0x01ff; | |
| 426 | y = 256 - (state->tiles[offs] & 0x00ff); | |
| 406 | 427 | |
| 407 | fx = tiles[offs] & 0x8000; | |
| 408 | fy = tiles[offs] & 0x4000; | |
| 428 | fx = state->tiles[offs] & 0x8000; | |
| 429 | fy = state->tiles[offs] & 0x4000; | |
| 409 | 430 | } |
| 410 | 431 | // 32bit version |
| 411 | 432 | else |
| 412 | 433 | { |
| 413 | 434 | offs /= 2; |
| 414 | 435 | |
| 415 | if(tiles32[offs] & 0x01000000) continue; | |
| 436 | if(state->tiles32[offs] & 0x01000000) continue; | |
| 416 | 437 | |
| 417 | code = tiles32[offs] & 0xffff; | |
| 418 | color = ((tiles32[offs+1] >> palshift) & 0x7f0000) >> 16; | |
| 438 | code = state->tiles32[offs] & 0xffff; | |
| 439 | color = ((state->tiles32[offs+1] >> state->palshift) & 0x7f0000) >> 16; | |
| 419 | 440 | |
| 420 | x = tiles32[offs+1] & 0x01ff; | |
| 421 | y = 256 - ((tiles32[offs] & 0x00ff0000) >> 16); | |
| 441 | x = state->tiles32[offs+1] & 0x01ff; | |
| 442 | y = 256 - ((state->tiles32[offs] & 0x00ff0000) >> 16); | |
| 422 | 443 | |
| 423 | fx = tiles32[offs] & 0x80000000; | |
| 424 | fy = tiles32[offs] & 0x40000000; | |
| 444 | fx = state->tiles32[offs] & 0x80000000; | |
| 445 | fy = state->tiles32[offs] & 0x40000000; | |
| 425 | 446 | } |
| 426 | 447 | |
| 427 | if(flipscreen) | |
| 448 | if(state->flipscreen) | |
| 428 | 449 | { |
| 429 | 450 | fx = !fx; |
| 430 | 451 | fy = !fy; |
| r10886 | r10887 | |
| 440 | 461 | |
| 441 | 462 | static void draw_sprites_aoh(screen_device *screen, bitmap_t *bitmap) |
| 442 | 463 | { |
| 464 | vamphalf_state *state = screen->machine->driver_data<vamphalf_state>(); | |
| 443 | 465 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 444 | 466 | UINT32 cnt; |
| 445 | 467 | int block, offs; |
| r10886 | r10887 | |
| 451 | 473 | |
| 452 | 474 | for (block=0; block<0x8000; block+=0x800) |
| 453 | 475 | { |
| 454 | if(flipscreen) | |
| 476 | if(state->flipscreen) | |
| 455 | 477 | { |
| 456 | 478 | clip.min_y = 256 - (16-(block/0x800))*16; |
| 457 | 479 | clip.max_y = 256 - ((16-(block/0x800))*16)+15; |
| r10886 | r10887 | |
| 467 | 489 | offs = (block + cnt) / 2; |
| 468 | 490 | { |
| 469 | 491 | offs /= 2; |
| 470 | code = (tiles32[offs] & 0xffff) | ((tiles32[offs] & 0x3000000) >> 8); | |
| 471 | color = ((tiles32[offs+1] >> palshift) & 0x7f0000) >> 16; | |
| 492 | code = (state->tiles32[offs] & 0xffff) | ((state->tiles32[offs] & 0x3000000) >> 8); | |
| 493 | color = ((state->tiles32[offs+1] >> state->palshift) & 0x7f0000) >> 16; | |
| 472 | 494 | |
| 473 | x = tiles32[offs+1] & 0x01ff; | |
| 474 | y = 256 - ((tiles32[offs] & 0x00ff0000) >> 16); | |
| 495 | x = state->tiles32[offs+1] & 0x01ff; | |
| 496 | y = 256 - ((state->tiles32[offs] & 0x00ff0000) >> 16); | |
| 475 | 497 | |
| 476 | fx = tiles32[offs] & 0x4000000; | |
| 477 | fy = 0; // not used ? or it's tiles32[offs] & 0x8000000? | |
| 498 | fx = state->tiles32[offs] & 0x4000000; | |
| 499 | fy = 0; // not used ? or it's state->tiles32[offs] & 0x8000000? | |
| 478 | 500 | } |
| 479 | 501 | |
| 480 | if(flipscreen) | |
| 502 | if(state->flipscreen) | |
| 481 | 503 | { |
| 482 | 504 | fx = !fx; |
| 483 | 505 | fy = !fy; |
| r10886 | r10887 | |
| 634 | 656 | AM_RANGE( 0x0000, 0x007f) AM_RAM // RAM? wavetable registers? not sure. |
| 635 | 657 | ADDRESS_MAP_END |
| 636 | 658 | |
| 637 | static MACHINE_CONFIG_START( common, | |
| 659 | static MACHINE_CONFIG_START( common, | |
| 638 | 660 | MCFG_CPU_ADD("maincpu", E116T, 50000000) /* 50 MHz */ |
| 639 | 661 | MCFG_CPU_PROGRAM_MAP(common_map) |
| 640 | 662 | MCFG_CPU_VBLANK_INT("screen", irq1_line_hold) |
| r10886 | r10887 | |
| 763 | 785 | MCFG_FRAGMENT_ADD(sound_ym_oki) |
| 764 | 786 | MACHINE_CONFIG_END |
| 765 | 787 | |
| 766 | static MACHINE_CONFIG_START( aoh, | |
| 788 | static MACHINE_CONFIG_START( aoh, | |
| 767 | 789 | MCFG_CPU_ADD("maincpu", E132XN, 20000000*4) /* 4x internal multiplier */ |
| 768 | 790 | MCFG_CPU_PROGRAM_MAP(aoh_map) |
| 769 | 791 | MCFG_CPU_IO_MAP(aoh_io) |
| r10886 | r10887 | |
| 1585 | 1607 | |
| 1586 | 1608 | static READ16_HANDLER( vamphalf_speedup_r ) |
| 1587 | 1609 | { |
| 1610 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1588 | 1611 | if(cpu_get_pc(space->cpu) == 0x82de) |
| 1589 | 1612 | { |
| 1590 | 1613 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1593 | 1616 | cpu_eat_cycles(space->cpu, 50); |
| 1594 | 1617 | } |
| 1595 | 1618 | |
| 1596 | return wram[(0x4a840/2)+offset]; | |
| 1619 | return state->wram[(0x4a840/2)+offset]; | |
| 1597 | 1620 | } |
| 1598 | 1621 | |
| 1599 | 1622 | static READ16_HANDLER( vamphafk_speedup_r ) |
| 1600 | 1623 | { |
| 1624 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1601 | 1625 | if(cpu_get_pc(space->cpu) == 0x82de) |
| 1602 | 1626 | { |
| 1603 | 1627 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1606 | 1630 | cpu_eat_cycles(space->cpu, 50); |
| 1607 | 1631 | } |
| 1608 | 1632 | |
| 1609 | return wram[(0x4a6d0/2)+offset]; | |
| 1633 | return state->wram[(0x4a6d0/2)+offset]; | |
| 1610 | 1634 | } |
| 1611 | 1635 | |
| 1612 | 1636 | static READ16_HANDLER( misncrft_speedup_r ) |
| 1613 | 1637 | { |
| 1638 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1614 | 1639 | if(cpu_get_pc(space->cpu) == 0xecc8) |
| 1615 | 1640 | { |
| 1616 | 1641 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1619 | 1644 | cpu_eat_cycles(space->cpu, 50); |
| 1620 | 1645 | } |
| 1621 | 1646 | |
| 1622 | return wram[(0x72eb4/2)+offset]; | |
| 1647 | return state->wram[(0x72eb4/2)+offset]; | |
| 1623 | 1648 | } |
| 1624 | 1649 | |
| 1625 | 1650 | static READ16_HANDLER( coolmini_speedup_r ) |
| 1626 | 1651 | { |
| 1652 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1627 | 1653 | if(cpu_get_pc(space->cpu) == 0x75f7a) |
| 1628 | 1654 | { |
| 1629 | 1655 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1632 | 1658 | cpu_eat_cycles(space->cpu, 50); |
| 1633 | 1659 | } |
| 1634 | 1660 | |
| 1635 | return wram[(0xd2e80/2)+offset]; | |
| 1661 | return state->wram[(0xd2e80/2)+offset]; | |
| 1636 | 1662 | } |
| 1637 | 1663 | |
| 1638 | 1664 | static READ16_HANDLER( suplup_speedup_r ) |
| 1639 | 1665 | { |
| 1666 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1640 | 1667 | if(cpu_get_pc(space->cpu) == 0xaf18a ) |
| 1641 | 1668 | { |
| 1642 | 1669 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1645 | 1672 | cpu_eat_cycles(space->cpu, 50); |
| 1646 | 1673 | } |
| 1647 | 1674 | |
| 1648 | return wram[(0x11605c/2)+offset]; | |
| 1675 | return state->wram[(0x11605c/2)+offset]; | |
| 1649 | 1676 | } |
| 1650 | 1677 | |
| 1651 | 1678 | static READ16_HANDLER( luplup_speedup_r ) |
| 1652 | 1679 | { |
| 1680 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1653 | 1681 | if(cpu_get_pc(space->cpu) == 0xaefac ) |
| 1654 | 1682 | { |
| 1655 | 1683 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1658 | 1686 | cpu_eat_cycles(space->cpu, 50); |
| 1659 | 1687 | } |
| 1660 | 1688 | |
| 1661 | return wram[(0x115e84/2)+offset]; | |
| 1689 | return state->wram[(0x115e84/2)+offset]; | |
| 1662 | 1690 | } |
| 1663 | 1691 | |
| 1664 | 1692 | static READ16_HANDLER( luplup29_speedup_r ) |
| 1665 | 1693 | { |
| 1694 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1666 | 1695 | if(cpu_get_pc(space->cpu) == 0xae6c0 ) |
| 1667 | 1696 | { |
| 1668 | 1697 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1671 | 1700 | cpu_eat_cycles(space->cpu, 50); |
| 1672 | 1701 | } |
| 1673 | 1702 | |
| 1674 | return wram[(0x113f08/2)+offset]; | |
| 1703 | return state->wram[(0x113f08/2)+offset]; | |
| 1675 | 1704 | } |
| 1676 | 1705 | |
| 1677 | 1706 | static READ16_HANDLER( puzlbang_speedup_r ) |
| 1678 | 1707 | { |
| 1708 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1679 | 1709 | if(cpu_get_pc(space->cpu) == 0xae6d2 ) |
| 1680 | 1710 | { |
| 1681 | 1711 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1684 | 1714 | cpu_eat_cycles(space->cpu, 50); |
| 1685 | 1715 | } |
| 1686 | 1716 | |
| 1687 | return wram[(0x113ecc/2)+offset]; | |
| 1717 | return state->wram[(0x113ecc/2)+offset]; | |
| 1688 | 1718 | } |
| 1689 | 1719 | |
| 1690 | 1720 | static READ32_HANDLER( wyvernwg_speedup_r ) |
| 1691 | 1721 | { |
| 1722 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1692 | 1723 | if(cpu_get_pc(space->cpu) == 0x10758 ) |
| 1693 | 1724 | { |
| 1694 | 1725 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1697 | 1728 | cpu_eat_cycles(space->cpu, 50); |
| 1698 | 1729 | } |
| 1699 | 1730 | |
| 1700 | return wram32[0x00b56fc/4]; | |
| 1731 | return state->wram32[0x00b56fc/4]; | |
| 1701 | 1732 | } |
| 1702 | 1733 | |
| 1703 | 1734 | static READ32_HANDLER( finalgdr_speedup_r ) |
| 1704 | 1735 | { |
| 1736 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1705 | 1737 | if(cpu_get_pc(space->cpu) == 0x1c212) |
| 1706 | 1738 | { |
| 1707 | 1739 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1710 | 1742 | cpu_eat_cycles(space->cpu, 50); |
| 1711 | 1743 | } |
| 1712 | 1744 | |
| 1713 | return wram32[0x005e874/4]; | |
| 1745 | return state->wram32[0x005e874/4]; | |
| 1714 | 1746 | } |
| 1715 | 1747 | |
| 1716 | 1748 | static READ32_HANDLER( mrkicker_speedup_r ) |
| 1717 | 1749 | { |
| 1750 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1718 | 1751 | UINT32 pc = cpu_get_pc(space->cpu); |
| 1719 | 1752 | if(pc == 0x469de || pc == 0x46a36) |
| 1720 | 1753 | { |
| r10886 | r10887 | |
| 1724 | 1757 | cpu_eat_cycles(space->cpu, 50); |
| 1725 | 1758 | } |
| 1726 | 1759 | |
| 1727 | return wram32[0x00701a4/4]; | |
| 1760 | return state->wram32[0x00701a4/4]; | |
| 1728 | 1761 | } |
| 1729 | 1762 | |
| 1730 | 1763 | |
| 1731 | 1764 | static READ16_HANDLER( dquizgo2_speedup_r ) |
| 1732 | 1765 | { |
| 1766 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1733 | 1767 | if(cpu_get_pc(space->cpu) == 0xaa622) |
| 1734 | 1768 | { |
| 1735 | 1769 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1738 | 1772 | cpu_eat_cycles(space->cpu, 50); |
| 1739 | 1773 | } |
| 1740 | 1774 | |
| 1741 | return wram[(0xcde70/2)+offset]; | |
| 1775 | return state->wram[(0xcde70/2)+offset]; | |
| 1742 | 1776 | } |
| 1743 | 1777 | |
| 1744 | 1778 | static READ32_HANDLER( aoh_speedup_r ) |
| 1745 | 1779 | { |
| 1780 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1746 | 1781 | if(cpu_get_pc(space->cpu) == 0xb994 ) |
| 1747 | 1782 | { |
| 1748 | 1783 | cpu_eat_cycles(space->cpu, 500); |
| r10886 | r10887 | |
| 1753 | 1788 | } |
| 1754 | 1789 | |
| 1755 | 1790 | |
| 1756 | return wram32[0x28a09c/4]; | |
| 1791 | return state->wram32[0x28a09c/4]; | |
| 1757 | 1792 | } |
| 1758 | 1793 | |
| 1759 | 1794 | static READ16_HANDLER( jmpbreak_speedup_r ) |
| 1760 | 1795 | { |
| 1796 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1761 | 1797 | if(cpu_get_pc(space->cpu) == 0x983c) |
| 1762 | 1798 | { |
| 1763 | 1799 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1766 | 1802 | cpu_eat_cycles(space->cpu, 50); |
| 1767 | 1803 | } |
| 1768 | 1804 | |
| 1769 | return wram[(0x00906fc / 2)+offset]; | |
| 1805 | return state->wram[(0x00906fc / 2)+offset]; | |
| 1770 | 1806 | } |
| 1771 | 1807 | |
| 1772 | 1808 | static READ16_HANDLER( mrdig_speedup_r ) |
| 1773 | 1809 | { |
| 1810 | vamphalf_state *state = space->machine->driver_data<vamphalf_state>(); | |
| 1774 | 1811 | if(cpu_get_pc(space->cpu) == 0x1710) |
| 1775 | 1812 | { |
| 1776 | 1813 | if(irq_active(space)) |
| r10886 | r10887 | |
| 1779 | 1816 | cpu_eat_cycles(space->cpu, 50); |
| 1780 | 1817 | } |
| 1781 | 1818 | |
| 1782 | return wram[(0x00a99c / 2)+offset]; | |
| 1819 | return state->wram[(0x00a99c / 2)+offset]; | |
| 1783 | 1820 | } |
| 1784 | 1821 | |
| 1785 | 1822 | static DRIVER_INIT( vamphalf ) |
| 1786 | 1823 | { |
| 1824 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1787 | 1825 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0004a840, 0x0004a843, 0, 0, vamphalf_speedup_r ); |
| 1788 | 1826 | |
| 1789 | palshift = 0; | |
| 1790 | flip_bit = 0x80; | |
| 1827 | state->palshift = 0; | |
| 1828 | state->flip_bit = 0x80; | |
| 1791 | 1829 | } |
| 1792 | 1830 | |
| 1793 | 1831 | static DRIVER_INIT( vamphafk ) |
| 1794 | 1832 | { |
| 1833 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1795 | 1834 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0004a6d0, 0x0004a6d3, 0, 0, vamphafk_speedup_r ); |
| 1796 | 1835 | |
| 1797 | palshift = 0; | |
| 1798 | flip_bit = 0x80; | |
| 1836 | state->palshift = 0; | |
| 1837 | state->flip_bit = 0x80; | |
| 1799 | 1838 | } |
| 1800 | 1839 | |
| 1801 | 1840 | static DRIVER_INIT( misncrft ) |
| 1802 | 1841 | { |
| 1842 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1803 | 1843 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00072eb4, 0x00072eb7, 0, 0, misncrft_speedup_r ); |
| 1804 | 1844 | |
| 1805 | palshift = 0; | |
| 1806 | flip_bit = 1; | |
| 1845 | state->palshift = 0; | |
| 1846 | state->flip_bit = 1; | |
| 1807 | 1847 | } |
| 1808 | 1848 | |
| 1809 | 1849 | static DRIVER_INIT( coolmini ) |
| 1810 | 1850 | { |
| 1851 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1811 | 1852 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000d2e80, 0x000d2e83, 0, 0, coolmini_speedup_r ); |
| 1812 | 1853 | |
| 1813 | palshift = 0; | |
| 1814 | flip_bit = 1; | |
| 1854 | state->palshift = 0; | |
| 1855 | state->flip_bit = 1; | |
| 1815 | 1856 | } |
| 1816 | 1857 | |
| 1817 | 1858 | static DRIVER_INIT( suplup ) |
| 1818 | 1859 | { |
| 1860 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1819 | 1861 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0011605c, 0x0011605f, 0, 0, suplup_speedup_r ); |
| 1820 | 1862 | |
| 1821 | palshift = 8; | |
| 1863 | state->palshift = 8; | |
| 1822 | 1864 | /* no flipscreen */ |
| 1823 | 1865 | } |
| 1824 | 1866 | |
| 1825 | 1867 | static DRIVER_INIT( luplup ) |
| 1826 | 1868 | { |
| 1869 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1827 | 1870 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00115e84, 0x00115e87, 0, 0, luplup_speedup_r ); |
| 1828 | 1871 | |
| 1829 | palshift = 8; | |
| 1872 | state->palshift = 8; | |
| 1830 | 1873 | /* no flipscreen */ |
| 1831 | 1874 | } |
| 1832 | 1875 | |
| 1833 | 1876 | static DRIVER_INIT( luplup29 ) |
| 1834 | 1877 | { |
| 1878 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1835 | 1879 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00113f08, 0x00113f0b, 0, 0, luplup29_speedup_r ); |
| 1836 | 1880 | |
| 1837 | palshift = 8; | |
| 1881 | state->palshift = 8; | |
| 1838 | 1882 | /* no flipscreen */ |
| 1839 | 1883 | } |
| 1840 | 1884 | |
| 1841 | 1885 | static DRIVER_INIT( puzlbang ) |
| 1842 | 1886 | { |
| 1887 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1843 | 1888 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00113ecc, 0x00113ecf, 0, 0, puzlbang_speedup_r ); |
| 1844 | 1889 | |
| 1845 | palshift = 8; | |
| 1890 | state->palshift = 8; | |
| 1846 | 1891 | /* no flipscreen */ |
| 1847 | 1892 | } |
| 1848 | 1893 | |
| 1849 | 1894 | static DRIVER_INIT( wyvernwg ) |
| 1850 | 1895 | { |
| 1896 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1851 | 1897 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00b56fc, 0x00b56ff, 0, 0, wyvernwg_speedup_r ); |
| 1852 | 1898 | |
| 1853 | palshift = 0; | |
| 1854 | flip_bit = 1; | |
| 1899 | state->palshift = 0; | |
| 1900 | state->flip_bit = 1; | |
| 1855 | 1901 | |
| 1856 | semicom_prot_idx = 8; | |
| 1857 | semicom_prot_data[0] = 2; | |
| 1858 | semicom_prot_data[1] = 1; | |
| 1902 | state->semicom_prot_idx = 8; | |
| 1903 | state->semicom_prot_data[0] = 2; | |
| 1904 | state->semicom_prot_data[1] = 1; | |
| 1859 | 1905 | } |
| 1860 | 1906 | |
| 1861 | 1907 | static DRIVER_INIT( finalgdr ) |
| 1862 | 1908 | { |
| 1863 | finalgdr_backupram_bank = 1; | |
| 1864 | finalgdr_backupram = auto_alloc_array(machine, UINT8, 0x80*0x100); | |
| 1909 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1910 | state->finalgdr_backupram_bank = 1; | |
| 1911 | state->finalgdr_backupram = auto_alloc_array(machine, UINT8, 0x80*0x100); | |
| 1865 | 1912 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x005e874, 0x005e877, 0, 0, finalgdr_speedup_r ); |
| 1866 | machine->device<nvram_device>("nvram")->set_base(finalgdr_backupram, 0x80*0x100); | |
| 1913 | machine->device<nvram_device>("nvram")->set_base(state->finalgdr_backupram, 0x80*0x100); | |
| 1867 | 1914 | |
| 1868 | palshift = 0; | |
| 1869 | flip_bit = 1; //? | |
| 1915 | state->palshift = 0; | |
| 1916 | state->flip_bit = 1; //? | |
| 1870 | 1917 | |
| 1871 | semicom_prot_idx = 8; | |
| 1872 | semicom_prot_data[0] = 2; | |
| 1873 | semicom_prot_data[1] = 3; | |
| 1918 | state->semicom_prot_idx = 8; | |
| 1919 | state->semicom_prot_data[0] = 2; | |
| 1920 | state->semicom_prot_data[1] = 3; | |
| 1874 | 1921 | } |
| 1875 | 1922 | |
| 1876 | 1923 | static DRIVER_INIT( mrkicker ) |
| 1877 | 1924 | { |
| 1925 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1878 | 1926 | // backup ram isn't used |
| 1879 | finalgdr_backupram_bank = 1; | |
| 1880 | finalgdr_backupram = auto_alloc_array(machine, UINT8, 0x80*0x100); | |
| 1927 | state->finalgdr_backupram_bank = 1; | |
| 1928 | state->finalgdr_backupram = auto_alloc_array(machine, UINT8, 0x80*0x100); | |
| 1881 | 1929 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00701a4, 0x00701a7, 0, 0, mrkicker_speedup_r ); |
| 1882 | machine->device<nvram_device>("nvram")->set_base(finalgdr_backupram, 0x80*0x100); | |
| 1930 | machine->device<nvram_device>("nvram")->set_base(state->finalgdr_backupram, 0x80*0x100); | |
| 1883 | 1931 | |
| 1884 | palshift = 0; | |
| 1885 | flip_bit = 1; //? | |
| 1932 | state->palshift = 0; | |
| 1933 | state->flip_bit = 1; //? | |
| 1886 | 1934 | |
| 1887 | semicom_prot_idx = 8; | |
| 1888 | semicom_prot_data[0] = 2; | |
| 1889 | semicom_prot_data[1] = 3; | |
| 1935 | state->semicom_prot_idx = 8; | |
| 1936 | state->semicom_prot_data[0] = 2; | |
| 1937 | state->semicom_prot_data[1] = 3; | |
| 1890 | 1938 | } |
| 1891 | 1939 | |
| 1892 | 1940 | static DRIVER_INIT( dquizgo2 ) |
| 1893 | 1941 | { |
| 1942 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1894 | 1943 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00cde70, 0x00cde73, 0, 0, dquizgo2_speedup_r ); |
| 1895 | 1944 | |
| 1896 | palshift = 0; | |
| 1897 | flip_bit = 1; | |
| 1945 | state->palshift = 0; | |
| 1946 | state->flip_bit = 1; | |
| 1898 | 1947 | } |
| 1899 | 1948 | |
| 1900 | 1949 | static DRIVER_INIT( aoh ) |
| 1901 | 1950 | { |
| 1951 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1902 | 1952 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x028a09c, 0x028a09f, 0, 0, aoh_speedup_r ); |
| 1903 | 1953 | |
| 1904 | palshift = 0; | |
| 1954 | state->palshift = 0; | |
| 1905 | 1955 | /* no flipscreen */ |
| 1906 | 1956 | } |
| 1907 | 1957 | |
| 1908 | 1958 | static DRIVER_INIT( jmpbreak ) |
| 1909 | 1959 | { |
| 1960 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1910 | 1961 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00906fc, 0x00906ff, 0, 0, jmpbreak_speedup_r ); |
| 1911 | 1962 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe0000000, 0xe0000003, 0, 0, jmpbreak_flipscreen_w ); |
| 1912 | 1963 | |
| 1913 | palshift = 0; | |
| 1964 | state->palshift = 0; | |
| 1914 | 1965 | } |
| 1915 | 1966 | |
| 1916 | 1967 | static DRIVER_INIT( mrdig ) |
| 1917 | 1968 | { |
| 1969 | vamphalf_state *state = machine->driver_data<vamphalf_state>(); | |
| 1918 | 1970 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00a99c, 0x00a99f, 0, 0, mrdig_speedup_r ); |
| 1919 | 1971 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe0000000, 0xe0000003, 0, 0, jmpbreak_flipscreen_w ); |
| 1920 | 1972 | |
| 1921 | palshift = 0; | |
| 1973 | state->palshift = 0; | |
| 1922 | 1974 | } |
| 1923 | 1975 | |
| 1924 | 1976 | GAME( 1999, coolmini, 0, coolmini, common, coolmini, ROT0, "SemiCom", "Cool Minigame Collection", 0 ) |
| r10886 | r10887 | |
|---|---|---|
| 75 | 75 | #include "deprecat.h" |
| 76 | 76 | #include "includes/flower.h" |
| 77 | 77 | |
| 78 | static UINT8 *sn_irq_enable; | |
| 79 | static UINT8 *sn_nmi_enable; | |
| 80 | 78 | |
| 81 | 79 | static WRITE8_HANDLER( flower_irq_ack ) |
| 82 | 80 | { |
| r10886 | r10887 | |
| 85 | 83 | |
| 86 | 84 | static WRITE8_HANDLER( sn_irq_enable_w ) |
| 87 | 85 | { |
| 88 | *sn_irq_enable = data; | |
| 86 | flower_state *state = space->machine->driver_data<flower_state>(); | |
| 87 | *state->sn_irq_enable = data; | |
| 89 | 88 | |
| 90 | 89 | cputag_set_input_line(space->machine, "audiocpu", 0, CLEAR_LINE); |
| 91 | 90 | } |
| 92 | 91 | |
| 93 | 92 | static INTERRUPT_GEN( sn_irq ) |
| 94 | 93 | { |
| 95 | if ((*sn_irq_enable & 1) == 1) | |
| 94 | flower_state *state = device->machine->driver_data<flower_state>(); | |
| 95 | if ((*state->sn_irq_enable & 1) == 1) | |
| 96 | 96 | cpu_set_input_line(device, 0, ASSERT_LINE); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static WRITE8_HANDLER( sound_command_w ) |
| 100 | 100 | { |
| 101 | flower_state *state = space->machine->driver_data<flower_state>(); | |
| 101 | 102 | soundlatch_w(space, 0, data); |
| 102 | if ((*sn_nmi_enable & 1) == 1) | |
| 103 | if ((*state->sn_nmi_enable & 1) == 1) | |
| 103 | 104 | cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); |
| 104 | 105 | } |
| 105 | 106 | |
| r10886 | r10887 | |
| 118 | 119 | AM_RANGE(0xa400, 0xa400) AM_WRITE(sound_command_w) |
| 119 | 120 | AM_RANGE(0xc000, 0xddff) AM_SHARE("share1") AM_RAM |
| 120 | 121 | AM_RANGE(0xde00, 0xdfff) AM_SHARE("share2") AM_RAM AM_BASE_MEMBER(flower_state, spriteram) |
| 121 | AM_RANGE(0xe000, 0xe7ff) AM_SHARE("share3") AM_RAM_WRITE(flower_textram_w) AM_BASE( | |
| 122 | AM_RANGE(0xe000, 0xe7ff) AM_SHARE("share3") AM_RAM_WRITE(flower_textram_w) AM_BASE_MEMBER( | |
| 122 | 123 | AM_RANGE(0xe000, 0xefff) AM_SHARE("share4") AM_RAM //only cleared? |
| 123 | AM_RANGE(0xf000, 0xf1ff) AM_SHARE("share5") AM_RAM_WRITE(flower_bg0ram_w) AM_BASE(&flower_bg0ram) | |
| 124 | AM_RANGE(0xf200, 0xf200) AM_SHARE("share6") AM_RAM AM_BASE(&flower_bg0_scroll) | |
| 125 | AM_RANGE(0xf800, 0xf9ff) AM_SHARE("share7") AM_RAM_WRITE(flower_bg1ram_w) AM_BASE(&flower_bg1ram) | |
| 126 | AM_RANGE(0xfa00, 0xfa00) AM_SHARE("share8") AM_RAM AM_BASE(&flower_bg1_scroll) | |
| 124 | AM_RANGE(0xf000, 0xf1ff) AM_SHARE("share5") AM_RAM_WRITE(flower_bg0ram_w) AM_BASE_MEMBER(flower_state, bg0ram) | |
| 125 | AM_RANGE(0xf200, 0xf200) AM_SHARE("share6") AM_RAM AM_BASE_MEMBER(flower_state, bg0_scroll) | |
| 126 | AM_RANGE(0xf800, 0xf9ff) AM_SHARE("share7") AM_RAM_WRITE(flower_bg1ram_w) AM_BASE_MEMBER(flower_state, bg1ram) | |
| 127 | AM_RANGE(0xfa00, 0xfa00) AM_SHARE("share8") AM_RAM AM_BASE_MEMBER(flower_state, bg1_scroll) | |
| 127 | 128 | ADDRESS_MAP_END |
| 128 | 129 | |
| 129 | 130 | |
| 130 | 131 | static ADDRESS_MAP_START( flower_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 ) |
| 131 | 132 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 132 | AM_RANGE(0x4000, 0x4000) AM_WRITE(sn_irq_enable_w) AM_BASE(&sn_irq_enable) | |
| 133 | AM_RANGE(0x4001, 0x4001) AM_WRITEONLY AM_BASE(&sn_nmi_enable) | |
| 133 | AM_RANGE(0x4000, 0x4000) AM_WRITE(sn_irq_enable_w) AM_BASE_MEMBER(flower_state, sn_irq_enable) | |
| 134 | AM_RANGE(0x4001, 0x4001) AM_WRITEONLY AM_BASE_MEMBER(flower_state, sn_nmi_enable) | |
| 134 | 135 | AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r) |
| 135 | 136 | AM_RANGE(0x8000, 0x803f) AM_DEVWRITE("flower", flower_sound1_w) |
| 136 | 137 | AM_RANGE(0xa000, 0xa03f) AM_DEVWRITE("flower", flower_sound2_w) |
| r10886 | r10887 | |
|---|---|---|
| 47 | 47 | #include "sound/ay8910.h" |
| 48 | 48 | #include "video/mc6845.h" |
| 49 | 49 | |
| 50 | static UINT8 *hitpoker_sys_regs; | |
| 51 | static UINT8 hitpoker_pic_data; | |
| 52 | static UINT8 *videoram; | |
| 53 | static UINT8 *paletteram; | |
| 54 | static UINT8 *colorram; | |
| 55 | 50 | |
| 51 | class hitpoker_state : public driver_device | |
| 52 | { | |
| 53 | public: | |
| 54 | hitpoker_state(running_machine &machine, const driver_device_config_base &config) | |
| 55 | : driver_device(machine, config) { } | |
| 56 | ||
| 57 | UINT8 *sys_regs; | |
| 58 | UINT8 pic_data; | |
| 59 | UINT8 *videoram; | |
| 60 | UINT8 *paletteram; | |
| 61 | UINT8 *colorram; | |
| 62 | UINT8 eeprom_data[0x200]; | |
| 63 | UINT16 eeprom_index; | |
| 64 | UINT8 tmp; | |
| 65 | }; | |
| 66 | ||
| 67 | ||
| 56 | 68 | #define CRTC_CLOCK XTAL_3_579545MHz |
| 57 | 69 | |
| 58 | 70 | static VIDEO_START(hitpoker) |
| 59 | 71 | { |
| 60 | videoram = auto_alloc_array(machine, UINT8, 0x35ff); | |
| 61 | paletteram = auto_alloc_array(machine, UINT8, 0x1000); | |
| 62 | colorram = auto_alloc_array(machine, UINT8, 0x2000); | |
| 72 | hitpoker_state *state = machine->driver_data<hitpoker_state>(); | |
| 73 | state->videoram = auto_alloc_array(machine, UINT8, 0x35ff); | |
| 74 | state->paletteram = auto_alloc_array(machine, UINT8, 0x1000); | |
| 75 | state->colorram = auto_alloc_array(machine, UINT8, 0x2000); | |
| 63 | 76 | } |
| 64 | 77 | |
| 65 | 78 | static SCREEN_UPDATE(hitpoker) |
| 66 | 79 | { |
| 80 | hitpoker_state *state = screen->machine->driver_data<hitpoker_state>(); | |
| 67 | 81 | int count = 0; |
| 68 | 82 | int y,x; |
| 69 | 83 | |
| r10886 | r10887 | |
| 75 | 89 | { |
| 76 | 90 | int tile,color,gfx_bpp; |
| 77 | 91 | |
| 78 | tile = (((videoram[count]<<8)|(videoram[count+1])) & 0x3fff); | |
| 79 | gfx_bpp = (colorram[count] & 0x80)>>7; //flag between 4 and 8 bpp | |
| 80 | color = gfx_bpp ? ((colorram[count] & 0x70)>>4) : (colorram[count] & 0xf); | |
| 92 | tile = (((state->videoram[count]<<8)|(state->videoram[count+1])) & 0x3fff); | |
| 93 | gfx_bpp = (state->colorram[count] & 0x80)>>7; //flag between 4 and 8 bpp | |
| 94 | color = gfx_bpp ? ((state->colorram[count] & 0x70)>>4) : (state->colorram[count] & 0xf); | |
| 81 | 95 | |
| 82 | 96 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_bpp],tile,color,0,0,x*8,y*8); |
| 83 | 97 | |
| r10886 | r10887 | |
| 90 | 104 | |
| 91 | 105 | static READ8_HANDLER( hitpoker_vram_r ) |
| 92 | 106 | { |
| 107 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 93 | 108 | UINT8 *ROM = space->machine->region("maincpu")->base(); |
| 94 | 109 | |
| 95 | if(hitpoker_pic_data & 0x10) | |
| 96 | return videoram[offset]; | |
| 110 | if(state->pic_data & 0x10) | |
| 111 | return state->videoram[offset]; | |
| 97 | 112 | else |
| 98 | 113 | return ROM[offset+0x8000]; |
| 99 | 114 | } |
| 100 | 115 | |
| 101 | 116 | static WRITE8_HANDLER( hitpoker_vram_w ) |
| 102 | 117 | { |
| 118 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 103 | 119 | // UINT8 *ROM = space->machine->region("maincpu")->base(); |
| 104 | 120 | |
| 105 | // if(hitpoker_sys_regs[0x00] & 0x10) | |
| 106 | videoram[offset] = data; | |
| 121 | // if(state->sys_regs[0x00] & 0x10) | |
| 122 | state->videoram[offset] = data; | |
| 107 | 123 | } |
| 108 | 124 | |
| 109 | 125 | static READ8_HANDLER( hitpoker_cram_r ) |
| 110 | 126 | { |
| 127 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 111 | 128 | UINT8 *ROM = space->machine->region("maincpu")->base(); |
| 112 | 129 | |
| 113 | if(hitpoker_pic_data & 0x10) | |
| 114 | return colorram[offset]; | |
| 130 | if(state->pic_data & 0x10) | |
| 131 | return state->colorram[offset]; | |
| 115 | 132 | else |
| 116 | 133 | return ROM[offset+0xc000]; |
| 117 | 134 | } |
| 118 | 135 | |
| 119 | 136 | static WRITE8_HANDLER( hitpoker_cram_w ) |
| 120 | 137 | { |
| 121 | colorram[offset] = data; | |
| 138 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 139 | state->colorram[offset] = data; | |
| 122 | 140 | } |
| 123 | 141 | |
| 124 | 142 | static READ8_HANDLER( hitpoker_paletteram_r ) |
| 125 | 143 | { |
| 144 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 126 | 145 | UINT8 *ROM = space->machine->region("maincpu")->base(); |
| 127 | 146 | |
| 128 | if(hitpoker_pic_data & 0x10) | |
| 129 | return paletteram[offset]; | |
| 147 | if(state->pic_data & 0x10) | |
| 148 | return state->paletteram[offset]; | |
| 130 | 149 | else |
| 131 | 150 | return ROM[offset+0xe000]; |
| 132 | 151 | } |
| 133 | 152 | |
| 134 | 153 | static WRITE8_HANDLER( hitpoker_paletteram_w ) |
| 135 | 154 | { |
| 155 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 136 | 156 | int r,g,b,datax; |
| 137 | paletteram[offset] = data; | |
| 157 | state->paletteram[offset] = data; | |
| 138 | 158 | offset>>=1; |
| 139 | datax=256*paletteram[offset*2]+paletteram[offset*2+1]; | |
| 159 | datax=256*state->paletteram[offset*2]+state->paletteram[offset*2+1]; | |
| 140 | 160 | |
| 141 | 161 | /* RGB565 */ |
| 142 | 162 | b = ((datax)&0xf800)>>11; |
| r10886 | r10887 | |
| 151 | 171 | return 0x80; //kludge it for now |
| 152 | 172 | } |
| 153 | 173 | |
| 154 | static UINT8 eeprom_data[0x200]; | |
| 155 | static UINT16 eeprom_index; | |
| 156 | 174 | |
| 157 | 175 | /* tests 0x180, what EEPROM is this one??? */ |
| 158 | 176 | static WRITE8_HANDLER( eeprom_w ) |
| 159 | 177 | { |
| 178 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 160 | 179 | if(offset == 0) |
| 161 | 180 | { |
| 162 | eeprom_index = (eeprom_index & 0x100)|(data & 0xff); | |
| 181 | state->eeprom_index = (state->eeprom_index & 0x100)|(data & 0xff); | |
| 163 | 182 | //printf("W INDEX %02x\n",data); |
| 164 | 183 | } |
| 165 | 184 | if(offset == 1) |
| 166 | 185 | { |
| 167 | eeprom_index = (eeprom_index & 0xff)|((data & 0x1)<<8); | |
| 186 | state->eeprom_index = (state->eeprom_index & 0xff)|((data & 0x1)<<8); | |
| 168 | 187 | //data & 0x4: eeprom clock |
| 169 | 188 | //printf("W CLOCK + INDEX %02x\n",data); |
| 170 | 189 | } |
| r10886 | r10887 | |
| 172 | 191 | |
| 173 | 192 | static READ8_HANDLER( eeprom_r ) |
| 174 | 193 | { |
| 175 | static UINT8 tmp; | |
| 176 | tmp = eeprom_data[eeprom_index]; | |
| 177 | if((eeprom_index & 0x1f) == 0x1f) | |
| 178 | tmp = 0xaa; | |
| 179 | //printf("%02x\n",eeprom_index); | |
| 180 | eeprom_index++; | |
| 181 | //eeprom_index&=0x1f; | |
| 182 | return tmp; | |
| 194 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 195 | state->tmp = state->eeprom_data[state->eeprom_index]; | |
| 196 | if((state->eeprom_index & 0x1f) == 0x1f) | |
| 197 | state->tmp = 0xaa; | |
| 198 | //printf("%02x\n",state->eeprom_index); | |
| 199 | state->eeprom_index++; | |
| 200 | //state->eeprom_index&=0x1f; | |
| 201 | return state->tmp; | |
| 183 | 202 | } |
| 184 | 203 | |
| 185 | 204 | static READ8_HANDLER( hitpoker_pic_r ) |
| 186 | 205 | { |
| 206 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 187 | 207 | // logerror("R\n"); |
| 188 | 208 | |
| 189 | 209 | if(offset == 0) |
| r10886 | r10887 | |
| 192 | 212 | cpu_get_pc(space->cpu) == 0x314e || |
| 193 | 213 | cpu_get_pc(space->cpu) == 0x3164 || |
| 194 | 214 | cpu_get_pc(space->cpu) == 0x3179) |
| 195 | return | |
| 215 | return s | |
| 196 | 216 | |
| 197 | return ( | |
| 217 | return (s | |
| 198 | 218 | } |
| 199 | 219 | |
| 200 | return | |
| 220 | return s | |
| 201 | 221 | } |
| 202 | 222 | |
| 203 | 223 | static WRITE8_HANDLER( hitpoker_pic_w ) |
| 204 | 224 | { |
| 225 | hitpoker_state *state = space->machine->driver_data<hitpoker_state>(); | |
| 205 | 226 | if(offset == 0) |
| 206 | | |
| 227 | s | |
| 207 | 228 | // logerror("%02x W\n",data); |
| 208 | | |
| 229 | s | |
| 209 | 230 | } |
| 210 | 231 | |
| 211 | 232 | #if 0 |
| r10886 | r10887 | |
| 239 | 260 | ADDRESS_MAP_END |
| 240 | 261 | |
| 241 | 262 | static ADDRESS_MAP_START( hitpoker_io, ADDRESS_SPACE_IO, 8 ) |
| 242 | AM_RANGE(MC68HC11_IO_PORTA, MC68HC11_IO_PORTA) AM_READWRITE(hitpoker_pic_r,hitpoker_pic_w) AM_BASE( | |
| 263 | AM_RANGE(MC68HC11_IO_PORTA, MC68HC11_IO_PORTA) AM_READWRITE(hitpoker_pic_r,hitpoker_pic_w) AM_BASE_MEMBER( | |
| 243 | 264 | ADDRESS_MAP_END |
| 244 | 265 | |
| 245 | 266 | static INPUT_PORTS_START( hitpoker ) |
| r10886 | r10887 | |
| 461 | 482 | cpu_set_input_line(device, MC68HC11_IRQ_LINE, HOLD_LINE); |
| 462 | 483 | } |
| 463 | 484 | |
| 464 | static MACHINE_CONFIG_START( hitpoker, | |
| 485 | static MACHINE_CONFIG_START( hitpoker, h | |
| 465 | 486 | MCFG_CPU_ADD("maincpu", MC68HC11,1000000) |
| 466 | 487 | MCFG_CPU_PROGRAM_MAP(hitpoker_map) |
| 467 | 488 | MCFG_CPU_IO_MAP(hitpoker_io) |
| r10886 | r10887 | |
|---|---|---|
| 10 | 10 | #include "cpu/z80/z80.h" |
| 11 | 11 | #include "sound/ay8910.h" |
| 12 | 12 | |
| 13 | static UINT8 *buster_rom; | |
| 14 | static UINT8 *buster_vram; | |
| 15 | 13 | |
| 14 | class buster_state : public driver_device | |
| 15 | { | |
| 16 | public: | |
| 17 | buster_state(running_machine &machine, const driver_device_config_base &config) | |
| 18 | : driver_device(machine, config) { } | |
| 19 | ||
| 20 | UINT8 *rom; | |
| 21 | UINT8 *vram; | |
| 22 | }; | |
| 23 | ||
| 24 | ||
| 16 | 25 | static VIDEO_START(buster) |
| 17 | 26 | { |
| 18 | ||
| 19 | 27 | } |
| 20 | 28 | |
| 21 | 29 | static SCREEN_UPDATE(buster) |
| 22 | 30 | { |
| 31 | buster_state *state = screen->machine->driver_data<buster_state>(); | |
| 23 | 32 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 24 | 33 | int count = 0x0000; |
| 25 | 34 | |
| r10886 | r10887 | |
| 30 | 39 | { |
| 31 | 40 | for (x=0;x<32;x++) |
| 32 | 41 | { |
| 33 | int tile = ( | |
| 42 | int tile = ( | |
| 34 | 43 | //int colour = tile>>12; |
| 35 | 44 | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*4); |
| 36 | 45 | |
| r10886 | r10887 | |
| 41 | 50 | } |
| 42 | 51 | |
| 43 | 52 | static ADDRESS_MAP_START( mainmap, ADDRESS_SPACE_PROGRAM, 8 ) |
| 44 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE( | |
| 53 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE_MEMBER( | |
| 45 | 54 | AM_RANGE(0x4000, 0x47ff) AM_RAM |
| 46 | AM_RANGE(0x5000, 0x5fff) AM_RAM AM_BASE( | |
| 55 | AM_RANGE(0x5000, 0x5fff) AM_RAM AM_BASE_MEMBER( | |
| 47 | 56 | // AM_RANGE(0x6000, 0x6000) MC6845 address |
| 48 | 57 | // AM_RANGE(0x6001, 0x6001) MC6845 data |
| 49 | 58 | AM_RANGE(0x7000, 0xafff) AM_ROM |
| r10886 | r10887 | |
| 69 | 78 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 ) |
| 70 | 79 | GFXDECODE_END |
| 71 | 80 | |
| 72 | static MACHINE_CONFIG_START( buster, | |
| 81 | static MACHINE_CONFIG_START( buster, buster_stat | |
| 73 | 82 | /* basic machine hardware */ |
| 74 | 83 | MCFG_CPU_ADD("maincpu", Z80,8000000) /* ? MHz */ |
| 75 | 84 | MCFG_CPU_PROGRAM_MAP(mainmap) |
| r10886 | r10887 | |
| 113 | 122 | |
| 114 | 123 | static DRIVER_INIT( buster ) |
| 115 | 124 | { |
| 125 | buster_state *state = machine->driver_data<buster_state>(); | |
| 116 | 126 | UINT8 *ROM = machine->region("maincpu")->base(); |
| 117 | 127 | // vram = auto_alloc_array(machine, UINT8, 0x2000); |
| 118 | memcpy( | |
| 128 | memcpy( | |
| 119 | 129 | } |
| 120 | 130 | |
| 121 | 131 | GAME( 1987, buster, 0, buster, buster, buster, ROT0, "Marian Electronics Ltd.", "Buster", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 56 | 56 | #include "machine/eeprom.h" |
| 57 | 57 | #include "machine/ticket.h" |
| 58 | 58 | |
| 59 | static UINT16 *midas_gfxram, *midas_gfxregs; | |
| 60 | 59 | |
| 60 | class midas_state : public driver_device | |
| 61 | { | |
| 62 | public: | |
| 63 | midas_state(running_machine &machine, const driver_device_config_base &config) | |
| 64 | : driver_device(machine, config) { } | |
| 65 | ||
| 66 | UINT16 *gfxram; | |
| 67 | UINT16 *gfxregs; | |
| 68 | tilemap_t *tmap; | |
| 69 | }; | |
| 70 | ||
| 71 | ||
| 61 | 72 | static VIDEO_START( midas ); |
| 62 | 73 | static SCREEN_UPDATE( midas ); |
| 63 | 74 | |
| 64 | static tilemap_t *tmap; | |
| 65 | 75 | |
| 66 | 76 | static TILE_GET_INFO( get_tile_info ) |
| 67 | 77 | { |
| 68 | UINT16 code = midas_gfxram[ tile_index + 0x7000 ]; | |
| 78 | midas_state *state = machine->driver_data<midas_state>(); | |
| 79 | UINT16 code = state->gfxram[ tile_index + 0x7000 ]; | |
| 69 | 80 | SET_TILE_INFO(1, code & 0xfff, (code >> 12) & 0xf, TILE_FLIPXY( 0 )); |
| 70 | 81 | } |
| 71 | 82 | |
| 72 | 83 | static VIDEO_START( midas ) |
| 73 | 84 | { |
| 74 | midas_gfxram = auto_alloc_array(machine, UINT16, 0x20000/2); | |
| 85 | midas_state *state = machine->driver_data<midas_state>(); | |
| 86 | state->gfxram = auto_alloc_array(machine, UINT16, 0x20000/2); | |
| 75 | 87 | |
| 76 | tmap = tilemap_create( machine, get_tile_info, tilemap_scan_cols, | |
| 88 | state->tmap = tilemap_create( machine, get_tile_info, tilemap_scan_cols, | |
| 77 | 89 | 8,8, 0x80,0x20 ); |
| 78 | 90 | |
| 79 | tilemap_set_transparent_pen(tmap, 0); | |
| 91 | tilemap_set_transparent_pen(state->tmap, 0); | |
| 80 | 92 | } |
| 81 | 93 | |
| 82 | 94 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 83 | 95 | { |
| 84 | UINT16 *s = midas_gfxram + 0x8000; | |
| 85 | UINT16 *codes = midas_gfxram; | |
| 96 | midas_state *state = machine->driver_data<midas_state>(); | |
| 97 | UINT16 *s = state->gfxram + 0x8000; | |
| 98 | UINT16 *codes = state->gfxram; | |
| 86 | 99 | |
| 87 | 100 | int sx_old = 0, sy_old = 0, ynum_old = 0, xzoom_old = 0; |
| 88 | 101 | int xdim, ydim, xscale, yscale; |
| r10886 | r10887 | |
| 164 | 177 | |
| 165 | 178 | static SCREEN_UPDATE( midas ) |
| 166 | 179 | { |
| 180 | midas_state *state = screen->machine->driver_data<midas_state>(); | |
| 167 | 181 | int layers_ctrl = -1; |
| 168 | 182 | |
| 169 | 183 | #ifdef MAME_DEBUG |
| 170 | 184 | if ( input_code_pressed(screen->machine, KEYCODE_Z) ) |
| 171 | 185 | { |
| 172 | 186 | int msk = 0; |
| 173 | if (input_code_pressed(screen->machine, KEYCODE_Q)) msk |= 1 << 0; // for tmap | |
| 187 | if (input_code_pressed(screen->machine, KEYCODE_Q)) msk |= 1 << 0; // for state->tmap | |
| 174 | 188 | if (input_code_pressed(screen->machine, KEYCODE_A)) msk |= 1 << 1; // for sprites |
| 175 | 189 | if (msk != 0) layers_ctrl &= msk; |
| 176 | 190 | } |
| r10886 | r10887 | |
| 179 | 193 | bitmap_fill(bitmap,cliprect,4095); |
| 180 | 194 | |
| 181 | 195 | if (layers_ctrl & 2) draw_sprites(screen->machine, bitmap,cliprect); |
| 182 | if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, tmap, 0, 0); | |
| 196 | if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->tmap, 0, 0); | |
| 183 | 197 | |
| 184 | 198 | return 0; |
| 185 | 199 | } |
| r10886 | r10887 | |
| 206 | 220 | |
| 207 | 221 | static WRITE16_HANDLER( midas_gfxregs_w ) |
| 208 | 222 | { |
| 209 | COMBINE_DATA( midas_gfxregs + offset ); | |
| 223 | midas_state *state = space->machine->driver_data<midas_state>(); | |
| 224 | COMBINE_DATA( state->gfxregs + offset ); | |
| 210 | 225 | |
| 211 | 226 | switch( offset ) |
| 212 | 227 | { |
| 213 | 228 | case 1: |
| 214 | 229 | { |
| 215 | UINT16 addr = midas_gfxregs[0]; | |
| 216 | midas_gfxram[addr] = data; | |
| 217 | midas_gfxregs[0] += midas_gfxregs[2]; | |
| 230 | UINT16 addr = state->gfxregs[0]; | |
| 231 | state->gfxram[addr] = data; | |
| 232 | state->gfxregs[0] += state->gfxregs[2]; | |
| 218 | 233 | |
| 219 | if ( addr >= 0x7000 && addr <= 0x7fff ) tilemap_mark_tile_dirty(tmap, addr - 0x7000); | |
| 234 | if ( addr >= 0x7000 && addr <= 0x7fff ) tilemap_mark_tile_dirty(state->tmap, addr - 0x7000); | |
| 220 | 235 | |
| 221 | 236 | break; |
| 222 | 237 | } |
| r10886 | r10887 | |
| 250 | 265 | |
| 251 | 266 | AM_RANGE(0x9a0000, 0x9a0001) AM_DEVWRITE( "eeprom", midas_eeprom_w ) |
| 252 | 267 | |
| 253 | AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE( midas_gfxregs_w ) AM_BASE( | |
| 268 | AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE( midas_gfxregs_w ) AM_BASE_MEMBER( | |
| 254 | 269 | |
| 255 | 270 | AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE( paletteram16_xrgb_word_be_w ) AM_BASE_GENERIC( paletteram ) |
| 256 | 271 | AM_RANGE(0xa40000, 0xa7ffff) AM_RAM |
| r10886 | r10887 | |
| 329 | 344 | |
| 330 | 345 | AM_RANGE(0x9a0000, 0x9a0001) AM_DEVWRITE( "eeprom", midas_eeprom_w ) |
| 331 | 346 | |
| 332 | AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE( midas_gfxregs_w ) AM_BASE( | |
| 347 | AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE( midas_gfxregs_w ) AM_BASE_MEMBER( | |
| 333 | 348 | |
| 334 | 349 | AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE( paletteram16_xrgb_word_be_w ) AM_BASE_GENERIC( paletteram ) |
| 335 | 350 | AM_RANGE(0xa40000, 0xa7ffff) AM_RAM |
| r10886 | r10887 | |
| 671 | 686 | livequiz_irqhandler |
| 672 | 687 | }; |
| 673 | 688 | |
| 674 | static MACHINE_CONFIG_START( livequiz, | |
| 689 | static MACHINE_CONFIG_START( livequiz, m | |
| 675 | 690 | |
| 676 | 691 | /* basic machine hardware */ |
| 677 | 692 | MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2) |
| r10886 | r10887 | |
| 702 | 717 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.80) |
| 703 | 718 | MACHINE_CONFIG_END |
| 704 | 719 | |
| 705 | static MACHINE_CONFIG_START( hammer, | |
| 720 | static MACHINE_CONFIG_START( hammer, m | |
| 706 | 721 | |
| 707 | 722 | /* basic machine hardware */ |
| 708 | 723 | MCFG_CPU_ADD("maincpu", M68000, XTAL_28MHz / 2) |
| r10886 | r10887 | |
|---|---|---|
| 37 | 37 | #include "cpu/z80/z80.h" |
| 38 | 38 | #include "sound/dac.h" |
| 39 | 39 | |
| 40 | static UINT8* murogmbl_video; | |
| 41 | 40 | |
| 41 | class murogmbl_state : public driver_device | |
| 42 | { | |
| 43 | public: | |
| 44 | murogmbl_state(running_machine &machine, const driver_device_config_base &config) | |
| 45 | : driver_device(machine, config) { } | |
| 46 | ||
| 47 | UINT8* video; | |
| 48 | }; | |
| 49 | ||
| 50 | ||
| 42 | 51 | static PALETTE_INIT( murogmbl ) |
| 43 | 52 | { |
| 44 | 53 | int bit0, bit1, bit2 , r, g, b; |
| r10886 | r10887 | |
| 68 | 77 | AM_RANGE(0x0000, 0x1fFf) AM_ROM |
| 69 | 78 | AM_RANGE(0x4000, 0x43ff) AM_RAM |
| 70 | 79 | AM_RANGE(0x4800, 0x4bff) AM_RAM |
| 71 | AM_RANGE(0x5800, 0x5bff) AM_RAM AM_BASE( | |
| 80 | AM_RANGE(0x5800, 0x5bff) AM_RAM AM_BASE_MEMBER( | |
| 72 | 81 | AM_RANGE(0x5c00, 0x5fff) AM_RAM |
| 73 | 82 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") |
| 74 | 83 | AM_RANGE(0x6800, 0x6800) AM_READ_PORT("DSW") |
| r10886 | r10887 | |
| 83 | 92 | |
| 84 | 93 | static SCREEN_UPDATE(murogmbl) |
| 85 | 94 | { |
| 95 | murogmbl_state *state = screen->machine->driver_data<murogmbl_state>(); | |
| 86 | 96 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 87 | 97 | int count = 0; |
| 88 | 98 | |
| r10886 | r10887 | |
| 92 | 102 | { |
| 93 | 103 | for (x = 0; x < 32; x++) |
| 94 | 104 | { |
| 95 | int tile = | |
| 105 | int tile = state-> | |
| 96 | 106 | drawgfx_opaque(bitmap, cliprect, gfx, tile, 0, 0, 0, x * 8, y * 8); |
| 97 | 107 | |
| 98 | 108 | count++; |
| r10886 | r10887 | |
| 166 | 176 | GFXDECODE_ENTRY( "gfx1", 0, layout8x8x2, 0x0, 1 ) |
| 167 | 177 | GFXDECODE_END |
| 168 | 178 | |
| 169 | static MACHINE_CONFIG_START( murogmbl, | |
| 179 | static MACHINE_CONFIG_START( murogmbl, murogmbl_stat | |
| 170 | 180 | /* basic machine hardware */ |
| 171 | 181 | MCFG_CPU_ADD("maincpu", Z80, 1000000) /* Z80? */ |
| 172 | 182 | MCFG_CPU_PROGRAM_MAP(murogmbl_map) |
| r10886 | r10887 | |
|---|---|---|
| 42 | 42 | #include "video/v9938.h" |
| 43 | 43 | #include "deprecat.h" |
| 44 | 44 | |
| 45 | ||
| 46 | class sothello_state : public driver_device | |
| 47 | { | |
| 48 | public: | |
| 49 | sothello_state(running_machine &machine, const driver_device_config_base &config) | |
| 50 | : driver_device(machine, config) { } | |
| 51 | ||
| 52 | int subcpu_status; | |
| 53 | int soundcpu_busy; | |
| 54 | int msm_data; | |
| 55 | }; | |
| 56 | ||
| 57 | ||
| 45 | 58 | #define VDP_MEM 0x40000 |
| 46 | 59 | |
| 47 | 60 | #define MAINCPU_CLOCK (XTAL_21_477MHz/6) |
| r10886 | r10887 | |
| 51 | 64 | #define SUBCPU_CLOCK (XTAL_8MHz/4) |
| 52 | 65 | |
| 53 | 66 | |
| 54 | static int subcpu_status=0; | |
| 55 | static int soundcpu_busy=0; | |
| 56 | static int msm_data = 0; | |
| 57 | ||
| 58 | 67 | /* main Z80 */ |
| 59 | 68 | |
| 60 | 69 | static WRITE8_HANDLER(bank_w) |
| r10886 | r10887 | |
| 84 | 93 | |
| 85 | 94 | static READ8_HANDLER( subcpu_halt_set ) |
| 86 | 95 | { |
| 96 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 87 | 97 | space->machine->scheduler().synchronize(FUNC(subcpu_suspend)); |
| 88 | subcpu_status|=2; | |
| 98 | state->subcpu_status|=2; | |
| 89 | 99 | return 0; |
| 90 | 100 | } |
| 91 | 101 | |
| 92 | 102 | static READ8_HANDLER( subcpu_halt_clear ) |
| 93 | 103 | { |
| 104 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 94 | 105 | space->machine->scheduler().synchronize(FUNC(subcpu_resume)); |
| 95 | subcpu_status&=~1; | |
| 96 | subcpu_status&=~2; | |
| 106 | state->subcpu_status&=~1; | |
| 107 | state->subcpu_status&=~2; | |
| 97 | 108 | return 0; |
| 98 | 109 | } |
| 99 | 110 | |
| 100 | 111 | static READ8_HANDLER(subcpu_comm_status ) |
| 101 | 112 | { |
| 102 | return subcpu_status; | |
| 113 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 114 | return state->subcpu_status; | |
| 103 | 115 | } |
| 104 | 116 | |
| 105 | 117 | static READ8_HANDLER( soundcpu_status_r ) |
| 106 | 118 | { |
| 107 | return soundcpu_busy; | |
| 119 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 120 | return state->soundcpu_busy; | |
| 108 | 121 | } |
| 109 | 122 | |
| 110 | 123 | static ADDRESS_MAP_START( maincpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 149 | 162 | |
| 150 | 163 | static WRITE8_HANDLER( msm_data_w ) |
| 151 | 164 | { |
| 152 | msm_data = data; | |
| 165 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 166 | state->msm_data = data; | |
| 153 | 167 | |
| 154 | 168 | } |
| 155 | 169 | |
| 156 | 170 | static WRITE8_HANDLER(soundcpu_busyflag_set_w) |
| 157 | 171 | { |
| 158 | soundcpu_busy=1; | |
| 172 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 173 | state->soundcpu_busy=1; | |
| 159 | 174 | } |
| 160 | 175 | |
| 161 | 176 | static WRITE8_HANDLER(soundcpu_busyflag_reset_w) |
| 162 | 177 | { |
| 163 | soundcpu_busy=0; | |
| 178 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 179 | state->soundcpu_busy=0; | |
| 164 | 180 | } |
| 165 | 181 | |
| 166 | 182 | static WRITE8_HANDLER(soundcpu_int_clear_w) |
| r10886 | r10887 | |
| 187 | 203 | |
| 188 | 204 | static void unlock_shared_ram(address_space *space) |
| 189 | 205 | { |
| 206 | sothello_state *state = space->machine->driver_data<sothello_state>(); | |
| 190 | 207 | if(!space->machine->device<cpu_device>("sub")->suspended(SUSPEND_REASON_HALT)) |
| 191 | 208 | { |
| 192 | subcpu_status|=1; | |
| 209 | state->subcpu_status|=1; | |
| 193 | 210 | } |
| 194 | 211 | else |
| 195 | 212 | { |
| r10886 | r10887 | |
| 307 | 324 | |
| 308 | 325 | static void adpcm_int(device_t *device) |
| 309 | 326 | { |
| 327 | sothello_state *state = device->machine->driver_data<sothello_state>(); | |
| 310 | 328 | /* only 4 bits are used */ |
| 311 | msm5205_data_w( device, msm_data & 0x0f ); | |
| 329 | msm5205_data_w( device, state->msm_data & 0x0f ); | |
| 312 | 330 | cputag_set_input_line(device->machine, "soundcpu", 0, ASSERT_LINE ); |
| 313 | 331 | } |
| 314 | 332 | |
| r10886 | r10887 | |
| 344 | 362 | irqhandler |
| 345 | 363 | }; |
| 346 | 364 | |
| 347 | static MACHINE_CONFIG_START( sothello, | |
| 365 | static MACHINE_CONFIG_START( sothello, sothello_stat | |
| 348 | 366 | |
| 349 | 367 | /* basic machine hardware */ |
| 350 | 368 |
| r10886 | r10887 | |
|---|---|---|
| 28 | 28 | #include "sound/ay8910.h" |
| 29 | 29 | |
| 30 | 30 | |
| 31 | static UINT8 *tugboat_ram; | |
| 32 | //UINT8 *tugboat_score; | |
| 31 | class tugboat_state : public driver_device | |
| 32 | { | |
| 33 | public: | |
| 34 | tugboat_state(running_machine &machine, const driver_device_config_base &config) | |
| 35 | : driver_device(machine, config) { } | |
| 33 | 36 | |
| 37 | UINT8 *ram; | |
| 38 | UINT8 hd46505_0_reg[18]; | |
| 39 | UINT8 hd46505_1_reg[18]; | |
| 40 | int reg0; | |
| 41 | int reg1; | |
| 42 | int ctrl; | |
| 43 | }; | |
| 34 | 44 | |
| 35 | static UINT8 hd46505_0_reg[18],hd46505_1_reg[18]; | |
| 36 | 45 | |
| 37 | ||
| 38 | 46 | /* there isn't the usual resistor array anywhere near the color prom, |
| 39 | 47 | just four 1k resistors. */ |
| 40 | 48 | static PALETTE_INIT( tugboat ) |
| r10886 | r10887 | |
| 63 | 71 | because I need the start_addr register to handle scrolling */ |
| 64 | 72 | static WRITE8_HANDLER( tugboat_hd46505_0_w ) |
| 65 | 73 | { |
| 66 | static int reg; | |
| 67 | if (offset == 0) reg = data & 0x0f; | |
| 68 | else if (reg < 18) hd46505_0_reg[reg] = data; | |
| 74 | tugboat_state *state = space->machine->driver_data<tugboat_state>(); | |
| 75 | if (offset == 0) state->reg0 = data & 0x0f; | |
| 76 | else if (state->reg0 < 18) state->hd46505_0_reg[state->reg0] = data; | |
| 69 | 77 | } |
| 70 | 78 | static WRITE8_HANDLER( tugboat_hd46505_1_w ) |
| 71 | 79 | { |
| 72 | static int reg; | |
| 73 | if (offset == 0) reg = data & 0x0f; | |
| 74 | else if (reg < 18) hd46505_1_reg[reg] = data; | |
| 80 | tugboat_state *state = space->machine->driver_data<tugboat_state>(); | |
| 81 | if (offset == 0) state->reg1 = data & 0x0f; | |
| 82 | else if (state->reg1 < 18) state->hd46505_1_reg[state->reg1] = data; | |
| 75 | 83 | } |
| 76 | 84 | |
| 77 | 85 | |
| 78 | 86 | static WRITE8_HANDLER( tugboat_score_w ) |
| 79 | 87 | { |
| 80 | if (offset>=0x8) tugboat_ram[0x291d + 32*offset + 32*(1-8)] = data ^ 0x0f; | |
| 81 | if (offset<0x8 ) tugboat_ram[0x291d + 32*offset + 32*9] = data ^ 0x0f; | |
| 88 | tugboat_state *state = space->machine->driver_data<tugboat_state>(); | |
| 89 | if (offset>=0x8) state->ram[0x291d + 32*offset + 32*(1-8)] = data ^ 0x0f; | |
| 90 | if (offset<0x8 ) state->ram[0x291d + 32*offset + 32*9] = data ^ 0x0f; | |
| 82 | 91 | } |
| 83 | 92 | |
| 84 | 93 | static void draw_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, |
| 85 | 94 | int addr,int gfx0,int gfx1,int transparency) |
| 86 | 95 | { |
| 96 | tugboat_state *state = machine->driver_data<tugboat_state>(); | |
| 87 | 97 | int x,y; |
| 88 | 98 | |
| 89 | 99 | for (y = 0;y < 32;y++) |
| 90 | 100 | { |
| 91 | 101 | for (x = 0;x < 32;x++) |
| 92 | 102 | { |
| 93 | int code = (t | |
| 103 | int code = (st | |
| 94 | 104 | int color = (code & 0x3c00) >> 10; |
| 95 | 105 | int rgn; |
| 96 | 106 | |
| r10886 | r10887 | |
| 117 | 127 | |
| 118 | 128 | static SCREEN_UPDATE( tugboat ) |
| 119 | 129 | { |
| 120 | int startaddr0 = hd46505_0_reg[0x0c]*256 + hd46505_0_reg[0x0d]; | |
| 121 | int startaddr1 = hd46505_1_reg[0x0c]*256 + hd46505_1_reg[0x0d]; | |
| 130 | tugboat_state *state = screen->machine->driver_data<tugboat_state>(); | |
| 131 | int startaddr0 = state->hd46505_0_reg[0x0c]*256 + state->hd46505_0_reg[0x0d]; | |
| 132 | int startaddr1 = state->hd46505_1_reg[0x0c]*256 + state->hd46505_1_reg[0x0d]; | |
| 122 | 133 | |
| 123 | 134 | |
| 124 | 135 | draw_tilemap(screen->machine, bitmap,cliprect,startaddr0,0,1,FALSE); |
| r10886 | r10887 | |
| 127 | 138 | } |
| 128 | 139 | |
| 129 | 140 | |
| 130 | static int ctrl; | |
| 131 | 141 | |
| 132 | 142 | static READ8_DEVICE_HANDLER( tugboat_input_r ) |
| 133 | 143 | { |
| 134 | if (~ctrl & 0x80) | |
| 144 | tugboat_state *state = device->machine->driver_data<tugboat_state>(); | |
| 145 | if (~state->ctrl & 0x80) | |
| 135 | 146 | return input_port_read(device->machine, "IN0"); |
| 136 | else if (~ctrl & 0x40) | |
| 147 | else if (~state->ctrl & 0x40) | |
| 137 | 148 | return input_port_read(device->machine, "IN1"); |
| 138 | else if (~ctrl & 0x20) | |
| 149 | else if (~state->ctrl & 0x20) | |
| 139 | 150 | return input_port_read(device->machine, "IN2"); |
| 140 | else if (~ctrl & 0x10) | |
| 151 | else if (~state->ctrl & 0x10) | |
| 141 | 152 | return input_port_read(device->machine, "IN3"); |
| 142 | 153 | else |
| 143 | 154 | return input_port_read(device->machine, "IN4"); |
| r10886 | r10887 | |
| 145 | 156 | |
| 146 | 157 | static READ8_DEVICE_HANDLER( tugboat_ctrl_r ) |
| 147 | 158 | { |
| 148 | return ctrl; | |
| 159 | tugboat_state *state = device->machine->driver_data<tugboat_state>(); | |
| 160 | return state->ctrl; | |
| 149 | 161 | } |
| 150 | 162 | |
| 151 | 163 | static WRITE8_DEVICE_HANDLER( tugboat_ctrl_w ) |
| 152 | 164 | { |
| 153 | ctrl = data; | |
| 165 | tugboat_state *state = device->machine->driver_data<tugboat_state>(); | |
| 166 | state->ctrl = data; | |
| 154 | 167 | } |
| 155 | 168 | |
| 156 | 169 | static const pia6821_interface pia0_intf = |
| r10886 | r10887 | |
| 198 | 211 | |
| 199 | 212 | |
| 200 | 213 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 201 | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_BASE( | |
| 214 | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_BASE_MEMBER( | |
| 202 | 215 | AM_RANGE(0x1060, 0x1061) AM_DEVWRITE("aysnd", ay8910_address_data_w) |
| 203 | 216 | AM_RANGE(0x10a0, 0x10a1) AM_WRITE(tugboat_hd46505_0_w) /* scrolling is performed changing the start_addr register (0C/0D) */ |
| 204 | 217 | AM_RANGE(0x10c0, 0x10c1) AM_WRITE(tugboat_hd46505_1_w) |
| r10886 | r10887 | |
| 313 | 326 | GFXDECODE_END |
| 314 | 327 | |
| 315 | 328 | |
| 316 | static MACHINE_CONFIG_START( tugboat, | |
| 329 | static MACHINE_CONFIG_START( tugboat, tugboat_stat | |
| 317 | 330 | MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2 MHz ???? */ |
| 318 | 331 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 319 | 332 | MCFG_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| r10886 | r10887 | |
|---|---|---|
| 72 | 72 | #include "machine/nvram.h" |
| 73 | 73 | #include "sound/dac.h" |
| 74 | 74 | |
| 75 | static UINT8 drawctrl[3]; | |
| 76 | static UINT8 color[8]; | |
| 77 | 75 | |
| 76 | class gei_state : public driver_device | |
| 77 | { | |
| 78 | public: | |
| 79 | gei_state(running_machine &machine, const driver_device_config_base &config) | |
| 80 | : driver_device(machine, config) { } | |
| 81 | ||
| 82 | UINT8 drawctrl[3]; | |
| 83 | UINT8 color[8]; | |
| 84 | int prevoffset; | |
| 85 | int yadd; | |
| 86 | int signature_answer; | |
| 87 | int signature_pos; | |
| 88 | }; | |
| 89 | ||
| 90 | ||
| 78 | 91 | static WRITE8_HANDLER( gei_drawctrl_w ) |
| 79 | 92 | { |
| 80 | drawctrl[offset] = data; | |
| 93 | gei_state *state = space->machine->driver_data<gei_state>(); | |
| 94 | state->drawctrl[offset] = data; | |
| 81 | 95 | if (offset == 2) |
| 82 | 96 | { |
| 83 | 97 | int i; |
| 84 | 98 | for (i = 0; i < 8; i++) |
| 85 | if (BIT(drawctrl[1],i)) color[i] = drawctrl[0] & 7; | |
| 99 | if (BIT(state->drawctrl[1],i)) state->color[i] = state->drawctrl[0] & 7; | |
| 86 | 100 | } |
| 87 | 101 | } |
| 88 | 102 | |
| 89 | 103 | static WRITE8_HANDLER( gei_bitmap_w ) |
| 90 | 104 | { |
| 105 | gei_state *state = space->machine->driver_data<gei_state>(); | |
| 91 | 106 | int sx,sy; |
| 92 | static int prevoffset, yadd; | |
| 93 | 107 | int i; |
| 94 | 108 | |
| 95 | yadd = (offset==prevoffset) ? (yadd+1):0; | |
| 96 | prevoffset = offset; | |
| 109 | state->yadd = (offset==state->prevoffset) ? (state->yadd+1):0; | |
| 110 | state->prevoffset = offset; | |
| 97 | 111 | |
| 98 | 112 | sx = 8 * (offset % 64); |
| 99 | 113 | sy = offset / 64; |
| 100 | sy = (sy + yadd) & 0xff; | |
| 114 | sy = (sy + state->yadd) & 0xff; | |
| 101 | 115 | |
| 102 | 116 | |
| 103 | 117 | for (i = 0; i < 8; i++) |
| 104 | *BITMAP_ADDR16(space->machine->generic.tmpbitmap, sy, sx+i) = color[8-i-1]; | |
| 118 | *BITMAP_ADDR16(space->machine->generic.tmpbitmap, sy, sx+i) = state->color[8-i-1]; | |
| 105 | 119 | } |
| 106 | 120 | |
| 107 | 121 | static PALETTE_INIT(gei) |
| r10886 | r10887 | |
| 332 | 346 | } |
| 333 | 347 | |
| 334 | 348 | /* This signature is used to validate the ROMs in sportauth. Simple protection check? */ |
| 335 | static int signature_answer,signature_pos; | |
| 336 | 349 | |
| 337 | 350 | static READ8_HANDLER( signature_r ) |
| 338 | 351 | { |
| 339 | return signature_answer; | |
| 352 | gei_state *state = space->machine->driver_data<gei_state>(); | |
| 353 | return state->signature_answer; | |
| 340 | 354 | } |
| 341 | 355 | |
| 342 | 356 | static WRITE8_HANDLER( signature_w ) |
| 343 | 357 | { |
| 344 | if (data == 0) signature_pos = 0; | |
| 358 | gei_state *state = space->machine->driver_data<gei_state>(); | |
| 359 | if (data == 0) state->signature_pos = 0; | |
| 345 | 360 | else |
| 346 | 361 | { |
| 347 | 362 | static const UINT8 signature[8] = { 0xff, 0x01, 0xfd, 0x05, 0xf5, 0x15, 0xd5, 0x55 }; |
| 348 | 363 | |
| 349 | signature_answer = signature[signature_pos++]; | |
| 364 | state->signature_answer = signature[state->signature_pos++]; | |
| 350 | 365 | |
| 351 | signature_pos &= 7; /* safety; shouldn't happen */ | |
| 366 | state->signature_pos &= 7; /* safety; shouldn't happen */ | |
| 352 | 367 | } |
| 353 | 368 | } |
| 354 | 369 | |
| 355 | 370 | static WRITE8_HANDLER( signature2_w ) |
| 356 | 371 | { |
| 357 | if (data == 0) signature_pos = 0; | |
| 372 | gei_state *state = space->machine->driver_data<gei_state>(); | |
| 373 | if (data == 0) state->signature_pos = 0; | |
| 358 | 374 | else |
| 359 | 375 | { |
| 360 | 376 | static const UINT8 signature[8] = { 0xff, 0x01, 0xf7, 0x11, 0xd7, 0x51, 0x57, 0x51 }; |
| 361 | 377 | |
| 362 | signature_answer = signature[signature_pos++]; | |
| 378 | state->signature_answer = signature[state->signature_pos++]; | |
| 363 | 379 | |
| 364 | signature_pos &= 7; /* safety; shouldn't happen */ | |
| 380 | state->signature_pos &= 7; /* safety; shouldn't happen */ | |
| 365 | 381 | } |
| 366 | 382 | } |
| 367 | 383 | |
| r10886 | r10887 | |
| 1047 | 1063 | } |
| 1048 | 1064 | }; |
| 1049 | 1065 | |
| 1050 | static MACHINE_CONFIG_START( getrivia, | |
| 1066 | static MACHINE_CONFIG_START( getrivia, g | |
| 1051 | 1067 | MCFG_CPU_ADD("maincpu",Z80,4000000) /* 4 MHz */ |
| 1052 | 1068 | MCFG_CPU_PROGRAM_MAP(getrivia_map) |
| 1053 | 1069 | MCFG_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| r10886 | r10887 | |
|---|---|---|
| 27 | 27 | #include "machine/laserdsc.h" |
| 28 | 28 | #include "machine/nvram.h" |
| 29 | 29 | |
| 30 | /* From daphne */ | |
| 31 | #define PCB_CLOCK (18432000) | |
| 32 | 30 | |
| 31 | class esh_state : public driver_device | |
| 32 | { | |
| 33 | public: | |
| 34 | esh_state(running_machine &machine, const driver_device_config_base &config) | |
| 35 | : driver_device(machine, config) { } | |
| 33 | 36 | |
| 34 | /* Misc variables */ | |
| 35 | static device_t *laserdisc; | |
| 37 | device_t *laserdisc; | |
| 38 | UINT8 *tile_ram; | |
| 39 | UINT8 *tile_control_ram; | |
| 40 | UINT8 ld_video_visible; | |
| 41 | }; | |
| 36 | 42 | |
| 37 | static UINT8 *tile_ram; | |
| 38 | static UINT8 *tile_control_ram; | |
| 39 | 43 | |
| 40 | static UINT8 ld_video_visible; | |
| 44 | /* From daphne */ | |
| 45 | #define PCB_CLOCK (18432000) | |
| 41 | 46 | |
| 47 | ||
| 42 | 48 | /* VIDEO GOODS */ |
| 43 | 49 | static SCREEN_UPDATE( esh ) |
| 44 | 50 | { |
| 51 | esh_state *state = screen->machine->driver_data<esh_state>(); | |
| 45 | 52 | int charx, chary; |
| 46 | 53 | |
| 47 | 54 | /* clear */ |
| r10886 | r10887 | |
| 54 | 61 | { |
| 55 | 62 | int current_screen_character = (chary*32) + charx; |
| 56 | 63 | |
| 57 | int palIndex = (tile_control_ram[current_screen_character] & 0x0f); | |
| 58 | int tileOffs = (tile_control_ram[current_screen_character] & 0x10) >> 4; | |
| 59 | //int blinkLine = (tile_control_ram[current_screen_character] & 0x40) >> 6; | |
| 60 | //int blinkChar = (tile_control_ram[current_screen_character] & 0x80) >> 7; | |
| 64 | int palIndex = (state->tile_control_ram[current_screen_character] & 0x0f); | |
| 65 | int tileOffs = (state->tile_control_ram[current_screen_character] & 0x10) >> 4; | |
| 66 | //int blinkLine = (state->tile_control_ram[current_screen_character] & 0x40) >> 6; | |
| 67 | //int blinkChar = (state->tile_control_ram[current_screen_character] & 0x80) >> 7; | |
| 61 | 68 | |
| 62 | 69 | drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], |
| 63 | tile_ram[current_screen_character] + (0x100 * tileOffs), | |
| 70 | state->tile_ram[current_screen_character] + (0x100 * tileOffs), | |
| 64 | 71 | palIndex, |
| 65 | 72 | 0, 0, charx*8, chary*8, 0); |
| 66 | 73 | } |
| r10886 | r10887 | |
| 75 | 82 | /* MEMORY HANDLERS */ |
| 76 | 83 | static READ8_HANDLER(ldp_read) |
| 77 | 84 | { |
| 78 | return laserdisc_data_r(laserdisc); | |
| 85 | esh_state *state = space->machine->driver_data<esh_state>(); | |
| 86 | return laserdisc_data_r(state->laserdisc); | |
| 79 | 87 | } |
| 80 | 88 | |
| 81 | 89 | static WRITE8_HANDLER(ldp_write) |
| 82 | 90 | { |
| 83 | laserdisc_data_w(laserdisc,data); | |
| 91 | esh_state *state = space->machine->driver_data<esh_state>(); | |
| 92 | laserdisc_data_w(state->laserdisc,data); | |
| 84 | 93 | } |
| 85 | 94 | |
| 86 | 95 | static WRITE8_HANDLER(misc_write) |
| 87 | 96 | { |
| 97 | esh_state *state = space->machine->driver_data<esh_state>(); | |
| 88 | 98 | /* Bit 0 unknown */ |
| 89 | 99 | |
| 90 | 100 | if (data & 0x02) |
| 91 | 101 | logerror("BEEP!\n"); |
| 92 | 102 | |
| 93 | 103 | /* Bit 2 unknown */ |
| 94 | ld_video_visible = !((data & 0x08) >> 3); | |
| 104 | state->ld_video_visible = !((data & 0x08) >> 3); | |
| 95 | 105 | |
| 96 | 106 | /* Bits 4-7 unknown */ |
| 97 | 107 | /* They cycle through a repeating pattern though */ |
| r10886 | r10887 | |
| 144 | 154 | static ADDRESS_MAP_START( z80_0_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 145 | 155 | AM_RANGE(0x0000,0x3fff) AM_ROM |
| 146 | 156 | AM_RANGE(0xe000,0xe7ff) AM_RAM AM_SHARE("nvram") |
| 147 | AM_RANGE(0xf000,0xf3ff) AM_RAM AM_BASE(&tile_ram) | |
| 148 | AM_RANGE(0xf400,0xf7ff) AM_RAM AM_BASE(&tile_control_ram) | |
| 157 | AM_RANGE(0xf000,0xf3ff) AM_RAM AM_BASE_MEMBER(esh_state, tile_ram) | |
| 158 | AM_RANGE(0xf400,0xf7ff) AM_RAM AM_BASE_MEMBER(esh_state, tile_control_ram) | |
| 149 | 159 | ADDRESS_MAP_END |
| 150 | 160 | |
| 151 | 161 | |
| r10886 | r10887 | |
| 273 | 283 | |
| 274 | 284 | static MACHINE_START( esh ) |
| 275 | 285 | { |
| 276 | laserdisc = machine->device("laserdisc"); | |
| 286 | esh_state *state = machine->driver_data<esh_state>(); | |
| 287 | state->laserdisc = machine->device("laserdisc"); | |
| 277 | 288 | } |
| 278 | 289 | |
| 279 | 290 | |
| 280 | 291 | /* DRIVER */ |
| 281 | static MACHINE_CONFIG_START( esh, | |
| 292 | static MACHINE_CONFIG_START( esh, | |
| 282 | 293 | |
| 283 | 294 | /* main cpu */ |
| 284 | 295 | MCFG_CPU_ADD("maincpu", Z80, PCB_CLOCK/6) /* The denominator is a Daphne guess based on PacMan's hardware */ |
| r10886 | r10887 | |
|---|---|---|
| 83 | 83 | : driver_device(machine, config) { } |
| 84 | 84 | |
| 85 | 85 | UINT8 *videoram; |
| 86 | tilemap_t *tilemap; | |
| 87 | UINT8 *question_offset; | |
| 88 | UINT8 question_offset_low; | |
| 89 | UINT8 question_offset_mid; | |
| 90 | UINT8 question_offset_high; | |
| 91 | UINT8 latched_coin; | |
| 92 | UINT8 last_coin; | |
| 86 | 93 | }; |
| 87 | 94 | |
| 88 | 95 | |
| 89 | 96 | #define MASTER_CLOCK 12440000 |
| 90 | 97 | |
| 91 | 98 | |
| 92 | static tilemap_t *statriv2_tilemap; | |
| 93 | static UINT8 *question_offset; | |
| 94 | ||
| 95 | static UINT8 question_offset_low; | |
| 96 | static UINT8 question_offset_mid; | |
| 97 | static UINT8 question_offset_high; | |
| 98 | ||
| 99 | static UINT8 latched_coin; | |
| 100 | static UINT8 last_coin; | |
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | 99 | /************************************* |
| 105 | 100 | * |
| 106 | 101 | * Tilemap callbacks |
| r10886 | r10887 | |
| 148 | 143 | |
| 149 | 144 | static VIDEO_START( horizontal ) |
| 150 | 145 | { |
| 151 | statriv2_tilemap = tilemap_create(machine, horizontal_tile_info ,tilemap_scan_rows, 8,15, 64,16); | |
| 146 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 147 | state->tilemap = tilemap_create(machine, horizontal_tile_info ,tilemap_scan_rows, 8,15, 64,16); | |
| 152 | 148 | } |
| 153 | 149 | |
| 154 | 150 | static VIDEO_START( vertical ) |
| 155 | 151 | { |
| 156 | statriv2_tilemap = tilemap_create(machine, vertical_tile_info, tilemap_scan_rows, 8,8, 32,32); | |
| 152 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 153 | state->tilemap = tilemap_create(machine, vertical_tile_info, tilemap_scan_rows, 8,8, 32,32); | |
| 157 | 154 | } |
| 158 | 155 | |
| 159 | 156 | |
| r10886 | r10887 | |
| 169 | 166 | statriv2_state *state = space->machine->driver_data<statriv2_state>(); |
| 170 | 167 | UINT8 *videoram = state->videoram; |
| 171 | 168 | videoram[offset] = data; |
| 172 | tilemap_mark_tile_dirty(stat | |
| 169 | tilemap_mark_tile_dirty(state-> | |
| 173 | 170 | } |
| 174 | 171 | |
| 175 | 172 | |
| r10886 | r10887 | |
| 182 | 179 | |
| 183 | 180 | static SCREEN_UPDATE( statriv2 ) |
| 184 | 181 | { |
| 182 | statriv2_state *state = screen->machine->driver_data<statriv2_state>(); | |
| 185 | 183 | if (tms9927_screen_reset(screen->machine->device("tms"))) |
| 186 | 184 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 187 | 185 | else |
| 188 | tilemap_draw(bitmap, cliprect, stat | |
| 186 | tilemap_draw(bitmap, cliprect, state-> | |
| 189 | 187 | return 0; |
| 190 | 188 | } |
| 191 | 189 | |
| r10886 | r10887 | |
| 199 | 197 | |
| 200 | 198 | static INTERRUPT_GEN( statriv2_interrupt ) |
| 201 | 199 | { |
| 200 | statriv2_state *state = device->machine->driver_data<statriv2_state>(); | |
| 202 | 201 | UINT8 new_coin = input_port_read(device->machine, "COIN"); |
| 203 | 202 | |
| 204 | 203 | /* check the coin inputs once per frame */ |
| 205 | latched_coin |= new_coin & (new_coin ^ last_coin); | |
| 206 | last_coin = new_coin; | |
| 204 | state->latched_coin |= new_coin & (new_coin ^ state->last_coin); | |
| 205 | state->last_coin = new_coin; | |
| 207 | 206 | |
| 208 | 207 | cpu_set_input_line(device, I8085_RST75_LINE, ASSERT_LINE); |
| 209 | 208 | cpu_set_input_line(device, I8085_RST75_LINE, CLEAR_LINE); |
| r10886 | r10887 | |
| 219 | 218 | |
| 220 | 219 | static READ8_HANDLER( question_data_r ) |
| 221 | 220 | { |
| 221 | statriv2_state *state = space->machine->driver_data<statriv2_state>(); | |
| 222 | 222 | const UINT8 *qrom = space->machine->region("questions")->base(); |
| 223 | 223 | UINT32 qromsize = space->machine->region("questions")->bytes(); |
| 224 | 224 | UINT32 address; |
| 225 | 225 | |
| 226 | if (question_offset_high == 0xff) | |
| 227 | question_offset[question_offset_low]++; | |
| 226 | if (state->question_offset_high == 0xff) | |
| 227 | state->question_offset[state->question_offset_low]++; | |
| 228 | 228 | |
| 229 | address = question_offset[question_offset_low]; | |
| 230 | address |= question_offset[question_offset_mid] << 8; | |
| 231 | if (question_offset_high != 0xff) | |
| 232 | address |= question_offset[question_offset_high] << 16; | |
| 229 | address = state->question_offset[state->question_offset_low]; | |
| 230 | address |= state->question_offset[state->question_offset_mid] << 8; | |
| 231 | if (state->question_offset_high != 0xff) | |
| 232 | address |= state->question_offset[state->question_offset_high] << 16; | |
| 233 | 233 | |
| 234 | 234 | return (address < qromsize) ? qrom[address] : 0xff; |
| 235 | 235 | } |
| r10886 | r10887 | |
| 244 | 244 | |
| 245 | 245 | static CUSTOM_INPUT( latched_coin_r ) |
| 246 | 246 | { |
| 247 | return latched_coin; | |
| 247 | statriv2_state *state = field->port->machine->driver_data<statriv2_state>(); | |
| 248 | return state->latched_coin; | |
| 248 | 249 | } |
| 249 | 250 | |
| 250 | 251 | |
| 251 | 252 | static WRITE8_DEVICE_HANDLER( ppi_portc_hi_w ) |
| 252 | 253 | { |
| 254 | statriv2_state *state = device->machine->driver_data<statriv2_state>(); | |
| 253 | 255 | data >>= 4; |
| 254 | 256 | if (data != 0x0f) |
| 255 | latched_coin = 0; | |
| 257 | state->latched_coin = 0; | |
| 256 | 258 | } |
| 257 | 259 | |
| 258 | 260 | |
| r10886 | r10887 | |
| 295 | 297 | |
| 296 | 298 | static ADDRESS_MAP_START( statriv2_io_map, ADDRESS_SPACE_IO, 8 ) |
| 297 | 299 | AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("ppi", ppi8255_r, ppi8255_w) |
| 298 | AM_RANGE(0x28, 0x2b) AM_READ(question_data_r) AM_WRITEONLY AM_BASE( | |
| 300 | AM_RANGE(0x28, 0x2b) AM_READ(question_data_r) AM_WRITEONLY AM_BASE_MEMBER(statriv2_state, question_offset) | |
| 299 | 301 | AM_RANGE(0xb0, 0xb1) AM_DEVWRITE("aysnd", ay8910_address_data_w) |
| 300 | 302 | AM_RANGE(0xb1, 0xb1) AM_DEVREAD("aysnd", ay8910_r) |
| 301 | 303 | AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("tms", tms9927_r, tms9927_w) |
| r10886 | r10887 | |
| 1000 | 1002 | /* question address is stored as L/H/X (low/high/don't care) */ |
| 1001 | 1003 | static DRIVER_INIT( addr_lhx ) |
| 1002 | 1004 | { |
| 1003 | question_offset_low = 0; | |
| 1004 | question_offset_mid = 1; | |
| 1005 | question_offset_high = 0xff; | |
| 1005 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 1006 | state->question_offset_low = 0; | |
| 1007 | state->question_offset_mid = 1; | |
| 1008 | state->question_offset_high = 0xff; | |
| 1006 | 1009 | } |
| 1007 | 1010 | |
| 1008 | 1011 | /* question address is stored as X/L/H (don't care/low/high) */ |
| 1009 | 1012 | static DRIVER_INIT( addr_xlh ) |
| 1010 | 1013 | { |
| 1011 | question_offset_low = 1; | |
| 1012 | question_offset_mid = 2; | |
| 1013 | question_offset_high = 0xff; | |
| 1014 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 1015 | state->question_offset_low = 1; | |
| 1016 | state->question_offset_mid = 2; | |
| 1017 | state->question_offset_high = 0xff; | |
| 1014 | 1018 | } |
| 1015 | 1019 | |
| 1016 | 1020 | /* question address is stored as X/H/L (don't care/high/low) */ |
| 1017 | 1021 | static DRIVER_INIT( addr_xhl ) |
| 1018 | 1022 | { |
| 1019 | question_offset_low = 2; | |
| 1020 | question_offset_mid = 1; | |
| 1021 | question_offset_high = 0xff; | |
| 1023 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 1024 | state->question_offset_low = 2; | |
| 1025 | state->question_offset_mid = 1; | |
| 1026 | state->question_offset_high = 0xff; | |
| 1022 | 1027 | } |
| 1023 | 1028 | |
| 1024 | 1029 | /* question address is stored as L/M/H (low/mid/high) */ |
| 1025 | 1030 | static DRIVER_INIT( addr_lmh ) |
| 1026 | 1031 | { |
| 1027 | question_offset_low = 0; | |
| 1028 | question_offset_mid = 1; | |
| 1029 | question_offset_high = 2; | |
| 1032 | statriv2_state *state = machine->driver_data<statriv2_state>(); | |
| 1033 | state->question_offset_low = 0; | |
| 1034 | state->question_offset_mid = 1; | |
| 1035 | state->question_offset_high = 2; | |
| 1030 | 1036 | } |
| 1031 | 1037 | |
| 1032 | 1038 | static DRIVER_INIT( addr_lmhe ) |
| r10886 | r10887 | |
|---|---|---|
| 51 | 51 | #include "sound/ay8910.h" |
| 52 | 52 | #include "video/mc6845.h" |
| 53 | 53 | |
| 54 | static UINT8* carrera_tileram; | |
| 55 | 54 | |
| 55 | class carrera_state : public driver_device | |
| 56 | { | |
| 57 | public: | |
| 58 | carrera_state(running_machine &machine, const driver_device_config_base &config) | |
| 59 | : driver_device(machine, config) { } | |
| 56 | 60 | |
| 61 | UINT8* tileram; | |
| 62 | }; | |
| 57 | 63 | |
| 64 | ||
| 58 | 65 | static ADDRESS_MAP_START( carrera_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 59 | 66 | AM_RANGE(0x0000, 0x4fff) AM_ROM |
| 60 | 67 | AM_RANGE(0xe000, 0xe7ff) AM_RAM |
| 61 | 68 | AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("crtc", mc6845_address_w) |
| 62 | 69 | AM_RANGE(0xe801, 0xe801) AM_DEVWRITE("crtc", mc6845_register_w) |
| 63 | AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE( | |
| 70 | AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE_MEMBER( | |
| 64 | 71 | ADDRESS_MAP_END |
| 65 | 72 | |
| 66 | 73 | static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 239 | 246 | |
| 240 | 247 | static SCREEN_UPDATE(carrera) |
| 241 | 248 | { |
| 249 | carrera_state *state = screen->machine->driver_data<carrera_state>(); | |
| 242 | 250 | |
| 243 | 251 | int x,y; |
| 244 | 252 | int count = 0; |
| r10886 | r10887 | |
| 247 | 255 | { |
| 248 | 256 | for (x=0;x<64;x++) |
| 249 | 257 | { |
| 250 | int tile = | |
| 258 | int tile = stat | |
| 251 | 259 | |
| 252 | 260 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8); |
| 253 | 261 | count++; |
| r10886 | r10887 | |
| 313 | 321 | }; |
| 314 | 322 | |
| 315 | 323 | |
| 316 | static MACHINE_CONFIG_START( carrera, | |
| 324 | static MACHINE_CONFIG_START( carrera, carr | |
| 317 | 325 | /* basic machine hardware */ |
| 318 | 326 | MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK / 6) |
| 319 | 327 | MCFG_CPU_PROGRAM_MAP(carrera_map) |
| r10886 | r10887 | |
|---|---|---|
| 44 | 44 | #include "emu.h" |
| 45 | 45 | #include "cpu/nec/nec.h" |
| 46 | 46 | |
| 47 | static UINT16 *peno_vram; | |
| 48 | 47 | |
| 48 | class ttchamp_state : public driver_device | |
| 49 | { | |
| 50 | public: | |
| 51 | ttchamp_state(running_machine &machine, const driver_device_config_base &config) | |
| 52 | : driver_device(machine, config) { } | |
| 49 | 53 | |
| 54 | UINT16 *peno_vram; | |
| 55 | UINT16 paloff; | |
| 56 | }; | |
| 57 | ||
| 58 | ||
| 50 | 59 | static VIDEO_START(ttchamp) |
| 51 | 60 | { |
| 52 | 61 | } |
| 53 | 62 | |
| 54 | 63 | static SCREEN_UPDATE(ttchamp) |
| 55 | 64 | { |
| 65 | ttchamp_state *state = screen->machine->driver_data<ttchamp_state>(); | |
| 56 | 66 | int y,x,count; |
| 57 | 67 | // int i; |
| 58 | 68 | static const int xxx=320,yyy=204; |
| r10886 | r10887 | |
| 75 | 85 | { |
| 76 | 86 | for(x=0;x<xxx;x++) |
| 77 | 87 | { |
| 78 | /*if(hotblock_port0&0x40)*/*BITMAP_ADDR16(bitmap, y, x) = ((UINT8 *)peno_vram)[BYTE_XOR_LE(count)]+0x300; | |
| 88 | /*if(hotblock_port0&0x40)*/*BITMAP_ADDR16(bitmap, y, x) = ((UINT8 *)state->peno_vram)[BYTE_XOR_LE(count)]+0x300; | |
| 79 | 89 | count++; |
| 80 | 90 | } |
| 81 | 91 | } |
| 82 | 92 | return 0; |
| 83 | 93 | } |
| 84 | 94 | |
| 85 | static UINT16 paloff; | |
| 86 | 95 | |
| 87 | 96 | static WRITE16_HANDLER( paloff_w ) |
| 88 | 97 | { |
| 89 | COMBINE_DATA(&paloff); | |
| 98 | ttchamp_state *state = space->machine->driver_data<ttchamp_state>(); | |
| 99 | COMBINE_DATA(&state->paloff); | |
| 90 | 100 | } |
| 91 | 101 | |
| 92 | 102 | #ifdef UNUSED_FUNCTION |
| r10886 | r10887 | |
| 105 | 115 | |
| 106 | 116 | static WRITE16_HANDLER( paldat_w ) |
| 107 | 117 | { |
| 108 | palette_set_color_rgb(space->machine,paloff & 0x7fff,pal5bit(data>>0),pal5bit(data>>5),pal5bit(data>>10)); | |
| 118 | ttchamp_state *state = space->machine->driver_data<ttchamp_state>(); | |
| 119 | palette_set_color_rgb(space->machine,state->paloff & 0x7fff,pal5bit(data>>0),pal5bit(data>>5),pal5bit(data>>10)); | |
| 109 | 120 | } |
| 110 | 121 | |
| 111 | 122 | static READ16_HANDLER( peno_rand ) |
| r10886 | r10887 | |
| 122 | 133 | |
| 123 | 134 | static ADDRESS_MAP_START( ttchamp_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 124 | 135 | AM_RANGE(0x00000, 0x0ffff) AM_RAM |
| 125 | AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE( | |
| 136 | AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE_MEMBER(ttchamp_state, peno_vram) | |
| 126 | 137 | AM_RANGE(0x20000, 0x7ffff) AM_ROMBANK("bank1") // ? |
| 127 | 138 | AM_RANGE(0x80000, 0xfffff) AM_ROMBANK("bank2") // ? |
| 128 | 139 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 222 | 233 | cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); |
| 223 | 234 | } |
| 224 | 235 | |
| 225 | static MACHINE_CONFIG_START( ttchamp, | |
| 236 | static MACHINE_CONFIG_START( ttchamp, tt | |
| 226 | 237 | /* basic machine hardware */ |
| 227 | 238 | MCFG_CPU_ADD("maincpu", V30, 8000000) |
| 228 | 239 | MCFG_CPU_PROGRAM_MAP(ttchamp_map) |
| r10886 | r10887 | |
|---|---|---|
| 699 | 699 | #include "goldnpkr.lh" |
| 700 | 700 | |
| 701 | 701 | |
| 702 | class goldnpkr_state : public driver_device | |
| 703 | { | |
| 704 | public: | |
| 705 | goldnpkr_state(running_machine &machine, const driver_device_config_base &config) | |
| 706 | : driver_device(machine, config) { } | |
| 707 | ||
| 708 | UINT8 *videoram; | |
| 709 | UINT8 *colorram; | |
| 710 | tilemap_t *bg_tilemap; | |
| 711 | int mux_data; | |
| 712 | UINT8 pia0_PA_data; | |
| 713 | }; | |
| 714 | ||
| 715 | ||
| 702 | 716 | /********************************************* |
| 703 | 717 | * Video Hardware * |
| 704 | 718 | *********************************************/ |
| 705 | 719 | |
| 706 | static UINT8 *videoram; | |
| 707 | static UINT8 *colorram; | |
| 708 | static tilemap_t *bg_tilemap; | |
| 709 | 720 | |
| 710 | 721 | static WRITE8_HANDLER( goldnpkr_videoram_w ) |
| 711 | 722 | { |
| 712 | videoram[offset] = data; | |
| 713 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 723 | goldnpkr_state *state = space->machine->driver_data<goldnpkr_state>(); | |
| 724 | state->videoram[offset] = data; | |
| 725 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 714 | 726 | } |
| 715 | 727 | |
| 716 | 728 | static WRITE8_HANDLER( goldnpkr_colorram_w ) |
| 717 | 729 | { |
| 718 | colorram[offset] = data; | |
| 719 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 730 | goldnpkr_state *state = space->machine->driver_data<goldnpkr_state>(); | |
| 731 | state->colorram[offset] = data; | |
| 732 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 720 | 733 | } |
| 721 | 734 | |
| 722 | 735 | static TILE_GET_INFO( get_bg_tile_info ) |
| 723 | 736 | { |
| 737 | goldnpkr_state *state = machine->driver_data<goldnpkr_state>(); | |
| 724 | 738 | /* - bits - |
| 725 | 739 | 7654 3210 |
| 726 | 740 | --xx xx-- tiles color. |
| r10886 | r10887 | |
| 729 | 743 | xx-- ---- unused. |
| 730 | 744 | */ |
| 731 | 745 | |
| 732 | int attr = colorram[tile_index]; | |
| 733 | int code = ((attr & 1) << 8) | videoram[tile_index]; | |
| 746 | int attr = state->colorram[tile_index]; | |
| 747 | int code = ((attr & 1) << 8) | state->videoram[tile_index]; | |
| 734 | 748 | int bank = (attr & 0x02) >> 1; /* bit 1 switch the gfx banks */ |
| 735 | 749 | int color = (attr & 0x3c) >> 2; /* bits 2-3-4-5 for color */ |
| 736 | 750 | |
| r10886 | r10887 | |
| 739 | 753 | |
| 740 | 754 | static TILE_GET_INFO( xtnd_get_bg_tile_info ) |
| 741 | 755 | { |
| 756 | goldnpkr_state *state = machine->driver_data<goldnpkr_state>(); | |
| 742 | 757 | /* 3 graphics banks system for VK extended cards |
| 743 | 758 | |
| 744 | 759 | - bits - |
| r10886 | r10887 | |
| 748 | 763 | -x-- ---x unused. |
| 749 | 764 | */ |
| 750 | 765 | |
| 751 | int attr = colorram[tile_index]; | |
| 752 | int code = ((attr & 1) << 8) | videoram[tile_index]; | |
| 766 | int attr = state->colorram[tile_index]; | |
| 767 | int code = ((attr & 1) << 8) | state->videoram[tile_index]; | |
| 753 | 768 | int bank = ((attr & 0x02) >> 1) + ((attr & 0x80) >> 7); /* bit 1 & 7 switch the gfx banks */ |
| 754 | 769 | int color = (attr & 0x3c) >> 2; /* bits 2-3-4-5 for color */ |
| 755 | 770 | |
| r10886 | r10887 | |
| 758 | 773 | |
| 759 | 774 | static VIDEO_START( goldnpkr ) |
| 760 | 775 | { |
| 761 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 776 | goldnpkr_state *state = machine->driver_data<goldnpkr_state>(); | |
| 777 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 762 | 778 | } |
| 763 | 779 | |
| 764 | 780 | static VIDEO_START( wcrdxtnd ) |
| 765 | 781 | { |
| 766 | bg_tilemap = tilemap_create(machine, xtnd_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 782 | goldnpkr_state *state = machine->driver_data<goldnpkr_state>(); | |
| 783 | state->bg_tilemap = tilemap_create(machine, xtnd_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 767 | 784 | } |
| 768 | 785 | |
| 769 | 786 | static SCREEN_UPDATE( goldnpkr ) |
| 770 | 787 | { |
| 771 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 788 | goldnpkr_state *state = screen->machine->driver_data<goldnpkr_state>(); | |
| 789 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 772 | 790 | return 0; |
| 773 | 791 | } |
| 774 | 792 | |
| r10886 | r10887 | |
| 912 | 930 | * R/W Handlers * |
| 913 | 931 | *******************************************/ |
| 914 | 932 | |
| 915 | static int mux_data = 0; | |
| 916 | static UINT8 pia0_PA_data; | |
| 917 | ||
| 918 | 933 | /* Inputs (buttons) are multiplexed. |
| 919 | 934 | There are 4 sets of 5 bits each and are connected to PIA0, portA. |
| 920 | 935 | The selector bits are located in PIA1, portB (bits 4-7). |
| 921 | 936 | */ |
| 922 | 937 | static READ8_DEVICE_HANDLER( goldnpkr_mux_port_r ) |
| 923 | 938 | { |
| 924 | switch( mux_data & 0xf0 ) /* bits 4-7 */ | |
| 939 | goldnpkr_state *state = device->machine->driver_data<goldnpkr_state>(); | |
| 940 | switch( state->mux_data & 0xf0 ) /* bits 4-7 */ | |
| 925 | 941 | { |
| 926 | 942 | case 0x10: return input_port_read(device->machine, "IN0-0"); |
| 927 | 943 | case 0x20: return input_port_read(device->machine, "IN0-1"); |
| r10886 | r10887 | |
| 933 | 949 | |
| 934 | 950 | static READ8_DEVICE_HANDLER( pottnpkr_mux_port_r ) |
| 935 | 951 | { |
| 952 | goldnpkr_state *state = device->machine->driver_data<goldnpkr_state>(); | |
| 936 | 953 | UINT8 pa_0_4 = 0xff, pa_7; /* Temporary place holder for bits 0 to 4 & 7 */ |
| 937 | 954 | |
| 938 | switch( mux_data & 0xf0 ) /* bits 4-7 */ | |
| 955 | switch( state->mux_data & 0xf0 ) /* bits 4-7 */ | |
| 939 | 956 | { |
| 940 | 957 | case 0x10: return input_port_read(device->machine, "IN0-0"); |
| 941 | 958 | case 0x20: return input_port_read(device->machine, "IN0-1"); |
| r10886 | r10887 | |
| 943 | 960 | case 0x80: return input_port_read(device->machine, "IN0-3"); |
| 944 | 961 | } |
| 945 | 962 | |
| 946 | pa_7 = (pia0_PA_data >> 7) & 1; /* To do: bit PA5 to pin CB1 */ | |
| 963 | pa_7 = (state->pia0_PA_data >> 7) & 1; /* To do: bit PA5 to pin CB1 */ | |
| 947 | 964 | // popmessage ("mux_port_r: %x ",((pa_0_4 & 0x3f) | (pa_7 << 6) | (pa_7 << 7))) ; /* Equates PA6 to PA7 */ |
| 948 | 965 | |
| 949 | 966 | return ( (pa_0_4 & 0x3f) | (pa_7 << 6) | (pa_7 << 7) ) ; |
| r10886 | r10887 | |
| 951 | 968 | |
| 952 | 969 | static WRITE8_DEVICE_HANDLER( mux_w ) |
| 953 | 970 | { |
| 954 | mux_data = data ^ 0xff; /* inverted */ | |
| 971 | goldnpkr_state *state = device->machine->driver_data<goldnpkr_state>(); | |
| 972 | state->mux_data = data ^ 0xff; /* inverted */ | |
| 955 | 973 | } |
| 956 | 974 | |
| 957 | 975 | static WRITE8_DEVICE_HANDLER( mux_port_w ) |
| 958 | 976 | { |
| 959 | pia0_PA_data = data; | |
| 977 | goldnpkr_state *state = device->machine->driver_data<goldnpkr_state>(); | |
| 978 | state->pia0_PA_data = data; | |
| 960 | 979 | } |
| 961 | 980 | |
| 962 | 981 | |
| r10886 | r10887 | |
| 1063 | 1082 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1064 | 1083 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1065 | 1084 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1066 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1067 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1085 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1086 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1068 | 1087 | AM_RANGE(0x2000, 0x7fff) AM_ROM /* superdbl uses 0x2000..0x3fff address space */ |
| 1069 | 1088 | ADDRESS_MAP_END |
| 1070 | 1089 | |
| r10886 | r10887 | |
| 1075 | 1094 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1076 | 1095 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1077 | 1096 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1078 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1079 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1097 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1098 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1080 | 1099 | AM_RANGE(0x2000, 0x3fff) AM_ROM |
| 1081 | 1100 | ADDRESS_MAP_END |
| 1082 | 1101 | |
| r10886 | r10887 | |
| 1087 | 1106 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1088 | 1107 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1089 | 1108 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1090 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1091 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1109 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1110 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1092 | 1111 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2") |
| 1093 | 1112 | // AM_RANGE(0x2108, 0x210b) AM_NOP /* unknown 40-pin device */ |
| 1094 | 1113 | AM_RANGE(0x4000, 0x7fff) AM_ROM |
| r10886 | r10887 | |
| 1111 | 1130 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") /* battery backed RAM */ |
| 1112 | 1131 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1113 | 1132 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1114 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1115 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1133 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1134 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1116 | 1135 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2") |
| 1117 | 1136 | AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_address_w) |
| 1118 | 1137 | AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| r10886 | r10887 | |
| 1126 | 1145 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1127 | 1146 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1128 | 1147 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1129 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1130 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1148 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1149 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1131 | 1150 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2") |
| 1132 | 1151 | AM_RANGE(0x2200, 0x27ff) AM_ROM /* for VK set */ |
| 1133 | 1152 | AM_RANGE(0x2800, 0x2fff) AM_RAM /* for VK set */ |
| r10886 | r10887 | |
| 1147 | 1166 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1148 | 1167 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1149 | 1168 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1150 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1151 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1169 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1170 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1152 | 1171 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2") |
| 1153 | 1172 | AM_RANGE(0x2200, 0x27ff) AM_ROM /* for VK hardware */ |
| 1154 | 1173 | AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("nvram") /* Dallas ds1210 + battery backed RAM */ |
| r10886 | r10887 | |
| 1166 | 1185 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") /* battery backed RAM */ |
| 1167 | 1186 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1168 | 1187 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1169 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1170 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1188 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1189 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1171 | 1190 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2") |
| 1172 | 1191 | AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_address_w) |
| 1173 | 1192 | AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| r10886 | r10887 | |
| 1201 | 1220 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) |
| 1202 | 1221 | AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 1203 | 1222 | AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 1204 | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(&videoram) | |
| 1205 | AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(&colorram) | |
| 1223 | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, videoram) | |
| 1224 | AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, colorram) | |
| 1206 | 1225 | AM_RANGE(0x2000, 0x3fff) AM_ROM |
| 1207 | 1226 | ADDRESS_MAP_END |
| 1208 | 1227 | |
| r10886 | r10887 | |
| 2886 | 2905 | * Machine Drivers * |
| 2887 | 2906 | *********************************************/ |
| 2888 | 2907 | |
| 2889 | static MACHINE_CONFIG_START( goldnpkr_base, dr | |
| 2908 | static MACHINE_CONFIG_START( goldnpkr_base, goldnpkr | |
| 2890 | 2909 | |
| 2891 | 2910 | /* basic machine hardware */ |
| 2892 | 2911 | MCFG_CPU_ADD("maincpu", M6502, CPU_CLOCK) |
| r10886 | r10887 | |
|---|---|---|
| 28 | 28 | #include "sound/okim6295.h" |
| 29 | 29 | #include "machine/nvram.h" |
| 30 | 30 | |
| 31 | #define CPU_CLOCK XTAL_40MHz | |
| 32 | #define VIDEO_CLOCK XTAL_14_31818MHz | |
| 33 | #define OKI_CLOCK XTAL_1MHz | |
| 34 | 31 | |
| 32 | class tickee_state : public driver_device | |
| 33 | { | |
| 34 | public: | |
| 35 | tickee_state(running_machine &machine, const driver_device_config_base &config) | |
| 36 | : driver_device(machine, config) { } | |
| 35 | 37 | |
| 36 | /* local variables */ | |
| 37 | static UINT16 *tickee_control; | |
| 38 | static UINT16 *tickee_vram; | |
| 39 | static emu_timer *setup_gun_timer; | |
| 38 | UINT16 *control; | |
| 39 | UINT16 *vram; | |
| 40 | emu_timer *setup_gun_timer; | |
| 41 | int beamxadd; | |
| 42 | int beamyadd; | |
| 43 | int palette_bank; | |
| 44 | UINT8 gunx[2]; | |
| 45 | }; | |
| 40 | 46 | |
| 41 | static int beamxadd; | |
| 42 | static int beamyadd; | |
| 43 | static int palette_bank; | |
| 44 | static UINT8 gunx[2]; | |
| 45 | 47 | |
| 48 | #define CPU_CLOCK XTAL_40MHz | |
| 49 | #define VIDEO_CLOCK XTAL_14_31818MHz | |
| 50 | #define OKI_CLOCK XTAL_1MHz | |
| 46 | 51 | |
| 47 | 52 | |
| 48 | 53 | /************************************* |
| r10886 | r10887 | |
| 69 | 74 | |
| 70 | 75 | static TIMER_CALLBACK( trigger_gun_interrupt ) |
| 71 | 76 | { |
| 77 | tickee_state *state = machine->driver_data<tickee_state>(); | |
| 72 | 78 | int which = param & 1; |
| 73 | 79 | int beamx = (machine->primary_screen->hpos()/2)-58; |
| 74 | 80 | |
| 75 | 81 | /* once we're ready to fire, set the X coordinate and assert the line */ |
| 76 | gunx[which] = beamx; | |
| 82 | state->gunx[which] = beamx; | |
| 77 | 83 | |
| 78 | 84 | /* fire the IRQ at the correct moment */ |
| 79 | 85 | cputag_set_input_line(machine, "maincpu", param, ASSERT_LINE); |
| r10886 | r10887 | |
| 89 | 95 | |
| 90 | 96 | static TIMER_CALLBACK( setup_gun_interrupts ) |
| 91 | 97 | { |
| 98 | tickee_state *state = machine->driver_data<tickee_state>(); | |
| 92 | 99 | int beamx, beamy; |
| 93 | 100 | |
| 94 | 101 | /* set a timer to do this again next frame */ |
| 95 | setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0)); | |
| 102 | state->setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0)); | |
| 96 | 103 | |
| 97 | 104 | /* only do work if the palette is flashed */ |
| 98 | if (tickee_control) | |
| 99 | if (!tickee_control[2]) | |
| 105 | if (state->control) | |
| 106 | if (!state->control[2]) | |
| 100 | 107 | return; |
| 101 | 108 | |
| 102 | 109 | /* generate interrupts for player 1's gun */ |
| 103 | 110 | get_crosshair_xy(machine, 0, &beamx, &beamy); |
| 104 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd, beamx + beamxadd), FUNC(trigger_gun_interrupt), 0); | |
| 105 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), FUNC(clear_gun_interrupt), 0); | |
| 111 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + state->beamyadd, beamx + state->beamxadd), FUNC(trigger_gun_interrupt), 0); | |
| 112 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + state->beamyadd + 1, beamx + state->beamxadd), FUNC(clear_gun_interrupt), 0); | |
| 106 | 113 | |
| 107 | 114 | /* generate interrupts for player 2's gun */ |
| 108 | 115 | get_crosshair_xy(machine, 1, &beamx, &beamy); |
| 109 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd, beamx + beamxadd), FUNC(trigger_gun_interrupt), 1); | |
| 110 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + beamyadd + 1, beamx + beamxadd), FUNC(clear_gun_interrupt), 1); | |
| 116 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + state->beamyadd, beamx + state->beamxadd), FUNC(trigger_gun_interrupt), 1); | |
| 117 | machine->scheduler().timer_set(machine->primary_screen->time_until_pos(beamy + state->beamyadd + 1, beamx + state->beamxadd), FUNC(clear_gun_interrupt), 1); | |
| 111 | 118 | } |
| 112 | 119 | |
| 113 | 120 | |
| r10886 | r10887 | |
| 120 | 127 | |
| 121 | 128 | static VIDEO_START( tickee ) |
| 122 | 129 | { |
| 130 | tickee_state *state = machine->driver_data<tickee_state>(); | |
| 123 | 131 | /* start a timer going on the first scanline of every frame */ |
| 124 | setup_gun_timer = machine->scheduler().timer_alloc(FUNC(setup_gun_interrupts)); | |
| 125 | setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0)); | |
| 132 | state->setup_gun_timer = machine->scheduler().timer_alloc(FUNC(setup_gun_interrupts)); | |
| 133 | state->setup_gun_timer->adjust(machine->primary_screen->time_until_pos(0)); | |
| 126 | 134 | } |
| 127 | 135 | |
| 128 | 136 | |
| r10886 | r10887 | |
| 135 | 143 | |
| 136 | 144 | static void scanline_update(screen_device &screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params) |
| 137 | 145 | { |
| 138 | UINT16 *src = &tickee_vram[(params->rowaddr << 8) & 0x3ff00]; | |
| 146 | tickee_state *state = screen.machine->driver_data<tickee_state>(); | |
| 147 | UINT16 *src = &state->vram[(params->rowaddr << 8) & 0x3ff00]; | |
| 139 | 148 | UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0); |
| 140 | 149 | const rgb_t *pens = tlc34076_get_pens(screen.machine->device("tlc34076")); |
| 141 | 150 | int coladdr = params->coladdr << 1; |
| 142 | 151 | int x; |
| 143 | 152 | |
| 144 | 153 | /* blank palette: fill with pen 255 */ |
| 145 | if (t | |
| 154 | if (stat | |
| 146 | 155 | { |
| 147 | 156 | for (x = params->heblnk; x < params->hsblnk; x++) |
| 148 | 157 | dest[x] = pens[0xff]; |
| r10886 | r10887 | |
| 160 | 169 | |
| 161 | 170 | static void rapidfir_scanline_update(screen_device &screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params) |
| 162 | 171 | { |
| 163 | UINT16 *src = &tickee_vram[(params->rowaddr << 8) & 0x3ff00]; | |
| 172 | tickee_state *state = screen.machine->driver_data<tickee_state>(); | |
| 173 | UINT16 *src = &state->vram[(params->rowaddr << 8) & 0x3ff00]; | |
| 164 | 174 | UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0); |
| 165 | 175 | const rgb_t *pens = tlc34076_get_pens(screen.machine->device("tlc34076")); |
| 166 | 176 | int coladdr = params->coladdr << 1; |
| 167 | 177 | int x; |
| 168 | 178 | |
| 169 | if (palette_bank) | |
| 179 | if (state->palette_bank) | |
| 170 | 180 | { |
| 171 | 181 | /* blank palette: fill with pen 255 */ |
| 172 | 182 | for (x = params->heblnk; x < params->hsblnk; x += 2) |
| r10886 | r10887 | |
| 196 | 206 | |
| 197 | 207 | static MACHINE_RESET( tickee ) |
| 198 | 208 | { |
| 199 | beamxadd = 50; | |
| 200 | beamyadd = 0; | |
| 209 | tickee_state *state = machine->driver_data<tickee_state>(); | |
| 210 | state->beamxadd = 50; | |
| 211 | state->beamyadd = 0; | |
| 201 | 212 | } |
| 202 | 213 | |
| 203 | 214 | static MACHINE_RESET( rapidfir ) |
| 204 | 215 | { |
| 205 | beamxadd = 0; | |
| 206 | beamyadd = -5; | |
| 216 | tickee_state *state = machine->driver_data<tickee_state>(); | |
| 217 | state->beamxadd = 0; | |
| 218 | state->beamyadd = -5; | |
| 207 | 219 | } |
| 208 | 220 | |
| 209 | 221 | |
| r10886 | r10887 | |
| 215 | 227 | |
| 216 | 228 | static WRITE16_HANDLER( rapidfir_transparent_w ) |
| 217 | 229 | { |
| 230 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 218 | 231 | if (!(data & 0xff00)) mem_mask &= 0x00ff; |
| 219 | 232 | if (!(data & 0x00ff)) mem_mask &= 0xff00; |
| 220 | COMBINE_DATA(&t | |
| 233 | COMBINE_DATA(&stat | |
| 221 | 234 | } |
| 222 | 235 | |
| 223 | 236 | |
| 224 | 237 | static READ16_HANDLER( rapidfir_transparent_r ) |
| 225 | 238 | { |
| 226 | return tickee_vram[offset]; | |
| 239 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 240 | return state->vram[offset]; | |
| 227 | 241 | } |
| 228 | 242 | |
| 229 | 243 | |
| 230 | 244 | static void rapidfir_to_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg) |
| 231 | 245 | { |
| 246 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 232 | 247 | if (address < 0x800000) |
| 233 | memcpy(shiftreg, &t | |
| 248 | memcpy(shiftreg, &stat | |
| 234 | 249 | } |
| 235 | 250 | |
| 236 | 251 | |
| 237 | 252 | static void rapidfir_from_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg) |
| 238 | 253 | { |
| 254 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 239 | 255 | if (address < 0x800000) |
| 240 | memcpy(&t | |
| 256 | memcpy(&stat | |
| 241 | 257 | } |
| 242 | 258 | |
| 243 | 259 | |
| r10886 | r10887 | |
| 250 | 266 | |
| 251 | 267 | static WRITE16_HANDLER( tickee_control_w ) |
| 252 | 268 | { |
| 253 | UINT16 olddata = tickee_control[offset]; | |
| 269 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 270 | UINT16 olddata = state->control[offset]; | |
| 254 | 271 | |
| 255 | 272 | /* offsets: |
| 256 | 273 | |
| r10886 | r10887 | |
| 259 | 276 | 6 = lamps? (changing all the time) |
| 260 | 277 | */ |
| 261 | 278 | |
| 262 | COMBINE_DATA(&t | |
| 279 | COMBINE_DATA(&stat | |
| 263 | 280 | |
| 264 | 281 | if (offset == 3) |
| 265 | 282 | { |
| r10886 | r10887 | |
| 267 | 284 | ticket_dispenser_w(space->machine->device("ticket2"), 0, (data & 4) << 5); |
| 268 | 285 | } |
| 269 | 286 | |
| 270 | if (olddata != tickee_control[offset]) | |
| 271 | logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(space->cpu), offset, tickee_control[offset], olddata); | |
| 287 | if (olddata != state->control[offset]) | |
| 288 | logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(space->cpu), offset, state->control[offset], olddata); | |
| 272 | 289 | } |
| 273 | 290 | |
| 274 | 291 | |
| r10886 | r10887 | |
| 287 | 304 | |
| 288 | 305 | static READ16_HANDLER( rapidfir_gun1_r ) |
| 289 | 306 | { |
| 290 | return gunx[0]; | |
| 307 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 308 | return state->gunx[0]; | |
| 291 | 309 | } |
| 292 | 310 | |
| 293 | 311 | |
| 294 | 312 | static READ16_HANDLER( rapidfir_gun2_r ) |
| 295 | 313 | { |
| 296 | return gunx[1]; | |
| 314 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 315 | return state->gunx[1]; | |
| 297 | 316 | } |
| 298 | 317 | |
| 299 | 318 | |
| r10886 | r10887 | |
| 310 | 329 | |
| 311 | 330 | static WRITE16_HANDLER( rapidfir_control_w ) |
| 312 | 331 | { |
| 332 | tickee_state *state = space->machine->driver_data<tickee_state>(); | |
| 313 | 333 | /* other bits like control on tickee? */ |
| 314 | 334 | if (ACCESSING_BITS_0_7) |
| 315 | palette_bank = data & 1; | |
| 335 | state->palette_bank = data & 1; | |
| 316 | 336 | } |
| 317 | 337 | |
| 318 | 338 | |
| r10886 | r10887 | |
| 358 | 378 | *************************************/ |
| 359 | 379 | |
| 360 | 380 | static ADDRESS_MAP_START( tickee_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 361 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE( | |
| 381 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE_MEMBER( | |
| 362 | 382 | AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0) |
| 363 | 383 | AM_RANGE(0x04000000, 0x04003fff) AM_RAM AM_SHARE("nvram") |
| 364 | 384 | AM_RANGE(0x04100000, 0x041000ff) AM_DEVREADWRITE8("tlc34076", tlc34076_r, tlc34076_w, 0x00ff) |
| r10886 | r10887 | |
| 366 | 386 | AM_RANGE(0x04200000, 0x0420001f) AM_DEVWRITE8("ym1", ay8910_address_data_w, 0x00ff) |
| 367 | 387 | AM_RANGE(0x04200100, 0x0420010f) AM_DEVREAD8("ym2", ay8910_r, 0x00ff) |
| 368 | 388 | AM_RANGE(0x04200100, 0x0420011f) AM_DEVWRITE8("ym2", ay8910_address_data_w, 0x00ff) |
| 369 | AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE( | |
| 389 | AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE_MEMBER( | |
| 370 | 390 | AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2") |
| 371 | 391 | AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w) |
| 372 | 392 | AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP /* seems to be a bug in their code */ |
| r10886 | r10887 | |
| 376 | 396 | |
| 377 | 397 | /* addreses in the 04x range shifted slightly...*/ |
| 378 | 398 | static ADDRESS_MAP_START( ghoshunt_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 379 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE( | |
| 399 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE_MEMBER( | |
| 380 | 400 | AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0) |
| 381 | 401 | AM_RANGE(0x04100000, 0x04103fff) AM_RAM AM_SHARE("nvram") |
| 382 | 402 | AM_RANGE(0x04200000, 0x042000ff) AM_DEVREADWRITE8("tlc34076", tlc34076_r, tlc34076_w, 0x00ff) |
| r10886 | r10887 | |
| 384 | 404 | AM_RANGE(0x04300000, 0x0430001f) AM_DEVWRITE8("ym1", ay8910_address_data_w, 0x00ff) |
| 385 | 405 | AM_RANGE(0x04300100, 0x0430010f) AM_DEVREAD8("ym2", ay8910_r, 0x00ff) |
| 386 | 406 | AM_RANGE(0x04300100, 0x0430011f) AM_DEVWRITE8("ym2", ay8910_address_data_w, 0x00ff) |
| 387 | AM_RANGE(0x04500000, 0x0450007f) AM_WRITE(tickee_control_w) AM_BASE( | |
| 407 | AM_RANGE(0x04500000, 0x0450007f) AM_WRITE(tickee_control_w) AM_BASE_MEMBER( | |
| 388 | 408 | AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w) |
| 389 | 409 | AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP /* seems to be a bug in their code */ |
| 390 | 410 | AM_RANGE(0xff000000, 0xffffffff) AM_ROM AM_REGION("user1", 0) |
| r10886 | r10887 | |
| 392 | 412 | |
| 393 | 413 | |
| 394 | 414 | static ADDRESS_MAP_START( mouseatk_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 395 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE( | |
| 415 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE_MEMBER( | |
| 396 | 416 | AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0) |
| 397 | 417 | AM_RANGE(0x04000000, 0x04003fff) AM_RAM AM_SHARE("nvram") |
| 398 | 418 | AM_RANGE(0x04100000, 0x041000ff) AM_DEVREADWRITE8("tlc34076", tlc34076_r, tlc34076_w, 0x00ff) |
| 399 | 419 | AM_RANGE(0x04200000, 0x0420000f) AM_DEVREAD8("ym", ay8910_r, 0x00ff) |
| 400 | 420 | AM_RANGE(0x04200000, 0x0420000f) AM_DEVWRITE8("ym", ay8910_address_data_w, 0x00ff) |
| 401 | 421 | AM_RANGE(0x04200100, 0x0420010f) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 402 | AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE( | |
| 422 | AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE_MEMBER( | |
| 403 | 423 | AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2") // ? |
| 404 | 424 | AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w) |
| 405 | 425 | AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP /* seems to be a bug in their code */ |
| r10886 | r10887 | |
| 409 | 429 | |
| 410 | 430 | /* newer hardware */ |
| 411 | 431 | static ADDRESS_MAP_START( rapidfir_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 412 | AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE( | |
| 432 | AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE_MEMBER( | |
| 413 | 433 | AM_RANGE(0x02000000, 0x027fffff) AM_READWRITE(rapidfir_transparent_r, rapidfir_transparent_w) |
| 414 | 434 | AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w) |
| 415 | 435 | AM_RANGE(0xfc000000, 0xfc00000f) AM_READ(rapidfir_gun1_r) |
| r10886 | r10887 | |
| 732 | 752 | * |
| 733 | 753 | *************************************/ |
| 734 | 754 | |
| 735 | static MACHINE_CONFIG_START( tickee, | |
| 755 | static MACHINE_CONFIG_START( tickee, t | |
| 736 | 756 | |
| 737 | 757 | /* basic machine hardware */ |
| 738 | 758 | MCFG_CPU_ADD("maincpu", TMS34010, XTAL_40MHz) |
| r10886 | r10887 | |
| 776 | 796 | MACHINE_CONFIG_END |
| 777 | 797 | |
| 778 | 798 | |
| 779 | static MACHINE_CONFIG_START( rapidfir, | |
| 799 | static MACHINE_CONFIG_START( rapidfir, t | |
| 780 | 800 | |
| 781 | 801 | /* basic machine hardware */ |
| 782 | 802 | MCFG_CPU_ADD("maincpu", TMS34010, XTAL_50MHz) |
| r10886 | r10887 | |
| 804 | 824 | MACHINE_CONFIG_END |
| 805 | 825 | |
| 806 | 826 | |
| 807 | static MACHINE_CONFIG_START( mouseatk, | |
| 827 | static MACHINE_CONFIG_START( mouseatk, t | |
| 808 | 828 | |
| 809 | 829 | /* basic machine hardware */ |
| 810 | 830 | MCFG_CPU_ADD("maincpu", TMS34010, XTAL_40MHz) |
| r10886 | r10887 | |
|---|---|---|
| 2234 | 2234 | GAME( 1992, uccopsar, uccops, uccops, uccops, uccops, ROT0, "Irem", "Undercover Cops (Alpha Renewal Version)", 0 ) |
| 2235 | 2235 | GAME( 1992, uccopsj, uccops, uccops, uccops, uccops, ROT0, "Irem", "Undercover Cops (Japan)", 0 ) |
| 2236 | 2236 | GAME( 1992, mysticri, 0, mysticri, mysticri, mysticri, ROT0, "Irem", "Mystic Riders (World)", 0 ) |
| 2237 | GAME( 1992, gunhohki, mysticri, mysticri, mysticri, mysticri, ROT0, "Irem", "Gun Hohki (Japan)", 0 ) | |
| 2237 | GAME( 1992, gunhohki, mysticri, mysticri, mysticri, mysticri, ROT0, "Irem", "Mahou Keibitai Gun Hohki (Japan)", 0 ) | |
| 2238 | 2238 | // cheaply produced Korean board, has original chips, but lacks any proper labels |
| 2239 | 2239 | // main code is also significantly different to the supported original set, so it might just be a legitimate early revision on a cheap board |
| 2240 | 2240 | GAME( 1992, mysticrib,mysticri, mysticri, mysticri, mysticri, ROT0, "Irem", "Mystic Riders (bootleg?)", 0) |
| r10886 | r10887 | |
|---|---|---|
| 90 | 90 | #include "machine/nvram.h" |
| 91 | 91 | |
| 92 | 92 | |
| 93 | static UINT16* m68k_framebuffer[2]; | |
| 94 | static UINT16* i860_framebuffer[2][2]; | |
| 95 | static UINT16* framebuffer_ctrl; | |
| 93 | class vcombat_state : public driver_device | |
| 94 | { | |
| 95 | public: | |
| 96 | vcombat_state(running_machine &machine, const driver_device_config_base &config) | |
| 97 | : driver_device(machine, config) { } | |
| 96 | 98 | |
| 97 | static UINT16* vid_0_shared_RAM; | |
| 98 | static UINT16* vid_1_shared_RAM; | |
| 99 | UINT16* m68k_framebuffer[2]; | |
| 100 | UINT16* i860_framebuffer[2][2]; | |
| 101 | UINT16* framebuffer_ctrl; | |
| 102 | UINT16* vid_0_shared_RAM; | |
| 103 | UINT16* vid_1_shared_RAM; | |
| 104 | int crtc_select; | |
| 105 | }; | |
| 99 | 106 | |
| 100 | static int crtc_select; | |
| 101 | 107 | |
| 102 | ||
| 103 | 108 | static SCREEN_UPDATE( vcombat ) |
| 104 | 109 | { |
| 110 | vcombat_state *state = screen->machine->driver_data<vcombat_state>(); | |
| 105 | 111 | int y; |
| 106 | 112 | const rgb_t *const pens = tlc34076_get_pens(screen->machine->device("tlc34076")); |
| 107 | 113 | device_t *aux = screen->machine->device("aux"); |
| 108 | 114 | |
| 109 | UINT16 *m68k_buf = m68k_framebuffer[(*framebuffer_ctrl & 0x20) ? 1 : 0]; | |
| 110 | UINT16 *i860_buf = i860_framebuffer[(screen == aux) ? 1 : 0][0]; | |
| 115 | UINT16 *m68k_buf = state->m68k_framebuffer[(*state->framebuffer_ctrl & 0x20) ? 1 : 0]; | |
| 116 | UINT16 *i860_buf = state->i860_framebuffer[(screen == aux) ? 1 : 0][0]; | |
| 111 | 117 | |
| 112 | 118 | /* TODO: It looks like the leftmost chunk of the ground should really be on the right side? */ |
| 113 | 119 | /* But the i860 draws the background correctly, so it may be an original game issue. */ |
| r10886 | r10887 | |
| 152 | 158 | |
| 153 | 159 | static WRITE16_HANDLER( main_video_write ) |
| 154 | 160 | { |
| 155 | int fb = (*framebuffer_ctrl & 0x20) ? 0 : 1; | |
| 156 | UINT16 old_data = m68k_framebuffer[fb][offset]; | |
| 161 | vcombat_state *state = space->machine->driver_data<vcombat_state>(); | |
| 162 | int fb = (*state->framebuffer_ctrl & 0x20) ? 0 : 1; | |
| 163 | UINT16 old_data = state->m68k_framebuffer[fb][offset]; | |
| 157 | 164 | |
| 158 | 165 | /* Transparency mode? */ |
| 159 | if (*framebuffer_ctrl & 0x40) | |
| 166 | if (*state->framebuffer_ctrl & 0x40) | |
| 160 | 167 | { |
| 161 | 168 | if (data == 0x0000) |
| 162 | 169 | return; |
| r10886 | r10887 | |
| 166 | 173 | if ((data & 0xff00) == 0) |
| 167 | 174 | data = (data & 0x00ff) | (old_data & 0xff00); |
| 168 | 175 | |
| 169 | COMBINE_DATA(&m68k_framebuffer[fb][offset]); | |
| 176 | COMBINE_DATA(&state->m68k_framebuffer[fb][offset]); | |
| 170 | 177 | } |
| 171 | 178 | else |
| 172 | 179 | { |
| 173 | COMBINE_DATA(&m68k_framebuffer[fb][offset]); | |
| 180 | COMBINE_DATA(&state->m68k_framebuffer[fb][offset]); | |
| 174 | 181 | } |
| 175 | 182 | } |
| 176 | 183 | |
| r10886 | r10887 | |
| 243 | 250 | |
| 244 | 251 | static WRITE64_HANDLER( v0_fb_w ) |
| 245 | 252 | { |
| 253 | vcombat_state *state = space->machine->driver_data<vcombat_state>(); | |
| 246 | 254 | /* The frame buffer seems to sit on a 32-bit data bus, while the |
| 247 | 255 | i860 uses a 64-bit data bus. Adjust accordingly. */ |
| 248 | char *p = (char *)(i860_framebuffer[0][0]); | |
| 256 | char *p = (char *)(state->i860_framebuffer[0][0]); | |
| 249 | 257 | int m = mem_mask; |
| 250 | 258 | int o = (offset << 2); |
| 251 | 259 | if (m & 0xff000000) { |
| r10886 | r10887 | |
| 266 | 274 | framebuffer. */ |
| 267 | 275 | static WRITE64_HANDLER( v1_fb_w ) |
| 268 | 276 | { |
| 277 | vcombat_state *state = space->machine->driver_data<vcombat_state>(); | |
| 269 | 278 | /* The frame buffer seems to sit on a 32-bit data bus, while the |
| 270 | 279 | i860 uses a 64-bit data bus. Adjust accordingly. */ |
| 271 | char *p = (char *)(i860_framebuffer[1][0]); | |
| 280 | char *p = (char *)(state->i860_framebuffer[1][0]); | |
| 272 | 281 | int m = mem_mask; |
| 273 | 282 | int o = (offset << 2); |
| 274 | 283 | if (m & 0xff000000) { |
| r10886 | r10887 | |
| 287 | 296 | |
| 288 | 297 | static WRITE16_HANDLER( crtc_w ) |
| 289 | 298 | { |
| 299 | vcombat_state *state = space->machine->driver_data<vcombat_state>(); | |
| 290 | 300 | device_t *crtc = space->machine->device("crtc"); |
| 291 | 301 | |
| 292 | 302 | if (crtc == NULL) |
| 293 | 303 | return; |
| 294 | 304 | |
| 295 | if (crtc_select == 0) | |
| 305 | if (state->crtc_select == 0) | |
| 296 | 306 | mc6845_address_w(crtc, 0, data >> 8); |
| 297 | 307 | else |
| 298 | 308 | mc6845_register_w(crtc, 0, data >> 8); |
| 299 | 309 | |
| 300 | crtc_select ^= 1; | |
| 310 | state->crtc_select ^= 1; | |
| 301 | 311 | } |
| 302 | 312 | |
| 303 | 313 | static WRITE16_DEVICE_HANDLER( vcombat_dac_w ) |
| r10886 | r10887 | |
| 311 | 321 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 312 | 322 | AM_RANGE(0x300000, 0x30ffff) AM_WRITE(main_video_write) |
| 313 | 323 | |
| 314 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE( | |
| 324 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE_MEMBER(vcombat_state, vid_0_shared_RAM) AM_SHARE("share2") /* First i860 shared RAM */ | |
| 315 | 325 | AM_RANGE(0x440000, 0x440003) AM_RAM AM_SHARE("share6") /* M0->P0 i860 #1 com 1 */ |
| 316 | 326 | AM_RANGE(0x480000, 0x480003) AM_RAM AM_SHARE("share7") /* M0<-P0 i860 #1 com 2 */ |
| 317 | 327 | AM_RANGE(0x4c0000, 0x4c0003) AM_WRITE(wiggle_i860p0_pins_w) /* i860 #1 stop/start/reset */ |
| 318 | 328 | |
| 319 | AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_BASE( | |
| 329 | AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_BASE_MEMBER(vcombat_state, vid_1_shared_RAM) AM_SHARE("share3") /* Second i860 shared RAM */ | |
| 320 | 330 | AM_RANGE(0x540000, 0x540003) AM_RAM AM_SHARE("share8") /* M0->P1 i860 #2 com 1 */ |
| 321 | 331 | AM_RANGE(0x580000, 0x580003) AM_RAM AM_SHARE("share9") /* M0<-P1 i860 #2 com 2 */ |
| 322 | 332 | AM_RANGE(0x5c0000, 0x5c0003) AM_WRITE(wiggle_i860p1_pins_w) /* i860 #2 stop/start/reset */ |
| r10886 | r10887 | |
| 327 | 337 | AM_RANGE(0x60001c, 0x60001d) AM_NOP |
| 328 | 338 | |
| 329 | 339 | AM_RANGE(0x60000c, 0x60000d) AM_WRITE(crtc_w) |
| 330 | AM_RANGE(0x600010, 0x600011) AM_RAM AM_BASE( | |
| 340 | AM_RANGE(0x600010, 0x600011) AM_RAM AM_BASE_MEMBER(vcombat_state, framebuffer_ctrl) | |
| 331 | 341 | AM_RANGE(0x700000, 0x7007ff) AM_RAM AM_SHARE("nvram") |
| 332 | 342 | AM_RANGE(0x701000, 0x701001) AM_READ(main_irqiack_r) |
| 333 | 343 | AM_RANGE(0x702000, 0x702001) AM_READ(control_3_r) |
| r10886 | r10887 | |
| 376 | 386 | |
| 377 | 387 | static MACHINE_RESET( vcombat ) |
| 378 | 388 | { |
| 389 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 379 | 390 | i860_set_pin(machine->device("vid_0"), DEC_PIN_BUS_HOLD, 1); |
| 380 | 391 | i860_set_pin(machine->device("vid_1"), DEC_PIN_BUS_HOLD, 1); |
| 381 | 392 | |
| 382 | crtc_select = 0; | |
| 393 | state->crtc_select = 0; | |
| 383 | 394 | } |
| 384 | 395 | |
| 385 | 396 | static MACHINE_RESET( shadfgtr ) |
| 386 | 397 | { |
| 398 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 387 | 399 | i860_set_pin(machine->device("vid_0"), DEC_PIN_BUS_HOLD, 1); |
| 388 | 400 | |
| 389 | crtc_select = 0; | |
| 401 | state->crtc_select = 0; | |
| 390 | 402 | } |
| 391 | 403 | |
| 392 | 404 | |
| 393 | 405 | DIRECT_UPDATE_HANDLER( vcombat_vid_0_direct_handler ) |
| 394 | 406 | { |
| 407 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 395 | 408 | if (address >= 0xfffc0000 && address <= 0xffffffff) |
| 396 | 409 | { |
| 397 | direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, vid_0_shared_RAM); | |
| 410 | direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->vid_0_shared_RAM); | |
| 398 | 411 | return ~0; |
| 399 | 412 | } |
| 400 | 413 | return address; |
| r10886 | r10887 | |
| 402 | 415 | |
| 403 | 416 | DIRECT_UPDATE_HANDLER( vcombat_vid_1_direct_handler ) |
| 404 | 417 | { |
| 418 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 405 | 419 | if (address >= 0xfffc0000 && address <= 0xffffffff) |
| 406 | 420 | { |
| 407 | direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, vid_1_shared_RAM); | |
| 421 | direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->vid_1_shared_RAM); | |
| 408 | 422 | return ~0; |
| 409 | 423 | } |
| 410 | 424 | return address; |
| r10886 | r10887 | |
| 413 | 427 | |
| 414 | 428 | static DRIVER_INIT( vcombat ) |
| 415 | 429 | { |
| 430 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 416 | 431 | UINT8 *ROM = machine->region("maincpu")->base(); |
| 417 | 432 | |
| 418 | 433 | /* The two i860s execute out of RAM */ |
| r10886 | r10887 | |
| 423 | 438 | space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_1_direct_handler, *machine)); |
| 424 | 439 | |
| 425 | 440 | /* Allocate the 68000 framebuffers */ |
| 426 | m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 427 | m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 441 | state->m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 442 | state->m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 428 | 443 | |
| 429 | 444 | /* First i860 */ |
| 430 | i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 431 | i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 445 | state->i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 446 | state->i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 432 | 447 | |
| 433 | 448 | /* Second i860 */ |
| 434 | i860_framebuffer[1][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 435 | i860_framebuffer[1][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 449 | state->i860_framebuffer[1][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 450 | state->i860_framebuffer[1][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 436 | 451 | |
| 437 | 452 | /* pc==4016 : jump 4038 ... There's something strange about how it waits at 402e (interrupts all masked out) |
| 438 | 453 | I think what is happening here is that M0 snags the first time |
| r10886 | r10887 | |
| 452 | 467 | |
| 453 | 468 | static DRIVER_INIT( shadfgtr ) |
| 454 | 469 | { |
| 470 | vcombat_state *state = machine->driver_data<vcombat_state>(); | |
| 455 | 471 | /* Allocate th 68000 frame buffers */ |
| 456 | m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 457 | m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 472 | state->m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 473 | state->m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 458 | 474 | |
| 459 | 475 | /* Only one i860 */ |
| 460 | i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 461 | i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 462 | i860_framebuffer[1][0] = NULL; | |
| 463 | i860_framebuffer[1][1] = NULL; | |
| 476 | state->i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 477 | state->i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); | |
| 478 | state->i860_framebuffer[1][0] = NULL; | |
| 479 | state->i860_framebuffer[1][1] = NULL; | |
| 464 | 480 | |
| 465 | 481 | /* The i860 executes out of RAM */ |
| 466 | 482 | address_space *space = machine->device<i860_device>("vid_0")->space(AS_PROGRAM); |
| r10886 | r10887 | |
| 547 | 563 | }; |
| 548 | 564 | |
| 549 | 565 | |
| 550 | static MACHINE_CONFIG_START( vcombat, | |
| 566 | static MACHINE_CONFIG_START( vcombat, | |
| 551 | 567 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) |
| 552 | 568 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 553 | 569 | MCFG_CPU_VBLANK_INT("screen", irq1_line_assert) |
| r10886 | r10887 | |
| 597 | 613 | MACHINE_CONFIG_END |
| 598 | 614 | |
| 599 | 615 | |
| 600 | static MACHINE_CONFIG_START( shadfgtr, | |
| 616 | static MACHINE_CONFIG_START( shadfgtr, | |
| 601 | 617 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) |
| 602 | 618 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 603 | 619 | MCFG_CPU_VBLANK_INT("screen", irq1_line_assert) |
| r10886 | r10887 | |
|---|---|---|
| 16 | 16 | #include "sound/2203intf.h" |
| 17 | 17 | #include "machine/nvram.h" |
| 18 | 18 | |
| 19 | static int interrupt_scanline=192; | |
| 20 | 19 | |
| 21 | static UINT16 out = 0; | |
| 22 | static UINT8 interrupt_line_active=0; | |
| 20 | class pkscram_state : public driver_device | |
| 21 | { | |
| 22 | public: | |
| 23 | pkscram_state(running_machine &machine, const driver_device_config_base &config) | |
| 24 | : driver_device(machine, config) { } | |
| 23 | 25 | |
| 24 | static UINT16* pkscramble_fgtilemap_ram; | |
| 25 | static UINT16* pkscramble_mdtilemap_ram; | |
| 26 | static UINT16* pkscramble_bgtilemap_ram; | |
| 26 | UINT16 out; | |
| 27 | UINT8 interrupt_line_active; | |
| 28 | UINT16* pkscramble_fgtilemap_ram; | |
| 29 | UINT16* pkscramble_mdtilemap_ram; | |
| 30 | UINT16* pkscramble_bgtilemap_ram; | |
| 31 | tilemap_t *fg_tilemap; | |
| 32 | tilemap_t *md_tilemap; | |
| 33 | tilemap_t *bg_tilemap; | |
| 34 | }; | |
| 27 | 35 | |
| 28 | static tilemap_t *fg_tilemap, *md_tilemap, *bg_tilemap; | |
| 29 | 36 | |
| 37 | enum { interrupt_scanline=192 }; | |
| 38 | ||
| 39 | ||
| 30 | 40 | static WRITE16_HANDLER( pkscramble_fgtilemap_w ) |
| 31 | 41 | { |
| 32 | COMBINE_DATA(&pkscramble_fgtilemap_ram[offset]); | |
| 33 | tilemap_mark_tile_dirty(fg_tilemap, offset >> 1); | |
| 42 | pkscram_state *state = space->machine->driver_data<pkscram_state>(); | |
| 43 | COMBINE_DATA(&state->pkscramble_fgtilemap_ram[offset]); | |
| 44 | tilemap_mark_tile_dirty(state->fg_tilemap, offset >> 1); | |
| 34 | 45 | } |
| 35 | 46 | |
| 36 | 47 | static WRITE16_HANDLER( pkscramble_mdtilemap_w ) |
| 37 | 48 | { |
| 38 | COMBINE_DATA(&pkscramble_mdtilemap_ram[offset]); | |
| 39 | tilemap_mark_tile_dirty(md_tilemap, offset >> 1); | |
| 49 | pkscram_state *state = space->machine->driver_data<pkscram_state>(); | |
| 50 | COMBINE_DATA(&state->pkscramble_mdtilemap_ram[offset]); | |
| 51 | tilemap_mark_tile_dirty(state->md_tilemap, offset >> 1); | |
| 40 | 52 | } |
| 41 | 53 | |
| 42 | 54 | static WRITE16_HANDLER( pkscramble_bgtilemap_w ) |
| 43 | 55 | { |
| 44 | COMBINE_DATA(&pkscramble_bgtilemap_ram[offset]); | |
| 45 | tilemap_mark_tile_dirty(bg_tilemap, offset >> 1); | |
| 56 | pkscram_state *state = space->machine->driver_data<pkscram_state>(); | |
| 57 | COMBINE_DATA(&state->pkscramble_bgtilemap_ram[offset]); | |
| 58 | tilemap_mark_tile_dirty(state->bg_tilemap, offset >> 1); | |
| 46 | 59 | } |
| 47 | 60 | |
| 48 | 61 | // input bit 0x20 in port1 should stay low until bit 0x20 is written here, then |
| 49 | 62 | // it should stay high for some time (currently we cheat keeping the input always active) |
| 50 | 63 | static WRITE16_HANDLER( pkscramble_output_w ) |
| 51 | 64 | { |
| 65 | pkscram_state *state = space->machine->driver_data<pkscram_state>(); | |
| 52 | 66 | // OUTPUT |
| 53 | 67 | // BIT |
| 54 | 68 | // 0x0001 -> STL |
| r10886 | r10887 | |
| 69 | 83 | // 0x2000 -> vblank interrupt enable |
| 70 | 84 | // 0x4000 -> set on every second frame - not used |
| 71 | 85 | |
| 72 | out = data; | |
| 86 | state->out = data; | |
| 73 | 87 | |
| 74 | if (!(out & 0x2000) && interrupt_line_active) | |
| 88 | if (!(state->out & 0x2000) && state->interrupt_line_active) | |
| 75 | 89 | { |
| 76 | 90 | cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE); |
| 77 | interrupt_line_active = 0; | |
| 91 | state->interrupt_line_active = 0; | |
| 78 | 92 | } |
| 79 | 93 | |
| 80 | 94 | coin_counter_w(space->machine, 0, data & 0x80); |
| r10886 | r10887 | |
| 85 | 99 | AM_RANGE(0x000000, 0x01ffff) AM_ROM |
| 86 | 100 | AM_RANGE(0x040000, 0x0400ff) AM_RAM AM_SHARE("nvram") |
| 87 | 101 | AM_RANGE(0x041000, 0x043fff) AM_RAM // main ram |
| 88 | AM_RANGE(0x044000, 0x044fff) AM_RAM_WRITE(pkscramble_fgtilemap_w) AM_BASE(&pkscramble_fgtilemap_ram) // fg tilemap | |
| 89 | AM_RANGE(0x045000, 0x045fff) AM_RAM_WRITE(pkscramble_mdtilemap_w) AM_BASE(&pkscramble_mdtilemap_ram) // md tilemap (just a copy of fg?) | |
| 90 | AM_RANGE(0x046000, 0x046fff) AM_RAM_WRITE(pkscramble_bgtilemap_w) AM_BASE(&pkscramble_bgtilemap_ram) // bg tilemap | |
| 102 | AM_RANGE(0x044000, 0x044fff) AM_RAM_WRITE(pkscramble_fgtilemap_w) AM_BASE_MEMBER(pkscram_state, pkscramble_fgtilemap_ram) // fg tilemap | |
| 103 | AM_RANGE(0x045000, 0x045fff) AM_RAM_WRITE(pkscramble_mdtilemap_w) AM_BASE_MEMBER(pkscram_state, pkscramble_mdtilemap_ram) // md tilemap (just a copy of fg?) | |
| 104 | AM_RANGE(0x046000, 0x046fff) AM_RAM_WRITE(pkscramble_bgtilemap_w) AM_BASE_MEMBER(pkscram_state, pkscramble_bgtilemap_ram) // bg tilemap | |
| 91 | 105 | AM_RANGE(0x047000, 0x047fff) AM_RAM // unused |
| 92 | 106 | AM_RANGE(0x048000, 0x048fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) |
| 93 | 107 | AM_RANGE(0x049000, 0x049001) AM_READ_PORT("DSW") |
| r10886 | r10887 | |
| 169 | 183 | |
| 170 | 184 | static TILE_GET_INFO( get_bg_tile_info ) |
| 171 | 185 | { |
| 172 | int tile = pkscramble_bgtilemap_ram[tile_index*2]; | |
| 173 | int color = pkscramble_bgtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 186 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 187 | int tile = state->pkscramble_bgtilemap_ram[tile_index*2]; | |
| 188 | int color = state->pkscramble_bgtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 174 | 189 | |
| 175 | 190 | SET_TILE_INFO(0,tile,color,0); |
| 176 | 191 | } |
| 177 | 192 | |
| 178 | 193 | static TILE_GET_INFO( get_md_tile_info ) |
| 179 | 194 | { |
| 180 | int tile = pkscramble_mdtilemap_ram[tile_index*2]; | |
| 181 | int color = pkscramble_mdtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 195 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 196 | int tile = state->pkscramble_mdtilemap_ram[tile_index*2]; | |
| 197 | int color = state->pkscramble_mdtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 182 | 198 | |
| 183 | 199 | SET_TILE_INFO(0,tile,color,0); |
| 184 | 200 | } |
| 185 | 201 | |
| 186 | 202 | static TILE_GET_INFO( get_fg_tile_info ) |
| 187 | 203 | { |
| 188 | int tile = pkscramble_fgtilemap_ram[tile_index*2]; | |
| 189 | int color = pkscramble_fgtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 204 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 205 | int tile = state->pkscramble_fgtilemap_ram[tile_index*2]; | |
| 206 | int color = state->pkscramble_fgtilemap_ram[tile_index*2 + 1] & 0x7f; | |
| 190 | 207 | |
| 191 | 208 | SET_TILE_INFO(0,tile,color,0); |
| 192 | 209 | } |
| 193 | 210 | |
| 194 | 211 | static TIMER_DEVICE_CALLBACK( scanline_callback ) |
| 195 | 212 | { |
| 213 | pkscram_state *state = timer.machine->driver_data<pkscram_state>(); | |
| 196 | 214 | if (param == interrupt_scanline) |
| 197 | 215 | { |
| 198 | if (out & 0x2000) | |
| 216 | if (state->out & 0x2000) | |
| 199 | 217 | cputag_set_input_line(timer.machine, "maincpu", 1, ASSERT_LINE); |
| 200 | 218 | timer.adjust(timer.machine->primary_screen->time_until_pos(param + 1), param+1); |
| 201 | interrupt_line_active = 1; | |
| 219 | state->interrupt_line_active = 1; | |
| 202 | 220 | } |
| 203 | 221 | else |
| 204 | 222 | { |
| 205 | if (interrupt_line_active) | |
| 223 | if (state->interrupt_line_active) | |
| 206 | 224 | cputag_set_input_line(timer.machine, "maincpu", 1, CLEAR_LINE); |
| 207 | 225 | timer.adjust(timer.machine->primary_screen->time_until_pos(interrupt_scanline), interrupt_scanline); |
| 208 | interrupt_line_active = 0; | |
| 226 | state->interrupt_line_active = 0; | |
| 209 | 227 | } |
| 210 | 228 | } |
| 211 | 229 | |
| 212 | 230 | static VIDEO_START( pkscramble ) |
| 213 | 231 | { |
| 214 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 215 | md_tilemap = tilemap_create(machine, get_md_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 216 | fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 232 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 233 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 234 | state->md_tilemap = tilemap_create(machine, get_md_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 235 | state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8,32,32); | |
| 217 | 236 | |
| 218 | tilemap_set_transparent_pen(md_tilemap,15); | |
| 219 | tilemap_set_transparent_pen(fg_tilemap,15); | |
| 237 | tilemap_set_transparent_pen(state->md_tilemap,15); | |
| 238 | tilemap_set_transparent_pen(state->fg_tilemap,15); | |
| 220 | 239 | } |
| 221 | 240 | |
| 222 | 241 | static SCREEN_UPDATE( pkscramble ) |
| 223 | 242 | { |
| 224 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); | |
| 225 | tilemap_draw(bitmap,cliprect,md_tilemap,0,0); | |
| 226 | tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); | |
| 243 | pkscram_state *state = screen->machine->driver_data<pkscram_state>(); | |
| 244 | tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0); | |
| 245 | tilemap_draw(bitmap,cliprect,state->md_tilemap,0,0); | |
| 246 | tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0); | |
| 227 | 247 | return 0; |
| 228 | 248 | } |
| 229 | 249 | |
| r10886 | r10887 | |
| 245 | 265 | |
| 246 | 266 | static void irqhandler(device_t *device, int irq) |
| 247 | 267 | { |
| 248 | if(out & 0x10) | |
| 268 | pkscram_state *state = device->machine->driver_data<pkscram_state>(); | |
| 269 | if(state->out & 0x10) | |
| 249 | 270 | cputag_set_input_line(device->machine, "maincpu", 2, irq ? ASSERT_LINE : CLEAR_LINE); |
| 250 | 271 | } |
| 251 | 272 | |
| r10886 | r10887 | |
| 261 | 282 | |
| 262 | 283 | static MACHINE_START( pkscramble) |
| 263 | 284 | { |
| 264 | state_save_register_global(machine, out); | |
| 265 | state_save_register_global(machine, interrupt_line_active); | |
| 285 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 286 | state_save_register_global(machine, state->out); | |
| 287 | state_save_register_global(machine, state->interrupt_line_active); | |
| 266 | 288 | } |
| 267 | 289 | |
| 268 | 290 | static MACHINE_RESET( pkscramble) |
| 269 | 291 | { |
| 270 | out = 0; | |
| 271 | interrupt_line_active=0; | |
| 292 | pkscram_state *state = machine->driver_data<pkscram_state>(); | |
| 293 | state->out = 0; | |
| 294 | state->interrupt_line_active=0; | |
| 272 | 295 | timer_device *scanline_timer = machine->device<timer_device>("scan_timer"); |
| 273 | 296 | scanline_timer->adjust(machine->primary_screen->time_until_pos(interrupt_scanline), interrupt_scanline); |
| 274 | 297 | } |
| 275 | 298 | |
| 276 | static MACHINE_CONFIG_START( pkscramble, | |
| 299 | static MACHINE_CONFIG_START( pkscramble, pkscram | |
| 277 | 300 | /* basic machine hardware */ |
| 278 | 301 | MCFG_CPU_ADD("maincpu", M68000, 8000000 ) |
| 279 | 302 | MCFG_CPU_PROGRAM_MAP(pkscramble_map) |
| r10886 | r10887 | |
|---|---|---|
| 31 | 31 | #include "machine/8255ppi.h" |
| 32 | 32 | #include "video/mc6845.h" |
| 33 | 33 | |
| 34 | static UINT8 *fortecar_ram; | |
| 35 | static int bank; | |
| 36 | 34 | |
| 35 | class fortecar_state : public driver_device | |
| 36 | { | |
| 37 | public: | |
| 38 | fortecar_state(running_machine &machine, const driver_device_config_base &config) | |
| 39 | : driver_device(machine, config) { } | |
| 40 | ||
| 41 | UINT8 *ram; | |
| 42 | int bank; | |
| 43 | }; | |
| 44 | ||
| 45 | ||
| 37 | 46 | static VIDEO_START(fortecar) |
| 38 | 47 | { |
| 39 | 48 | } |
| 40 | 49 | |
| 41 | 50 | static SCREEN_UPDATE(fortecar) |
| 42 | 51 | { |
| 52 | fortecar_state *state = screen->machine->driver_data<fortecar_state>(); | |
| 43 | 53 | int x,y,count; |
| 44 | 54 | count = 0; |
| 45 | 55 | |
| r10886 | r10887 | |
| 49 | 59 | { |
| 50 | 60 | int tile,color; |
| 51 | 61 | |
| 52 | tile = (fortecar_ram[(count*4)+1] | (fortecar_ram[(count*4)+2]<<8)) & 0xfff; | |
| 53 | color = fortecar_ram[(count*4)+3] & 3; | |
| 62 | tile = (state->ram[(count*4)+1] | (state->ram[(count*4)+2]<<8)) & 0xfff; | |
| 63 | color = state->ram[(count*4)+3] & 3; | |
| 54 | 64 | |
| 55 | 65 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8); |
| 56 | 66 | count++; |
| r10886 | r10887 | |
| 117 | 127 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 118 | 128 | AM_RANGE(0xc000, 0xc7ff) AM_ROM |
| 119 | 129 | AM_RANGE(0xd000, 0xd7ff) AM_RAM |
| 120 | AM_RANGE(0xd800, 0xffff) AM_RAM AM_BASE( | |
| 130 | AM_RANGE(0xd800, 0xffff) AM_RAM AM_BASE_MEMBER( | |
| 121 | 131 | ADDRESS_MAP_END |
| 122 | 132 | |
| 123 | 133 | static ADDRESS_MAP_START( fortecar_ports, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 244 | 254 | |
| 245 | 255 | static MACHINE_RESET(fortecar) |
| 246 | 256 | { |
| 247 | bank = -1; | |
| 257 | fortecar_state *state = machine->driver_data<fortecar_state>(); | |
| 258 | state->bank = -1; | |
| 248 | 259 | } |
| 249 | 260 | |
| 250 | 261 | /* WRONG, just to see something */ |
| r10886 | r10887 | |
| 277 | 288 | }; |
| 278 | 289 | |
| 279 | 290 | //51f |
| 280 | static MACHINE_CONFIG_START( fortecar, | |
| 291 | static MACHINE_CONFIG_START( fortecar, fort | |
| 281 | 292 | /* basic machine hardware */ |
| 282 | 293 | MCFG_CPU_ADD("maincpu", Z80,6000000) /* ? MHz */ |
| 283 | 294 | MCFG_CPU_PROGRAM_MAP(fortecar_map) |
| r10886 | r10887 | |
|---|---|---|
| 50 | 50 | #include "sound/okim6295.h" |
| 51 | 51 | #include "sound/ymz280b.h" |
| 52 | 52 | |
| 53 | static UINT16 *blit_buffer; | |
| 54 | 53 | |
| 54 | class gunpey_state : public driver_device | |
| 55 | { | |
| 56 | public: | |
| 57 | gunpey_state(running_machine &machine, const driver_device_config_base &config) | |
| 58 | : driver_device(machine, config) { } | |
| 59 | ||
| 60 | UINT16 *blit_buffer; | |
| 61 | UINT16 blit_ram[0x10]; | |
| 62 | }; | |
| 63 | ||
| 64 | ||
| 55 | 65 | static VIDEO_START( gunpey ) |
| 56 | 66 | { |
| 57 | blit_buffer = auto_alloc_array(machine, UINT16, 512*512); | |
| 67 | gunpey_state *state = machine->driver_data<gunpey_state>(); | |
| 68 | state->blit_buffer = auto_alloc_array(machine, UINT16, 512*512); | |
| 58 | 69 | } |
| 59 | 70 | |
| 60 | 71 | static SCREEN_UPDATE( gunpey ) |
| 61 | 72 | { |
| 73 | gunpey_state *state = screen->machine->driver_data<gunpey_state>(); | |
| 74 | UINT16 *blit_buffer = state->blit_buffer; | |
| 62 | 75 | int x,y; |
| 63 | 76 | int count; |
| 64 | 77 | |
| r10886 | r10887 | |
| 115 | 128 | |
| 116 | 129 | static WRITE8_HANDLER( gunpey_blitter_w ) |
| 117 | 130 | { |
| 118 | static UINT16 blit_ram[0x10]; | |
| 131 | gunpey_state *state = space->machine->driver_data<gunpey_state>(); | |
| 132 | UINT16 *blit_buffer = state->blit_buffer; | |
| 133 | UINT16 *blit_ram = state->blit_ram; | |
| 119 | 134 | UINT8 *blit_rom = space->machine->region("blit_data")->base(); |
| 120 | 135 | int x,y; |
| 121 | 136 | |
| r10886 | r10887 | |
| 313 | 328 | } |
| 314 | 329 | |
| 315 | 330 | /***************************************************************************************/ |
| 316 | static MACHINE_CONFIG_START( gunpey, | |
| 331 | static MACHINE_CONFIG_START( gunpey, gunpey_stat | |
| 317 | 332 | |
| 318 | 333 | /* basic machine hardware */ |
| 319 | 334 | MCFG_CPU_ADD("maincpu", V30, 57242400 / 4) |
| r10886 | r10887 | |
|---|---|---|
| 442 | 442 | #include "cpu/pic16c5x/pic16c5x.h" |
| 443 | 443 | #include "sound/saa1099.h" |
| 444 | 444 | |
| 445 | static UINT16 *blit_ram; | |
| 446 | 445 | |
| 446 | class bingor_state : public driver_device | |
| 447 | { | |
| 448 | public: | |
| 449 | bingor_state(running_machine &machine, const driver_device_config_base &config) | |
| 450 | : driver_device(machine, config) { } | |
| 451 | ||
| 452 | UINT16 *blit_ram; | |
| 453 | }; | |
| 454 | ||
| 455 | ||
| 447 | 456 | static VIDEO_START(bingor) |
| 448 | 457 | { |
| 449 | ||
| 450 | 458 | } |
| 451 | 459 | |
| 452 | 460 | static SCREEN_UPDATE(bingor) |
| 453 | 461 | { |
| 462 | bingor_state *state = screen->machine->driver_data<bingor_state>(); | |
| 454 | 463 | int x,y,count; |
| 455 | 464 | |
| 456 | 465 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| r10886 | r10887 | |
| 463 | 472 | { |
| 464 | 473 | UINT32 color; |
| 465 | 474 | |
| 466 | color = (blit_ram[count] & 0xf000)>>12; | |
| 475 | color = (state->blit_ram[count] & 0xf000)>>12; | |
| 467 | 476 | |
| 468 | 477 | if((x+3)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 469 | 478 | *BITMAP_ADDR32(bitmap, y, x+3) = screen->machine->pens[color]; |
| 470 | 479 | |
| 471 | color = (blit_ram[count] & 0x0f00)>>8; | |
| 480 | color = (state->blit_ram[count] & 0x0f00)>>8; | |
| 472 | 481 | |
| 473 | 482 | if((x+2)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 474 | 483 | *BITMAP_ADDR32(bitmap, y, x+2) = screen->machine->pens[color]; |
| 475 | 484 | |
| 476 | color = (blit_ram[count] & 0x00f0)>>4; | |
| 485 | color = (state->blit_ram[count] & 0x00f0)>>4; | |
| 477 | 486 | |
| 478 | 487 | if((x+1)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 479 | 488 | *BITMAP_ADDR32(bitmap, y, x+1) = screen->machine->pens[color]; |
| 480 | 489 | |
| 481 | color = (blit_ram[count] & 0x000f)>>0; | |
| 490 | color = (state->blit_ram[count] & 0x000f)>>0; | |
| 482 | 491 | |
| 483 | 492 | if((x+0)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 484 | 493 | *BITMAP_ADDR32(bitmap, y, x+0) = screen->machine->pens[color]; |
| r10886 | r10887 | |
| 501 | 510 | AM_RANGE(0x00000, 0x0ffff) AM_RAM |
| 502 | 511 | AM_RANGE(0x90000, 0x9ffff) AM_ROM AM_REGION("gfx", 0) |
| 503 | 512 | AM_RANGE(0xa0300, 0xa031f) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBIIII_word_w) AM_BASE_GENERIC(paletteram) //wrong |
| 504 | AM_RANGE(0xa0000, 0xaffff) AM_RAM AM_BASE( | |
| 513 | AM_RANGE(0xa0000, 0xaffff) AM_RAM AM_BASE_MEMBER(bingor_state, blit_ram) | |
| 505 | 514 | AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0) |
| 506 | 515 | ADDRESS_MAP_END |
| 507 | 516 | |
| r10886 | r10887 | |
| 602 | 611 | GFXDECODE_END |
| 603 | 612 | |
| 604 | 613 | |
| 605 | static MACHINE_CONFIG_START( bingor, | |
| 614 | static MACHINE_CONFIG_START( bingor, b | |
| 606 | 615 | MCFG_CPU_ADD("maincpu", I80186, 14000000 ) //?? Mhz |
| 607 | 616 | MCFG_CPU_PROGRAM_MAP(bingor_map) |
| 608 | 617 | MCFG_CPU_IO_MAP(bingor_io) |
| r10886 | r10887 | |
|---|---|---|
| 56 | 56 | #include "sound/2151intf.h" |
| 57 | 57 | #include "machine/eeprom.h" |
| 58 | 58 | |
| 59 | static UINT16 *gms_vidram; | |
| 60 | static UINT16 *gms_vidram2; | |
| 61 | 59 | |
| 62 | static UINT16 tilebank=0; | |
| 60 | class rbmk_state : public driver_device | |
| 61 | { | |
| 62 | public: | |
| 63 | rbmk_state(running_machine &machine, const driver_device_config_base &config) | |
| 64 | : driver_device(machine, config) { } | |
| 63 | 65 | |
| 66 | UINT16 *gms_vidram; | |
| 67 | UINT16 *gms_vidram2; | |
| 68 | UINT16 tilebank; | |
| 69 | UINT8 mux_data; | |
| 70 | }; | |
| 71 | ||
| 72 | ||
| 64 | 73 | static READ16_HANDLER( gms_read ) |
| 65 | 74 | { |
| 66 | 75 | return space->machine->rand(); |
| r10886 | r10887 | |
| 74 | 83 | |
| 75 | 84 | static WRITE16_HANDLER( gms_write2 ) |
| 76 | 85 | { |
| 77 | tilebank=data; | |
| 86 | rbmk_state *state = space->machine->driver_data<rbmk_state>(); | |
| 87 | state->tilebank=data; | |
| 78 | 88 | } |
| 79 | 89 | |
| 80 | 90 | static WRITE16_HANDLER( gms_write3 ) |
| r10886 | r10887 | |
| 99 | 109 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 100 | 110 | AM_RANGE(0x100000, 0x10ffff) AM_RAM |
| 101 | 111 | AM_RANGE(0x500000, 0x50ffff) AM_RAM |
| 102 | AM_RANGE(0x940000, 0x940fff) AM_RAM AM_BASE( | |
| 112 | AM_RANGE(0x940000, 0x940fff) AM_RAM AM_BASE_MEMBER(rbmk_state, gms_vidram2) | |
| 103 | 113 | AM_RANGE(0x980300, 0x983fff) AM_RAM // 0x2048 words ???, byte access |
| 104 | 114 | AM_RANGE(0x900000, 0x900fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 105 | AM_RANGE(0x9c0000, 0x9c0fff) AM_RAM AM_BASE( | |
| 115 | AM_RANGE(0x9c0000, 0x9c0fff) AM_RAM AM_BASE_MEMBER(rbmk_state, gms_vidram) | |
| 106 | 116 | AM_RANGE(0xb00000, 0xb00001) AM_DEVWRITE("eeprom", eeprom_w) |
| 107 | 117 | AM_RANGE(0xC00000, 0xC00001) AM_READ_PORT("IN0") AM_WRITE(gms_write1) |
| 108 | 118 | AM_RANGE(0xC08000, 0xC08001) AM_READ_PORT("IN1") AM_WRITE(gms_write2) |
| r10886 | r10887 | |
| 112 | 122 | AM_RANGE(0xC28000, 0xC28001) AM_WRITE(gms_write3) |
| 113 | 123 | ADDRESS_MAP_END |
| 114 | 124 | |
| 115 | static UINT8 mux_data; | |
| 116 | 125 | |
| 117 | 126 | static ADDRESS_MAP_START( rbmk_mcu_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 118 | 127 | // AM_RANGE(0x0000, 0x0fff) AM_ROM |
| r10886 | r10887 | |
| 120 | 129 | |
| 121 | 130 | static READ8_HANDLER( rbmk_mcu_io_r ) |
| 122 | 131 | { |
| 123 | if(mux_data & 8) | |
| 132 | rbmk_state *state = space->machine->driver_data<rbmk_state>(); | |
| 133 | if(state->mux_data & 8) | |
| 124 | 134 | { |
| 125 | 135 | return ym2151_r(space->machine->device("ymsnd"), offset & 1); |
| 126 | 136 | } |
| 127 | else if(mux_data & 4) | |
| 137 | else if(state->mux_data & 4) | |
| 128 | 138 | { |
| 129 | 139 | //printf("%02x R\n",offset); |
| 130 | 140 | // ... |
| 131 | 141 | return 0xff; |
| 132 | 142 | } |
| 133 | 143 | else |
| 134 | printf("Warning: mux data R = %02x",mux_data); | |
| 144 | printf("Warning: mux data R = %02x",state->mux_data); | |
| 135 | 145 | |
| 136 | 146 | return 0xff; |
| 137 | 147 | } |
| 138 | 148 | |
| 139 | 149 | static WRITE8_HANDLER( rbmk_mcu_io_w ) |
| 140 | 150 | { |
| 141 | if(mux_data & 8) { ym2151_w(space->machine->device("ymsnd"), offset & 1, data); } | |
| 142 | else if(mux_data & 4) | |
| 151 | rbmk_state *state = space->machine->driver_data<rbmk_state>(); | |
| 152 | if(state->mux_data & 8) { ym2151_w(space->machine->device("ymsnd"), offset & 1, data); } | |
| 153 | else if(state->mux_data & 4) | |
| 143 | 154 | { |
| 144 | 155 | //printf("%02x %02x W\n",offset,data); |
| 145 | 156 | // ... |
| 146 | 157 | } |
| 147 | 158 | else |
| 148 | printf("Warning: mux data W = %02x",mux_data); | |
| 159 | printf("Warning: mux data W = %02x",state->mux_data); | |
| 149 | 160 | } |
| 150 | 161 | |
| 151 | 162 | static WRITE8_HANDLER( mcu_io_mux_w ) |
| 152 | 163 | { |
| 153 | mux_data = ~data; | |
| 164 | rbmk_state *state = space->machine->driver_data<rbmk_state>(); | |
| 165 | state->mux_data = ~data; | |
| 154 | 166 | } |
| 155 | 167 | |
| 156 | 168 | static ADDRESS_MAP_START( rbmk_mcu_io, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 480 | 492 | |
| 481 | 493 | static SCREEN_UPDATE(rbmk) |
| 482 | 494 | { |
| 495 | rbmk_state *state = screen->machine->driver_data<rbmk_state>(); | |
| 483 | 496 | int x,y; |
| 484 | 497 | int count = 0; |
| 485 | 498 | |
| r10886 | r10887 | |
| 487 | 500 | { |
| 488 | 501 | for (x=0;x<64;x++) |
| 489 | 502 | { |
| 490 | int tile = gms_vidram2[count+0x600]; | |
| 491 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],(tile&0xfff)+((tilebank&0x10)>>4)*0x1000,tile>>12,0,0,x*8,y*32); | |
| 503 | int tile = state->gms_vidram2[count+0x600]; | |
| 504 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],(tile&0xfff)+((state->tilebank&0x10)>>4)*0x1000,tile>>12,0,0,x*8,y*32); | |
| 492 | 505 | count++; |
| 493 | 506 | } |
| 494 | 507 | } |
| r10886 | r10887 | |
| 499 | 512 | { |
| 500 | 513 | for (x=0;x<64;x++) |
| 501 | 514 | { |
| 502 | int tile = gms_vidram[count]; | |
| 503 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[1],(tile&0xfff)+((tilebank>>1)&3)*0x1000,tile>>12,0,0,x*8,y*8,0); | |
| 515 | int tile = state->gms_vidram[count]; | |
| 516 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[1],(tile&0xfff)+((state->tilebank>>1)&3)*0x1000,tile>>12,0,0,x*8,y*8,0); | |
| 504 | 517 | count++; |
| 505 | 518 | } |
| 506 | 519 | } |
| r10886 | r10887 | |
| 512 | 525 | cputag_set_input_line(device->machine, "mcu", INPUT_LINE_NMI, PULSE_LINE); |
| 513 | 526 | } |
| 514 | 527 | |
| 515 | static MACHINE_CONFIG_START( rbmk, | |
| 528 | static MACHINE_CONFIG_START( rbmk, | |
| 516 | 529 | MCFG_CPU_ADD("maincpu", M68000, 22000000 /2) |
| 517 | 530 | MCFG_CPU_PROGRAM_MAP(rbmk_mem) |
| 518 | 531 | MCFG_CPU_VBLANK_INT("screen", irq1_line_hold) |
| r10886 | r10887 | |
|---|---|---|
| 64 | 64 | #include "cpu/z80/z80.h" |
| 65 | 65 | #include "sound/ay8910.h" |
| 66 | 66 | |
| 67 | static tilemap_t *bg_tilemap; | |
| 68 | static UINT8 *trvmadns_gfxram; | |
| 69 | static UINT8 *trvmadns_tileram; | |
| 70 | static int old_data; | |
| 71 | 67 | |
| 68 | class trvmadns_state : public driver_device | |
| 69 | { | |
| 70 | public: | |
| 71 | trvmadns_state(running_machine &machine, const driver_device_config_base &config) | |
| 72 | : driver_device(machine, config) { } | |
| 73 | ||
| 74 | tilemap_t *bg_tilemap; | |
| 75 | UINT8 *gfxram; | |
| 76 | UINT8 *tileram; | |
| 77 | int old_data; | |
| 78 | }; | |
| 79 | ||
| 80 | ||
| 72 | 81 | static WRITE8_HANDLER( trvmadns_banking_w ) |
| 73 | 82 | { |
| 83 | trvmadns_state *state = space->machine->driver_data<trvmadns_state>(); | |
| 74 | 84 | |
| 75 | 85 | UINT8 *rom; |
| 76 | 86 | int address = 0; |
| r10886 | r10887 | |
| 102 | 112 | } |
| 103 | 113 | else |
| 104 | 114 | { |
| 105 | if(data != old_data) | |
| 115 | if(data != state->old_data) | |
| 106 | 116 | { |
| 107 | old_data = data; | |
| 117 | state->old_data = data; | |
| 108 | 118 | logerror("port80 = %02X\n",data); |
| 109 | 119 | //logerror("port80 = %02X\n",data); |
| 110 | 120 | } |
| r10886 | r10887 | |
| 143 | 153 | |
| 144 | 154 | static WRITE8_HANDLER( trvmadns_gfxram_w ) |
| 145 | 155 | { |
| 146 | trvmadns_gfxram[offset] = data; | |
| 156 | trvmadns_state *state = space->machine->driver_data<trvmadns_state>(); | |
| 157 | state->gfxram[offset] = data; | |
| 147 | 158 | gfx_element_mark_dirty(space->machine->gfx[0], offset/16); |
| 148 | 159 | } |
| 149 | 160 | |
| r10886 | r10887 | |
| 180 | 191 | |
| 181 | 192 | static WRITE8_HANDLER( trvmadns_tileram_w ) |
| 182 | 193 | { |
| 194 | trvmadns_state *state = space->machine->driver_data<trvmadns_state>(); | |
| 183 | 195 | if(offset==0) |
| 184 | 196 | { |
| 185 | 197 | if(cpu_get_previouspc(space->cpu)==0x29e9)// || cpu_get_previouspc(space->cpu)==0x1b3f) //29f5 |
| r10886 | r10887 | |
| 191 | 203 | |
| 192 | 204 | } |
| 193 | 205 | |
| 194 | trvmadns_tileram[offset] = data; | |
| 195 | tilemap_mark_tile_dirty(bg_tilemap,offset >> 1); | |
| 206 | state->tileram[offset] = data; | |
| 207 | tilemap_mark_tile_dirty(state->bg_tilemap,offset >> 1); | |
| 196 | 208 | } |
| 197 | 209 | |
| 198 | 210 | |
| r10886 | r10887 | |
| 200 | 212 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 201 | 213 | AM_RANGE(0x6000, 0x6fff) AM_ROMBANK("bank1") |
| 202 | 214 | AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("bank2") |
| 203 | AM_RANGE(0x6000, 0x7fff) AM_WRITE(trvmadns_gfxram_w) AM_BASE( | |
| 215 | AM_RANGE(0x6000, 0x7fff) AM_WRITE(trvmadns_gfxram_w) AM_BASE_MEMBER( | |
| 204 | 216 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 205 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(trvmadns_tileram_w) AM_BASE( | |
| 217 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(trvmadns_tileram_w) AM_BASE_MEMBER( | |
| 206 | 218 | AM_RANGE(0xc000, 0xc01f) AM_RAM_WRITE(trvmadns_palette_w) AM_BASE_GENERIC(paletteram) |
| 207 | 219 | AM_RANGE(0xe000, 0xe000) AM_WRITE(w2)//NOP |
| 208 | 220 | AM_RANGE(0xe004, 0xe004) AM_WRITE(w3)//NOP |
| r10886 | r10887 | |
| 244 | 256 | |
| 245 | 257 | static TILE_GET_INFO( get_bg_tile_info ) |
| 246 | 258 | { |
| 259 | trvmadns_state *state = machine->driver_data<trvmadns_state>(); | |
| 247 | 260 | int tile,attr,color,flag; |
| 248 | 261 | |
| 249 | attr = trvmadns_tileram[tile_index*2 + 0]; | |
| 250 | tile = trvmadns_tileram[tile_index*2 + 1] + ((attr & 0x01) << 8); | |
| 262 | attr = state->tileram[tile_index*2 + 0]; | |
| 263 | tile = state->tileram[tile_index*2 + 1] + ((attr & 0x01) << 8); | |
| 251 | 264 | color = (attr & 0x18) >> 3; |
| 252 | 265 | flag = TILE_FLIPXY((attr & 0x06) >> 1); |
| 253 | 266 | |
| r10886 | r10887 | |
| 264 | 277 | |
| 265 | 278 | static VIDEO_START( trvmadns ) |
| 266 | 279 | { |
| 267 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 280 | trvmadns_state *state = machine->driver_data<trvmadns_state>(); | |
| 281 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 268 | 282 | |
| 269 | 283 | // tilemap_set_transparent_pen(fg_tilemap,1); |
| 270 | 284 | |
| 271 | gfx_element_set_source(machine->gfx[0], t | |
| 285 | gfx_element_set_source(machine->gfx[0], st | |
| 272 | 286 | } |
| 273 | 287 | |
| 274 | 288 | static SCREEN_UPDATE( trvmadns ) |
| 275 | 289 | { |
| 290 | trvmadns_state *state = screen->machine->driver_data<trvmadns_state>(); | |
| 276 | 291 | int x,y,count; |
| 277 | 292 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 278 | 293 | |
| r10886 | r10887 | |
| 284 | 299 | { |
| 285 | 300 | for (x=0;x<32;x++) |
| 286 | 301 | { |
| 287 | int attr = trvmadns_tileram[count*2+0]; | |
| 288 | int tile = trvmadns_tileram[count*2+1] | ((attr & 0x01) << 8); | |
| 302 | int attr = state->tileram[count*2+0]; | |
| 303 | int tile = state->tileram[count*2+1] | ((attr & 0x01) << 8); | |
| 289 | 304 | int color = (attr & 0x18) >> 3; |
| 290 | 305 | int flipx = attr & 4; |
| 291 | 306 | int flipy = attr & 2; |
| r10886 | r10887 | |
| 302 | 317 | { |
| 303 | 318 | for (x=0;x<32;x++) |
| 304 | 319 | { |
| 305 | int attr = trvmadns_tileram[count*2+0]; | |
| 306 | int tile = trvmadns_tileram[count*2+1] | ((attr & 0x01) << 8); | |
| 320 | int attr = state->tileram[count*2+0]; | |
| 321 | int tile = state->tileram[count*2+1] | ((attr & 0x01) << 8); | |
| 307 | 322 | int color = (attr & 0x18) >> 3; |
| 308 | 323 | int flipx = attr & 4; |
| 309 | 324 | int flipy = attr & 2; |
| r10886 | r10887 | |
| 319 | 334 | |
| 320 | 335 | static MACHINE_RESET( trvmadns ) |
| 321 | 336 | { |
| 322 | old_data = -1; | |
| 337 | trvmadns_state *state = machine->driver_data<trvmadns_state>(); | |
| 338 | state->old_data = -1; | |
| 323 | 339 | } |
| 324 | 340 | |
| 325 | static MACHINE_CONFIG_START( trvmadns, | |
| 341 | static MACHINE_CONFIG_START( trvmadns, tr | |
| 326 | 342 | MCFG_CPU_ADD("maincpu", Z80,10000000/2) // ? |
| 327 | 343 | MCFG_CPU_PROGRAM_MAP(cpu_map) |
| 328 | 344 | MCFG_CPU_IO_MAP(io_map) |
| r10886 | r10887 | |
|---|---|---|
| 25 | 25 | #include "machine/nvram.h" |
| 26 | 26 | |
| 27 | 27 | |
| 28 | class cubeqst_state : public driver_device | |
| 29 | { | |
| 30 | public: | |
| 31 | cubeqst_state(running_machine &machine, const driver_device_config_base &config) | |
| 32 | : driver_device(machine, config) { } | |
| 33 | ||
| 34 | UINT8 *depth_buffer; | |
| 35 | int video_field; | |
| 36 | UINT8 io_latch; | |
| 37 | UINT8 reset_latch; | |
| 38 | device_t *laserdisc; | |
| 39 | rgb_t *colormap; | |
| 40 | }; | |
| 41 | ||
| 42 | ||
| 43 | ||
| 28 | 44 | /************************************* |
| 29 | 45 | * |
| 30 | 46 | * Constants |
| r10886 | r10887 | |
| 38 | 54 | |
| 39 | 55 | /************************************* |
| 40 | 56 | * |
| 41 | * Statics | |
| 42 | * | |
| 43 | *************************************/ | |
| 44 | ||
| 45 | static UINT8 *depth_buffer; | |
| 46 | static int video_field; | |
| 47 | ||
| 48 | static UINT8 io_latch; | |
| 49 | static UINT8 reset_latch; | |
| 50 | ||
| 51 | static device_t *laserdisc; | |
| 52 | static rgb_t *colormap; | |
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | /************************************* | |
| 57 | * | |
| 58 | 57 | * Video (move to separate file) |
| 59 | 58 | * |
| 60 | 59 | *************************************/ |
| r10886 | r10887 | |
| 63 | 62 | |
| 64 | 63 | static VIDEO_START( cubeqst ) |
| 65 | 64 | { |
| 66 | video_field = 0; | |
| 67 | depth_buffer = auto_alloc_array(machine, UINT8, 512); | |
| 65 | cubeqst_state *state = machine->driver_data<cubeqst_state>(); | |
| 66 | state->video_field = 0; | |
| 67 | state->depth_buffer = auto_alloc_array(machine, UINT8, 512); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /* TODO: Use resistor values */ |
| 71 | 71 | static PALETTE_INIT( cubeqst ) |
| 72 | 72 | { |
| 73 | cubeqst_state *state = machine->driver_data<cubeqst_state>(); | |
| 73 | 74 | int i; |
| 74 | 75 | |
| 75 | colormap = auto_alloc_array(machine, rgb_t, 65536); | |
| 76 | state->colormap = auto_alloc_array(machine, rgb_t, 65536); | |
| 76 | 77 | for (i = 0; i < 65536; ++i) |
| 77 | 78 | { |
| 78 | 79 | UINT8 a, r, g, b, y; |
| r10886 | r10887 | |
| 83 | 84 | r = (i >> 8) & 7; |
| 84 | 85 | y = ((i >> 12) & 0xf) * 2; |
| 85 | 86 | |
| 86 | colormap[i] = MAKE_ARGB(a ? 0 : 255, y*r, y*g, y*b); | |
| 87 | state->colormap[i] = MAKE_ARGB(a ? 0 : 255, y*r, y*g, y*b); | |
| 87 | 88 | } |
| 88 | 89 | } |
| 89 | 90 | |
| r10886 | r10887 | |
| 96 | 97 | /* TODO: This is a simplified version of what actually happens */ |
| 97 | 98 | static SCREEN_UPDATE( cubeqst ) |
| 98 | 99 | { |
| 100 | cubeqst_state *state = screen->machine->driver_data<cubeqst_state>(); | |
| 99 | 101 | int y; |
| 100 | 102 | |
| 101 | 103 | /* |
| r10886 | r10887 | |
| 104 | 106 | */ |
| 105 | 107 | |
| 106 | 108 | /* Bit 3 selects LD/#GRAPHICS */ |
| 107 | bitmap_fill(bitmap, cliprect, colormap[255]); | |
| 109 | bitmap_fill(bitmap, cliprect, state->colormap[255]); | |
| 108 | 110 | |
| 109 | 111 | /* TODO: Add 1 for linebuffering? */ |
| 110 | 112 | for (y = cliprect->min_y; y <= cliprect->max_y; ++y) |
| r10886 | r10887 | |
| 116 | 118 | UINT32 pen; |
| 117 | 119 | |
| 118 | 120 | /* Zap the depth buffer */ |
| 119 | memset(depth_buffer, 0xff, 512); | |
| 121 | memset(state->depth_buffer, 0xff, 512); | |
| 120 | 122 | |
| 121 | 123 | /* Process all the spans on this scanline */ |
| 122 | 124 | if (y < 256) |
| r10886 | r10887 | |
| 153 | 155 | } |
| 154 | 156 | |
| 155 | 157 | /* Draw the span, testing for depth */ |
| 156 | pen = colormap[screen->machine->generic.paletteram.u16[color]]; | |
| 158 | pen = state->colormap[screen->machine->generic.paletteram.u16[color]]; | |
| 157 | 159 | for (x = h1; x <= h2; ++x) |
| 158 | 160 | { |
| 159 | if (!(depth_buffer[x] < depth)) | |
| 161 | if (!(state->depth_buffer[x] < depth)) | |
| 160 | 162 | { |
| 161 | 163 | dest[x] = pen; |
| 162 | depth_buffer[x] = depth; | |
| 164 | state->depth_buffer[x] = depth; | |
| 163 | 165 | } |
| 164 | 166 | } |
| 165 | 167 | } |
| r10886 | r10887 | |
| 177 | 179 | |
| 178 | 180 | static INTERRUPT_GEN( vblank ) |
| 179 | 181 | { |
| 180 | int int_level = video_field == 0 ? 5 : 6; | |
| 182 | cubeqst_state *state = device->machine->driver_data<cubeqst_state>(); | |
| 183 | int int_level = state->video_field == 0 ? 5 : 6; | |
| 181 | 184 | |
| 182 | 185 | cpu_set_input_line(device, int_level, HOLD_LINE); |
| 183 | 186 | |
| 184 | 187 | /* Update the laserdisc */ |
| 185 | video_field ^= 1; | |
| 188 | state->video_field ^= 1; | |
| 186 | 189 | } |
| 187 | 190 | |
| 188 | 191 | |
| r10886 | r10887 | |
| 194 | 197 | |
| 195 | 198 | static WRITE16_HANDLER( laserdisc_w ) |
| 196 | 199 | { |
| 197 | laserdisc_data_w(laserdisc, data & 0xff); | |
| 200 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 201 | laserdisc_data_w(state->laserdisc, data & 0xff); | |
| 198 | 202 | } |
| 199 | 203 | |
| 200 | 204 | /* |
| r10886 | r10887 | |
| 203 | 207 | */ |
| 204 | 208 | static READ16_HANDLER( laserdisc_r ) |
| 205 | 209 | { |
| 206 | int ldp_command_flag = (laserdisc_line_r(laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1; | |
| 207 | int ldp_seek_status = (laserdisc_line_r(laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 1 : 0; | |
| 210 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 211 | int ldp_command_flag = (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1; | |
| 212 | int ldp_seek_status = (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 1 : 0; | |
| 208 | 213 | |
| 209 | 214 | return (ldp_seek_status << 1) | ldp_command_flag; |
| 210 | 215 | } |
| r10886 | r10887 | |
| 213 | 218 | /* LDP audio squelch control */ |
| 214 | 219 | static WRITE16_HANDLER( ldaud_w ) |
| 215 | 220 | { |
| 216 | simutrek_set_audio_squelch(laserdisc, data & 1 ? ASSERT_LINE : CLEAR_LINE); | |
| 221 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 222 | simutrek_set_audio_squelch(state->laserdisc, data & 1 ? ASSERT_LINE : CLEAR_LINE); | |
| 217 | 223 | } |
| 218 | 224 | |
| 219 | 225 | /* |
| r10886 | r10887 | |
| 228 | 234 | */ |
| 229 | 235 | static WRITE16_HANDLER( control_w ) |
| 230 | 236 | { |
| 231 | laserdisc_video_enable(laserdisc, data & 1); | |
| 237 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 238 | laserdisc_video_enable(state->laserdisc, data & 1); | |
| 232 | 239 | } |
| 233 | 240 | |
| 234 | 241 | |
| r10886 | r10887 | |
| 264 | 271 | */ |
| 265 | 272 | static WRITE16_HANDLER( reset_w ) |
| 266 | 273 | { |
| 274 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 267 | 275 | cputag_set_input_line(space->machine, "rotate_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE); |
| 268 | 276 | cputag_set_input_line(space->machine, "line_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE); |
| 269 | 277 | cputag_set_input_line(space->machine, "sound_cpu", INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE); |
| 270 | 278 | |
| 271 | 279 | /* Swap stack and pointer RAM banks on rising edge of display reset */ |
| 272 | if (!BIT(reset_latch, 0) && BIT(data, 0)) | |
| 280 | if (!BIT(state->reset_latch, 0) && BIT(data, 0)) | |
| 273 | 281 | swap_linecpu_banks(space->machine); |
| 274 | 282 | |
| 275 | 283 | if (!BIT(data, 2)) |
| 276 | laserdisc->reset(); | |
| 284 | state->laserdisc->reset(); | |
| 277 | 285 | |
| 278 | reset_latch = data & 0xff; | |
| 286 | state->reset_latch = data & 0xff; | |
| 279 | 287 | } |
| 280 | 288 | |
| 281 | 289 | |
| r10886 | r10887 | |
| 287 | 295 | |
| 288 | 296 | static WRITE16_HANDLER( io_w ) |
| 289 | 297 | { |
| 298 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 290 | 299 | /* |
| 291 | 300 | 0: Spare lamp |
| 292 | 301 | 1: Spare driver |
| r10886 | r10887 | |
| 299 | 308 | */ |
| 300 | 309 | |
| 301 | 310 | /* TODO: On rising edge of Q7, status LED latch is written */ |
| 302 | if ( !BIT(io_latch, 7) && BIT(data, 7) ) | |
| 311 | if ( !BIT(state->io_latch, 7) && BIT(data, 7) ) | |
| 303 | 312 | { |
| 304 | 313 | /* |
| 305 | 314 | 0: Battery failure |
| r10886 | r10887 | |
| 308 | 317 | */ |
| 309 | 318 | } |
| 310 | 319 | |
| 311 | io_latch = data; | |
| 320 | state->io_latch = data; | |
| 312 | 321 | } |
| 313 | 322 | |
| 314 | 323 | static READ16_HANDLER( io_r ) |
| 315 | 324 | { |
| 325 | cubeqst_state *state = space->machine->driver_data<cubeqst_state>(); | |
| 316 | 326 | UINT16 port_data = input_port_read(space->machine, "IO"); |
| 317 | 327 | |
| 318 | 328 | /* |
| r10886 | r10887 | |
| 324 | 334 | 10: Spare / Trackball V data |
| 325 | 335 | */ |
| 326 | 336 | |
| 327 | if ( !BIT(io_latch, 7) ) | |
| 337 | if ( !BIT(state->io_latch, 7) ) | |
| 328 | 338 | return port_data; |
| 329 | 339 | else |
| 330 | 340 | /* Return zeroes for the trackball signals for now */ |
| r10886 | r10887 | |
| 427 | 437 | |
| 428 | 438 | static MACHINE_START( cubeqst ) |
| 429 | 439 | { |
| 430 | laserdisc = machine->device("laserdisc"); | |
| 440 | cubeqst_state *state = machine->driver_data<cubeqst_state>(); | |
| 441 | state->laserdisc = machine->device("laserdisc"); | |
| 431 | 442 | } |
| 432 | 443 | |
| 433 | 444 | static MACHINE_RESET( cubeqst ) |
| 434 | 445 | { |
| 435 | reset_latch = 0; | |
| 446 | cubeqst_state *state = machine->driver_data<cubeqst_state>(); | |
| 447 | state->reset_latch = 0; | |
| 436 | 448 | |
| 437 | 449 | /* Auxillary CPUs are held in reset */ |
| 438 | 450 | cputag_set_input_line(machine, "sound_cpu", INPUT_LINE_RESET, ASSERT_LINE); |
| r10886 | r10887 | |
| 493 | 505 | * |
| 494 | 506 | *************************************/ |
| 495 | 507 | |
| 496 | static MACHINE_CONFIG_START( cubeqst, | |
| 508 | static MACHINE_CONFIG_START( cubeqst, cub | |
| 497 | 509 | MCFG_CPU_ADD("main_cpu", M68000, XTAL_16MHz / 2) |
| 498 | 510 | MCFG_CPU_PROGRAM_MAP(m68k_program_map) |
| 499 | 511 | MCFG_CPU_VBLANK_INT("screen", vblank) |
| r10886 | r10887 | |
|---|---|---|
| 17 | 17 | #include "cpu/m6502/m6502.h" |
| 18 | 18 | #include "sound/ay8910.h" |
| 19 | 19 | |
| 20 | static UINT8 *ltcasino_tile_num_ram, *ltcasino_tile_atr_ram; | |
| 21 | 20 | |
| 22 | static tilemap_t *ltcasino_tilemap; | |
| 21 | class ltcasino_state : public driver_device | |
| 22 | { | |
| 23 | public: | |
| 24 | ltcasino_state(running_machine &machine, const driver_device_config_base &config) | |
| 25 | : driver_device(machine, config) { } | |
| 23 | 26 | |
| 27 | UINT8 *tile_num_ram; | |
| 28 | UINT8 *tile_atr_ram; | |
| 29 | tilemap_t *tilemap; | |
| 30 | }; | |
| 31 | ||
| 32 | ||
| 24 | 33 | /* Video */ |
| 25 | 34 | |
| 26 | 35 | static TILE_GET_INFO( get_ltcasino_tile_info ) |
| 27 | 36 | { |
| 37 | ltcasino_state *state = machine->driver_data<ltcasino_state>(); | |
| 28 | 38 | int tileno, colour; |
| 29 | 39 | |
| 30 | tileno = ltcasino_tile_num_ram[tile_index]; | |
| 31 | colour = ltcasino_tile_atr_ram[tile_index]; | |
| 40 | tileno = state->tile_num_ram[tile_index]; | |
| 41 | colour = state->tile_atr_ram[tile_index]; | |
| 32 | 42 | |
| 33 | 43 | tileno += (colour & 0x80) << 1; |
| 34 | 44 | |
| r10886 | r10887 | |
| 37 | 47 | |
| 38 | 48 | static VIDEO_START(ltcasino) |
| 39 | 49 | { |
| 40 | ltcasino_tilemap = tilemap_create(machine, get_ltcasino_tile_info,tilemap_scan_rows,8, 8,64,32); | |
| 50 | ltcasino_state *state = machine->driver_data<ltcasino_state>(); | |
| 51 | state->tilemap = tilemap_create(machine, get_ltcasino_tile_info,tilemap_scan_rows,8, 8,64,32); | |
| 41 | 52 | } |
| 42 | 53 | |
| 43 | 54 | |
| 44 | 55 | static WRITE8_HANDLER( ltcasino_tile_num_w ) |
| 45 | 56 | { |
| 46 | ltcasino_tile_num_ram[offset] = data; | |
| 47 | tilemap_mark_tile_dirty(ltcasino_tilemap,offset); | |
| 57 | ltcasino_state *state = space->machine->driver_data<ltcasino_state>(); | |
| 58 | state->tile_num_ram[offset] = data; | |
| 59 | tilemap_mark_tile_dirty(state->tilemap,offset); | |
| 48 | 60 | } |
| 49 | 61 | |
| 50 | 62 | static WRITE8_HANDLER( ltcasino_tile_atr_w ) |
| 51 | 63 | { |
| 52 | ltcasino_tile_atr_ram[offset] = data; | |
| 53 | tilemap_mark_tile_dirty(ltcasino_tilemap,offset); | |
| 64 | ltcasino_state *state = space->machine->driver_data<ltcasino_state>(); | |
| 65 | state->tile_atr_ram[offset] = data; | |
| 66 | tilemap_mark_tile_dirty(state->tilemap,offset); | |
| 54 | 67 | } |
| 55 | 68 | |
| 56 | 69 | |
| 57 | 70 | static ADDRESS_MAP_START( ltcasino_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 58 | 71 | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 59 | 72 | AM_RANGE(0x8000, 0xcfff) AM_ROM |
| 60 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ltcasino_tile_num_w) AM_BASE( | |
| 73 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ltcasino_tile_num_w) AM_BASE_MEMBER( | |
| 61 | 74 | AM_RANGE(0xd800, 0xdfff) AM_RAM |
| 62 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ltcasino_tile_atr_w) AM_BASE( | |
| 75 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ltcasino_tile_atr_w) AM_BASE_MEMBER( | |
| 63 | 76 | AM_RANGE(0xe800, 0xebff) AM_RAM |
| 64 | 77 | |
| 65 | 78 | AM_RANGE(0xec00, 0xec00) AM_READ_PORT("IN0") |
| r10886 | r10887 | |
| 621 | 634 | |
| 622 | 635 | static SCREEN_UPDATE(ltcasino) |
| 623 | 636 | { |
| 624 | tilemap_draw(bitmap,cliprect,ltcasino_tilemap,0,0); | |
| 637 | ltcasino_state *state = screen->machine->driver_data<ltcasino_state>(); | |
| 638 | tilemap_draw(bitmap,cliprect,state->tilemap,0,0); | |
| 625 | 639 | return 0; |
| 626 | 640 | } |
| 627 | 641 | |
| 628 | 642 | |
| 629 | static MACHINE_CONFIG_START( ltcasino, | |
| 643 | static MACHINE_CONFIG_START( ltcasino, ltcasino | |
| 630 | 644 | /* basic machine hardware */ |
| 631 | 645 | MCFG_CPU_ADD("maincpu", M6502,2000000) /* ? MHz */ |
| 632 | 646 | MCFG_CPU_PROGRAM_MAP(ltcasino_map) |
| r10886 | r10887 | |
|---|---|---|
| 292 | 292 | #include "sound/discrete.h" |
| 293 | 293 | |
| 294 | 294 | |
| 295 | class blitz_state : public driver_device | |
| 296 | { | |
| 297 | public: | |
| 298 | blitz_state(running_machine &machine, const driver_device_config_base &config) | |
| 299 | : driver_device(machine, config) { } | |
| 300 | ||
| 301 | UINT8 *videoram; | |
| 302 | UINT8 *colorram; | |
| 303 | tilemap_t *bg_tilemap; | |
| 304 | int mux_data; | |
| 305 | }; | |
| 306 | ||
| 307 | ||
| 308 | ||
| 295 | 309 | /********************************************* |
| 296 | 310 | * Video Hardware * |
| 297 | 311 | *********************************************/ |
| 298 | 312 | |
| 299 | static UINT8 *videoram; | |
| 300 | static UINT8 *colorram; | |
| 301 | static tilemap_t *bg_tilemap; | |
| 302 | 313 | |
| 303 | ||
| 304 | 314 | static WRITE8_HANDLER( megadpkr_videoram_w ) |
| 305 | 315 | { |
| 306 | videoram[offset] = data; | |
| 307 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 316 | blitz_state *state = space->machine->driver_data<blitz_state>(); | |
| 317 | state->videoram[offset] = data; | |
| 318 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 308 | 319 | } |
| 309 | 320 | |
| 310 | 321 | static WRITE8_HANDLER( megadpkr_colorram_w ) |
| 311 | 322 | { |
| 312 | colorram[offset] = data; | |
| 313 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 323 | blitz_state *state = space->machine->driver_data<blitz_state>(); | |
| 324 | state->colorram[offset] = data; | |
| 325 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 314 | 326 | } |
| 315 | 327 | |
| 316 | 328 | |
| 317 | 329 | static TILE_GET_INFO( get_bg_tile_info ) |
| 318 | 330 | { |
| 331 | blitz_state *state = machine->driver_data<blitz_state>(); | |
| 319 | 332 | /* - bits - |
| 320 | 333 | 7654 3210 |
| 321 | 334 | --xx xx-- tiles color. |
| r10886 | r10887 | |
| 324 | 337 | xx-- ---- unused. |
| 325 | 338 | */ |
| 326 | 339 | |
| 327 | int attr = colorram[tile_index]; | |
| 328 | int code = ((attr & 1) << 8) | videoram[tile_index]; | |
| 340 | int attr = state->colorram[tile_index]; | |
| 341 | int code = ((attr & 1) << 8) | state->videoram[tile_index]; | |
| 329 | 342 | int bank = (attr & 0x02) >> 1; /* bit 1 switch the gfx banks */ |
| 330 | 343 | int color = (attr & 0x3c) >> 2; /* bits 2-3-4-5 for color */ |
| 331 | 344 | |
| r10886 | r10887 | |
| 335 | 348 | |
| 336 | 349 | static VIDEO_START( megadpkr ) |
| 337 | 350 | { |
| 338 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 351 | blitz_state *state = machine->driver_data<blitz_state>(); | |
| 352 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 339 | 353 | } |
| 340 | 354 | |
| 341 | 355 | static SCREEN_UPDATE( megadpkr ) |
| 342 | 356 | { |
| 343 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 357 | blitz_state *state = screen->machine->driver_data<blitz_state>(); | |
| 358 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 344 | 359 | return 0; |
| 345 | 360 | } |
| 346 | 361 | |
| r10886 | r10887 | |
| 394 | 409 | * R/W Handlers * |
| 395 | 410 | *******************************************/ |
| 396 | 411 | |
| 397 | static int mux_data = 0; | |
| 398 | 412 | |
| 399 | 413 | /* Inputs (buttons) are multiplexed. |
| 400 | 414 | There are 4 sets of 5 bits each and are connected to PIA0, portA. |
| r10886 | r10887 | |
| 402 | 416 | */ |
| 403 | 417 | static READ8_DEVICE_HANDLER( megadpkr_mux_port_r ) |
| 404 | 418 | { |
| 405 | switch( mux_data & 0xf0 ) /* bits 4-7 */ | |
| 419 | blitz_state *state = device->machine->driver_data<blitz_state>(); | |
| 420 | switch( state->mux_data & 0xf0 ) /* bits 4-7 */ | |
| 406 | 421 | { |
| 407 | 422 | case 0x10: return input_port_read(device->machine, "IN0-0"); |
| 408 | 423 | case 0x20: return input_port_read(device->machine, "IN0-1"); |
| r10886 | r10887 | |
| 415 | 430 | |
| 416 | 431 | static WRITE8_DEVICE_HANDLER( mux_w ) |
| 417 | 432 | { |
| 418 | mux_data = data ^ 0xff; /* inverted */ | |
| 433 | blitz_state *state = device->machine->driver_data<blitz_state>(); | |
| 434 | state->mux_data = data ^ 0xff; /* inverted */ | |
| 419 | 435 | } |
| 420 | 436 | |
| 421 | 437 | |
| r10886 | r10887 | |
| 469 | 485 | AM_RANGE(0x10f8, 0x10fb) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) |
| 470 | 486 | */ |
| 471 | 487 | |
| 472 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(megadpkr_videoram_w) AM_BASE(&videoram) | |
| 473 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(megadpkr_colorram_w) AM_BASE(&colorram) | |
| 488 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(megadpkr_videoram_w) AM_BASE_MEMBER(blitz_state, videoram) | |
| 489 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(megadpkr_colorram_w) AM_BASE_MEMBER(blitz_state, colorram) | |
| 474 | 490 | |
| 475 | 491 | AM_RANGE(0xc000, 0xffff) AM_ROM |
| 476 | 492 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 767 | 783 | * Machine Drivers * |
| 768 | 784 | *********************************************/ |
| 769 | 785 | |
| 770 | static MACHINE_CONFIG_START( megadpkr, | |
| 786 | static MACHINE_CONFIG_START( megadpkr, blitz | |
| 771 | 787 | |
| 772 | 788 | /* basic machine hardware */ |
| 773 | 789 | MCFG_CPU_ADD("maincpu", M6502, CPU_CLOCK) |
| r10886 | r10887 | |
|---|---|---|
| 14 | 14 | #include "emu.h" |
| 15 | 15 | #include "cpu/z80/z80.h" |
| 16 | 16 | |
| 17 | ||
| 18 | class intrscti_state : public driver_device | |
| 19 | { | |
| 20 | public: | |
| 21 | intrscti_state(running_machine &machine, const driver_device_config_base &config) | |
| 22 | : driver_device(machine, config) { } | |
| 23 | ||
| 24 | UINT8 *ram; | |
| 25 | }; | |
| 26 | ||
| 27 | ||
| 17 | 28 | static READ8_HANDLER( unk_r ) |
| 18 | 29 | { |
| 19 | 30 | return space->machine->rand(); |
| 20 | 31 | } |
| 21 | 32 | |
| 22 | static UINT8 *intrscti_ram; | |
| 23 | ||
| 24 | 33 | static ADDRESS_MAP_START( intrscti_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 25 | 34 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 26 | 35 | AM_RANGE(0x6000, 0x67ff) AM_RAM |
| 27 | AM_RANGE(0x7000, 0x77ff) AM_RAM AM_BASE( | |
| 36 | AM_RANGE(0x7000, 0x77ff) AM_RAM AM_BASE_MEMBER( | |
| 28 | 37 | AM_RANGE(0x8000, 0x8fff) AM_ROM |
| 29 | 38 | ADDRESS_MAP_END |
| 30 | 39 | |
| r10886 | r10887 | |
| 59 | 68 | |
| 60 | 69 | static SCREEN_UPDATE(intrscti) |
| 61 | 70 | { |
| 71 | intrscti_state *state = screen->machine->driver_data<intrscti_state>(); | |
| 62 | 72 | int y,x; |
| 63 | 73 | int count; |
| 64 | 74 | |
| r10886 | r10887 | |
| 70 | 80 | for (x=0;x<32;x++) |
| 71 | 81 | { |
| 72 | 82 | int dat; |
| 73 | dat = | |
| 83 | dat = | |
| 74 | 84 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],dat/*+0x100*/,0,0,0,x*8,y*8,0); |
| 75 | 85 | count++; |
| 76 | 86 | } |
| r10886 | r10887 | |
| 80 | 90 | return 0; |
| 81 | 91 | } |
| 82 | 92 | |
| 83 | static MACHINE_CONFIG_START( intrscti, | |
| 93 | static MACHINE_CONFIG_START( intrscti, | |
| 84 | 94 | /* basic machine hardware */ |
| 85 | 95 | MCFG_CPU_ADD("maincpu", Z80,4000000) /* ? MHz */ |
| 86 | 96 | MCFG_CPU_PROGRAM_MAP(intrscti_map) |
| r10886 | r10887 | |
|---|---|---|
| 26 | 26 | #include "machine/pckeybrd.h" |
| 27 | 27 | #include "machine/idectrl.h" |
| 28 | 28 | |
| 29 | static UINT32 *vga_vram; | |
| 30 | static UINT8 vga_regs[0x19]; | |
| 31 | 29 | |
| 30 | class photoply_state : public driver_device | |
| 31 | { | |
| 32 | public: | |
| 33 | photoply_state(running_machine &machine, const driver_device_config_base &config) | |
| 34 | : driver_device(machine, config) { } | |
| 35 | ||
| 36 | UINT32 *vga_vram; | |
| 37 | UINT8 vga_regs[0x19]; | |
| 38 | int dma_channel; | |
| 39 | UINT8 dma_offset[2][4]; | |
| 40 | UINT8 at_pages[0x10]; | |
| 41 | UINT8 vga_address; | |
| 42 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 43 | ||
| 44 | device_t *pit8253; | |
| 45 | device_t *pic8259_1; | |
| 46 | device_t *pic8259_2; | |
| 47 | device_t *dma8237_1; | |
| 48 | device_t *dma8237_2; | |
| 49 | }; | |
| 50 | ||
| 51 | ||
| 32 | 52 | #define SET_VISIBLE_AREA(_x_,_y_) \ |
| 33 | 53 | { \ |
| 34 | 54 | rectangle visarea; \ |
| r10886 | r10887 | |
| 48 | 68 | |
| 49 | 69 | static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs,UINT8 gfx_num) |
| 50 | 70 | { |
| 51 | static UINT32 offs,x,y,max_x,max_y; | |
| 71 | photoply_state *state = machine->driver_data<photoply_state>(); | |
| 72 | UINT32 offs,x,y,max_x,max_y; | |
| 52 | 73 | int tile,color; |
| 53 | 74 | |
| 54 | 75 | /*define the visible area*/ |
| r10886 | r10887 | |
| 64 | 85 | max_x = 80; |
| 65 | 86 | max_y = 25; |
| 66 | 87 | break; |
| 88 | default: | |
| 89 | fatalerror("Unknown size"); | |
| 67 | 90 | } |
| 68 | 91 | |
| 69 | 92 | offs = map_offs; |
| r10886 | r10887 | |
| 71 | 94 | for(y=0;y<max_y;y++) |
| 72 | 95 | for(x=0;x<max_x;x+=2) |
| 73 | 96 | { |
| 74 | tile = (vga_vram[offs] & 0x00ff0000)>>16; | |
| 75 | color = (vga_vram[offs] & 0xff000000)>>24; | |
| 97 | tile = (state->vga_vram[offs] & 0x00ff0000)>>16; | |
| 98 | color = (state->vga_vram[offs] & 0xff000000)>>24; | |
| 76 | 99 | |
| 77 | 100 | drawgfx_opaque(bitmap,cliprect,machine->gfx[gfx_num], |
| 78 | 101 | tile, |
| r10886 | r10887 | |
| 81 | 104 | (x+1)*8,y*8); |
| 82 | 105 | |
| 83 | 106 | |
| 84 | tile = (vga_vram[offs] & 0x000000ff); | |
| 85 | color = (vga_vram[offs] & 0x0000ff00)>>8; | |
| 107 | tile = (state->vga_vram[offs] & 0x000000ff); | |
| 108 | color = (state->vga_vram[offs] & 0x0000ff00)>>8; | |
| 86 | 109 | |
| 87 | 110 | drawgfx_opaque(bitmap,cliprect,machine->gfx[gfx_num], |
| 88 | 111 | tile, |
| r10886 | r10887 | |
| 102 | 125 | return 0; |
| 103 | 126 | } |
| 104 | 127 | |
| 105 | static struct { | |
| 106 | device_t *pit8253; | |
| 107 | device_t *pic8259_1; | |
| 108 | device_t *pic8259_2; | |
| 109 | device_t *dma8237_1; | |
| 110 | device_t *dma8237_2; | |
| 111 | } photoply_devices; | |
| 112 | ||
| 113 | 128 | /****************** |
| 114 | 129 | DMA8237 Controller |
| 115 | 130 | ******************/ |
| 116 | 131 | |
| 117 | static int dma_channel; | |
| 118 | static UINT8 dma_offset[2][4]; | |
| 119 | static UINT8 at_pages[0x10]; | |
| 120 | 132 | |
| 121 | 133 | static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed ) |
| 122 | 134 | { |
| r10886 | r10887 | |
| 129 | 141 | |
| 130 | 142 | static READ8_HANDLER( pc_dma_read_byte ) |
| 131 | 143 | { |
| 132 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 144 | photoply_state *state = space->machine->driver_data<photoply_state>(); | |
| 145 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 133 | 146 | & 0xFF0000; |
| 134 | 147 | |
| 135 | 148 | return space->read_byte(page_offset + offset); |
| r10886 | r10887 | |
| 138 | 151 | |
| 139 | 152 | static WRITE8_HANDLER( pc_dma_write_byte ) |
| 140 | 153 | { |
| 141 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 154 | photoply_state *state = space->machine->driver_data<photoply_state>(); | |
| 155 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 142 | 156 | & 0xFF0000; |
| 143 | 157 | |
| 144 | 158 | space->write_byte(page_offset + offset, data); |
| r10886 | r10887 | |
| 146 | 160 | |
| 147 | 161 | static READ8_HANDLER(dma_page_select_r) |
| 148 | 162 | { |
| 149 | UINT8 data = at_pages[offset % 0x10]; | |
| 163 | photoply_state *state = space->machine->driver_data<photoply_state>(); | |
| 164 | UINT8 data = state->at_pages[offset % 0x10]; | |
| 150 | 165 | |
| 151 | 166 | switch(offset % 8) |
| 152 | 167 | { |
| 153 | 168 | case 1: |
| 154 | data = dma_offset[(offset / 8) & 1][2]; | |
| 169 | data = state->dma_offset[(offset / 8) & 1][2]; | |
| 155 | 170 | break; |
| 156 | 171 | case 2: |
| 157 | data = dma_offset[(offset / 8) & 1][3]; | |
| 172 | data = state->dma_offset[(offset / 8) & 1][3]; | |
| 158 | 173 | break; |
| 159 | 174 | case 3: |
| 160 | data = dma_offset[(offset / 8) & 1][1]; | |
| 175 | data = state->dma_offset[(offset / 8) & 1][1]; | |
| 161 | 176 | break; |
| 162 | 177 | case 7: |
| 163 | data = dma_offset[(offset / 8) & 1][0]; | |
| 178 | data = state->dma_offset[(offset / 8) & 1][0]; | |
| 164 | 179 | break; |
| 165 | 180 | } |
| 166 | 181 | return data; |
| r10886 | r10887 | |
| 169 | 184 | |
| 170 | 185 | static WRITE8_HANDLER(dma_page_select_w) |
| 171 | 186 | { |
| 172 | at_pages[offset % 0x10] = data; | |
| 187 | photoply_state *state = space->machine->driver_data<photoply_state>(); | |
| 188 | state->at_pages[offset % 0x10] = data; | |
| 173 | 189 | |
| 174 | 190 | switch(offset % 8) |
| 175 | 191 | { |
| 176 | 192 | case 1: |
| 177 | dma_offset[(offset / 8) & 1][2] = data; | |
| 193 | state->dma_offset[(offset / 8) & 1][2] = data; | |
| 178 | 194 | break; |
| 179 | 195 | case 2: |
| 180 | dma_offset[(offset / 8) & 1][3] = data; | |
| 196 | state->dma_offset[(offset / 8) & 1][3] = data; | |
| 181 | 197 | break; |
| 182 | 198 | case 3: |
| 183 | dma_offset[(offset / 8) & 1][1] = data; | |
| 199 | state->dma_offset[(offset / 8) & 1][1] = data; | |
| 184 | 200 | break; |
| 185 | 201 | case 7: |
| 186 | dma_offset[(offset / 8) & 1][0] = data; | |
| 202 | state->dma_offset[(offset / 8) & 1][0] = data; | |
| 187 | 203 | break; |
| 188 | 204 | } |
| 189 | 205 | } |
| 190 | 206 | |
| 191 | 207 | static void set_dma_channel(device_t *device, int channel, int state) |
| 192 | 208 | { |
| 193 | if (!state) dma_channel = channel; | |
| 209 | photoply_state *drvstate = device->machine->driver_data<photoply_state>(); | |
| 210 | if (!state) drvstate->dma_channel = channel; | |
| 194 | 211 | } |
| 195 | 212 | |
| 196 | 213 | static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); } |
| r10886 | r10887 | |
| 242 | 259 | |
| 243 | 260 | static IRQ_CALLBACK(irq_callback) |
| 244 | 261 | { |
| 262 | photoply_state *state = device->machine->driver_data<photoply_state>(); | |
| 245 | 263 | int r = 0; |
| 246 | r = pic8259_acknowledge( | |
| 264 | r = pic8259_acknowledge(s | |
| 247 | 265 | if (r==0) |
| 248 | 266 | { |
| 249 | r = pic8259_acknowledge( | |
| 267 | r = pic8259_acknowledge(s | |
| 250 | 268 | } |
| 251 | 269 | return r; |
| 252 | 270 | } |
| 253 | 271 | |
| 254 | 272 | static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed ) |
| 255 | 273 | { |
| 256 | if ( photoply_devices.pic8259_1 ) | |
| 274 | photoply_state *drvstate = device->machine->driver_data<photoply_state>(); | |
| 275 | if ( drvstate->pic8259_1 ) | |
| 257 | 276 | { |
| 258 | pic8259_ir0_w( | |
| 277 | pic8259_ir0_w( | |
| 259 | 278 | } |
| 260 | 279 | } |
| 261 | 280 | |
| r10886 | r10887 | |
| 287 | 306 | |
| 288 | 307 | static ADDRESS_MAP_START( photoply_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 289 | 308 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAM |
| 290 | AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE( | |
| 309 | AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE_MEMBER(photoply_state, vga_vram) | |
| 291 | 310 | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) //??? |
| 292 | 311 | AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_REGION("video_bios", 0) |
| 293 | 312 | AM_RANGE(0x000d0000, 0x000dffff) AM_RAM AM_REGION("ex_bios", 0) |
| r10886 | r10887 | |
| 303 | 322 | /* 3c8-3c9 -> ramdac*/ |
| 304 | 323 | static WRITE32_HANDLER( vga_ramdac_w ) |
| 305 | 324 | { |
| 306 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 307 | ||
| 325 | photoply_state *state = space->machine->driver_data<photoply_state>(); | |
| 308 | 326 | if (ACCESSING_BITS_0_7) |
| 309 | 327 | { |
| 310 | 328 | //printf("%02x X\n",data); |
| 311 | pal | |
| 329 | state->pal.offs = s | |
| 312 | 330 | } |
| 313 | 331 | if (ACCESSING_BITS_8_15) |
| 314 | 332 | { |
| 315 | 333 | //printf("%02x\n",data); |
| 316 | 334 | data>>=8; |
| 317 | switch( | |
| 335 | switch(s | |
| 318 | 336 | { |
| 319 | 337 | case 0: |
| 320 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 321 | internal_pal_offs++; | |
| 338 | state->pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 339 | state->pal.offs_internal++; | |
| 322 | 340 | break; |
| 323 | 341 | case 1: |
| 324 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 325 | internal_pal_offs++; | |
| 342 | state->pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 343 | state->pal.offs_internal++; | |
| 326 | 344 | break; |
| 327 | 345 | case 2: |
| 328 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 329 | palette_set_color(space->machine, 0x200+pal_offs, MAKE_RGB(r, g, b)); | |
| 330 | internal_pal_offs = 0; | |
| 331 | pal_offs++; | |
| 346 | state->pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 347 | palette_set_color(space->machine, 0x200+state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 348 | state->pal.offs_internal = 0; | |
| 349 | state->pal.offs++; | |
| 332 | 350 | break; |
| 333 | 351 | } |
| 334 | 352 | } |
| r10886 | r10887 | |
| 336 | 354 | |
| 337 | 355 | static WRITE32_HANDLER( vga_regs_w ) |
| 338 | 356 | { |
| 339 | stat | |
| 357 | photoply_state | |
| 340 | 358 | |
| 341 | 359 | if (ACCESSING_BITS_0_7) |
| 342 | vga_address = data; | |
| 360 | state->vga_address = data; | |
| 343 | 361 | if (ACCESSING_BITS_8_15) |
| 344 | 362 | { |
| 345 | if(vga_address < 0x19) | |
| 363 | if(state->vga_address < 0x19) | |
| 346 | 364 | { |
| 347 | vga_regs[vga_address] = data>>8; | |
| 348 | logerror("VGA reg %02x with data %02x\n",vga_address,vga_regs[vga_address]); | |
| 365 | state->vga_regs[state->vga_address] = data>>8; | |
| 366 | logerror("VGA reg %02x with data %02x\n",state->vga_address,state->vga_regs[state->vga_address]); | |
| 349 | 367 | } |
| 350 | 368 | else |
| 351 | logerror("Warning: used undefined VGA reg %02x with data %02x\n",vga_address,data>>8); | |
| 369 | logerror("Warning: used undefined VGA reg %02x with data %02x\n",state->vga_address,data>>8); | |
| 352 | 370 | } |
| 353 | 371 | } |
| 354 | 372 | |
| r10886 | r10887 | |
| 458 | 476 | |
| 459 | 477 | static void photoply_set_keyb_int(running_machine *machine, int state) |
| 460 | 478 | { |
| 461 | pic8259_ir1_w(photoply_devices.pic8259_1, state); | |
| 479 | photoply_state *drvstate = machine->driver_data<photoply_state>(); | |
| 480 | pic8259_ir1_w(drvstate->pic8259_1, state); | |
| 462 | 481 | } |
| 463 | 482 | |
| 464 | 483 | |
| 465 | 484 | static MACHINE_START( photoply ) |
| 466 | 485 | { |
| 486 | photoply_state *state = machine->driver_data<photoply_state>(); | |
| 467 | 487 | // bank = -1; |
| 468 | 488 | // lastvalue = -1; |
| 469 | 489 | // hv_blank = 0; |
| 470 | 490 | cpu_set_irq_callback(machine->device("maincpu"), irq_callback); |
| 471 | photoply_devices.pit8253 = machine->device( "pit8254" ); | |
| 472 | photoply_devices.pic8259_1 = machine->device( "pic8259_1" ); | |
| 473 | photoply_devices.pic8259_2 = machine->device( "pic8259_2" ); | |
| 474 | photoply_devices.dma8237_1 = machine->device( "dma8237_1" ); | |
| 475 | photoply_devices.dma8237_2 = machine->device( "dma8237_2" ); | |
| 491 | state->pit8253 = machine->device( "pit8254" ); | |
| 492 | state->pic8259_1 = machine->device( "pic8259_1" ); | |
| 493 | state->pic8259_2 = machine->device( "pic8259_2" ); | |
| 494 | state->dma8237_1 = machine->device( "dma8237_1" ); | |
| 495 | state->dma8237_2 = machine->device( "dma8237_2" ); | |
| 476 | 496 | |
| 477 | 497 | init_pc_common(machine, PCCOMMON_KEYBOARD_AT, photoply_set_keyb_int); |
| 478 | 498 | } |
| r10886 | r10887 | |
| 494 | 514 | GFXDECODE_END |
| 495 | 515 | |
| 496 | 516 | |
| 497 | static MACHINE_CONFIG_START( photoply, | |
| 517 | static MACHINE_CONFIG_START( photoply, photoply_stat | |
| 498 | 518 | /* basic machine hardware */ |
| 499 | 519 | MCFG_CPU_ADD("maincpu", I486, 75000000) /* I486DX4, 75 or 100 Mhz */ |
| 500 | 520 | MCFG_CPU_PROGRAM_MAP(photoply_map) |
| r10886 | r10887 | |
|---|---|---|
| 274 | 274 | #include "pirpok2.lh" |
| 275 | 275 | |
| 276 | 276 | |
| 277 | static bitmap_t *temp_reel_bitmap; | |
| 278 | static tilemap_t *sfbonus_tilemap; | |
| 279 | static tilemap_t *sfbonus_reel_tilemap; | |
| 280 | static tilemap_t *sfbonus_reel2_tilemap; | |
| 281 | static tilemap_t *sfbonus_reel3_tilemap; | |
| 282 | static tilemap_t *sfbonus_reel4_tilemap; | |
| 283 | static UINT8 *sfbonus_tilemap_ram; | |
| 284 | static UINT8 *sfbonus_reel_ram; | |
| 285 | static UINT8 *sfbonus_reel2_ram; | |
| 286 | static UINT8 *sfbonus_reel3_ram; | |
| 287 | static UINT8 *sfbonus_reel4_ram; | |
| 288 | static UINT8* sfbonus_videoram; | |
| 289 | static UINT8 *sfbonus_vregs; | |
| 290 | static UINT8 *nvram; | |
| 291 | static size_t nvram_size; | |
| 292 | static UINT8* sfbonus_1800_regs; | |
| 293 | static UINT8* sfbonus_3800_regs; | |
| 294 | static UINT8* sfbonus_3000_regs; | |
| 295 | static UINT8* sfbonus_2801_regs; | |
| 296 | static UINT8* sfbonus_2c01_regs; | |
| 277 | class sfbonus_state : public driver_device | |
| 278 | { | |
| 279 | public: | |
| 280 | sfbonus_state(running_machine &machine, const driver_device_config_base &config) | |
| 281 | : driver_device(machine, config) { } | |
| 297 | 282 | |
| 283 | bitmap_t *temp_reel_bitmap; | |
| 284 | tilemap_t *tilemap; | |
| 285 | tilemap_t *reel_tilemap; | |
| 286 | tilemap_t *reel2_tilemap; | |
| 287 | tilemap_t *reel3_tilemap; | |
| 288 | tilemap_t *reel4_tilemap; | |
| 289 | UINT8 *tilemap_ram; | |
| 290 | UINT8 *reel_ram; | |
| 291 | UINT8 *reel2_ram; | |
| 292 | UINT8 *reel3_ram; | |
| 293 | UINT8 *reel4_ram; | |
| 294 | UINT8* videoram; | |
| 295 | UINT8 *vregs; | |
| 296 | UINT8 *nvram; | |
| 297 | size_t nvram_size; | |
| 298 | UINT8* _1800_regs; | |
| 299 | UINT8* _3800_regs; | |
| 300 | UINT8* _3000_regs; | |
| 301 | UINT8* _2801_regs; | |
| 302 | UINT8* _2c01_regs; | |
| 303 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 304 | }; | |
| 298 | 305 | |
| 306 | ||
| 299 | 307 | /* 8-liners input define */ |
| 300 | 308 | static INPUT_PORTS_START( amcoebase ) |
| 301 | 309 | PORT_START("KEY1") |
| r10886 | r10887 | |
| 617 | 625 | |
| 618 | 626 | static TILE_GET_INFO( get_sfbonus_tile_info ) |
| 619 | 627 | { |
| 620 | int code = sfbonus_tilemap_ram[(tile_index*2)+0] | (sfbonus_tilemap_ram[(tile_index*2)+1]<<8); | |
| 621 | int flipx = (sfbonus_tilemap_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 622 | int flipy = (sfbonus_tilemap_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 628 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 629 | int code = state->tilemap_ram[(tile_index*2)+0] | (state->tilemap_ram[(tile_index*2)+1]<<8); | |
| 630 | int flipx = (state->tilemap_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 631 | int flipy = (state->tilemap_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 623 | 632 | |
| 624 | 633 | SET_TILE_INFO( |
| 625 | 634 | 0, |
| r10886 | r10887 | |
| 630 | 639 | |
| 631 | 640 | static TILE_GET_INFO( get_sfbonus_reel_tile_info ) |
| 632 | 641 | { |
| 633 | int code = sfbonus_reel_ram[(tile_index*2)+0] | (sfbonus_reel_ram[(tile_index*2)+1]<<8); | |
| 634 | int flipx = (sfbonus_reel_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 635 | int flipy = 0;//(sfbonus_reel_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 642 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 643 | int code = state->reel_ram[(tile_index*2)+0] | (state->reel_ram[(tile_index*2)+1]<<8); | |
| 644 | int flipx = (state->reel_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 645 | int flipy = 0;//(state->reel_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 636 | 646 | |
| 637 | int priority = (s | |
| 647 | int priority = (state-> | |
| 638 | 648 | |
| 639 | 649 | SET_TILE_INFO( |
| 640 | 650 | 1, |
| r10886 | r10887 | |
| 645 | 655 | |
| 646 | 656 | static TILE_GET_INFO( get_sfbonus_reel2_tile_info ) |
| 647 | 657 | { |
| 648 | int code = sfbonus_reel2_ram[(tile_index*2)+0] | (sfbonus_reel2_ram[(tile_index*2)+1]<<8); | |
| 649 | int flipx = (sfbonus_reel2_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 650 | int flipy = 0;//(sfbonus_reel2_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 658 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 659 | int code = state->reel2_ram[(tile_index*2)+0] | (state->reel2_ram[(tile_index*2)+1]<<8); | |
| 660 | int flipx = (state->reel2_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 661 | int flipy = 0;//(state->reel2_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 651 | 662 | |
| 652 | int priority = (s | |
| 663 | int priority = (state-> | |
| 653 | 664 | |
| 654 | 665 | SET_TILE_INFO( |
| 655 | 666 | 1, |
| r10886 | r10887 | |
| 660 | 671 | |
| 661 | 672 | static TILE_GET_INFO( get_sfbonus_reel3_tile_info ) |
| 662 | 673 | { |
| 663 | int code = sfbonus_reel3_ram[(tile_index*2)+0] | (sfbonus_reel3_ram[(tile_index*2)+1]<<8); | |
| 664 | int flipx = (sfbonus_reel3_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 665 | int flipy = 0;//(sfbonus_reel3_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 674 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 675 | int code = state->reel3_ram[(tile_index*2)+0] | (state->reel3_ram[(tile_index*2)+1]<<8); | |
| 676 | int flipx = (state->reel3_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 677 | int flipy = 0;//(state->reel3_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 666 | 678 | |
| 667 | int priority = (s | |
| 679 | int priority = (state-> | |
| 668 | 680 | |
| 669 | 681 | SET_TILE_INFO( |
| 670 | 682 | 1, |
| r10886 | r10887 | |
| 675 | 687 | |
| 676 | 688 | static TILE_GET_INFO( get_sfbonus_reel4_tile_info ) |
| 677 | 689 | { |
| 678 | int code = sfbonus_reel4_ram[(tile_index*2)+0] | (sfbonus_reel4_ram[(tile_index*2)+1]<<8); | |
| 679 | int flipx = (sfbonus_reel4_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 680 | int flipy = 0;//(sfbonus_reel4_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 690 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 691 | int code = state->reel4_ram[(tile_index*2)+0] | (state->reel4_ram[(tile_index*2)+1]<<8); | |
| 692 | int flipx = (state->reel4_ram[(tile_index*2)+1] & 0x80)>>7; | |
| 693 | int flipy = 0;//(state->reel4_ram[(tile_index*2)+1] & 0x40)>>5; | |
| 681 | 694 | |
| 682 | int priority = (s | |
| 695 | int priority = (state-> | |
| 683 | 696 | |
| 684 | 697 | SET_TILE_INFO( |
| 685 | 698 | 1, |
| r10886 | r10887 | |
| 691 | 704 | |
| 692 | 705 | static WRITE8_HANDLER( sfbonus_videoram_w ) |
| 693 | 706 | { |
| 707 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 694 | 708 | if (offset<0x4000) /* 0x0000 - 0x3fff */ |
| 695 | 709 | { |
| 696 | sfbonus_tilemap_ram[offset] = data; | |
| 697 | tilemap_mark_tile_dirty(sfbonus_tilemap,offset/2); | |
| 710 | state->tilemap_ram[offset] = data; | |
| 711 | tilemap_mark_tile_dirty(state->tilemap,offset/2); | |
| 698 | 712 | } |
| 699 | 713 | else if (offset<0x4800) /* 0x4000 - 0x47ff */ |
| 700 | 714 | { |
| 701 | 715 | offset-=0x4000; |
| 702 | 716 | |
| 703 | sfbonus_reel_ram[offset] = data; | |
| 704 | tilemap_mark_tile_dirty(sfbonus_reel_tilemap,offset/2); | |
| 717 | state->reel_ram[offset] = data; | |
| 718 | tilemap_mark_tile_dirty(state->reel_tilemap,offset/2); | |
| 705 | 719 | } |
| 706 | 720 | else if (offset<0x5000) /* 0x4800 - 0x4fff */ |
| 707 | 721 | { |
| 708 | 722 | offset-=0x4800; |
| 709 | 723 | |
| 710 | sfbonus_reel2_ram[offset] = data; | |
| 711 | tilemap_mark_tile_dirty(sfbonus_reel2_tilemap,offset/2); | |
| 724 | state->reel2_ram[offset] = data; | |
| 725 | tilemap_mark_tile_dirty(state->reel2_tilemap,offset/2); | |
| 712 | 726 | } |
| 713 | 727 | else if (offset<0x5800) /* 0x5000 - 0x57ff */ |
| 714 | 728 | { |
| 715 | 729 | offset-=0x5000; |
| 716 | 730 | |
| 717 | sfbonus_reel3_ram[offset] = data; | |
| 718 | tilemap_mark_tile_dirty(sfbonus_reel3_tilemap,offset/2); | |
| 731 | state->reel3_ram[offset] = data; | |
| 732 | tilemap_mark_tile_dirty(state->reel3_tilemap,offset/2); | |
| 719 | 733 | } |
| 720 | 734 | else if (offset<0x6000) /* 0x5800 - 0x5fff */ |
| 721 | 735 | { |
| 722 | 736 | offset-=0x5800; |
| 723 | 737 | |
| 724 | sfbonus_reel4_ram[offset] = data; | |
| 725 | tilemap_mark_tile_dirty(sfbonus_reel4_tilemap,offset/2); | |
| 738 | state->reel4_ram[offset] = data; | |
| 739 | tilemap_mark_tile_dirty(state->reel4_tilemap,offset/2); | |
| 726 | 740 | } |
| 727 | 741 | else if (offset<0x8000) |
| 728 | 742 | { |
| 729 | 743 | offset -=0x6000; |
| 730 | 744 | // scroll regs etc. |
| 731 | 745 | //logerror("access vram at [%04x] <- %02x\n",offset,data); |
| 732 | s | |
| 746 | state-> | |
| 733 | 747 | } |
| 734 | 748 | else |
| 735 | 749 | { |
| r10886 | r10887 | |
| 742 | 756 | |
| 743 | 757 | static VIDEO_START(sfbonus) |
| 744 | 758 | { |
| 745 | temp_reel_bitmap = auto_bitmap_alloc(machine,1024,512,BITMAP_FORMAT_INDEXED16); | |
| 759 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 760 | state->temp_reel_bitmap = auto_bitmap_alloc(machine,1024,512,BITMAP_FORMAT_INDEXED16); | |
| 746 | 761 | |
| 747 | sfbonus_tilemap = tilemap_create(machine,get_sfbonus_tile_info,tilemap_scan_rows,8,8, 128, 64); | |
| 748 | sfbonus_reel_tilemap = tilemap_create(machine,get_sfbonus_reel_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 749 | sfbonus_reel2_tilemap = tilemap_create(machine,get_sfbonus_reel2_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 750 | sfbonus_reel3_tilemap = tilemap_create(machine,get_sfbonus_reel3_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 751 | sfbonus_reel4_tilemap = tilemap_create(machine,get_sfbonus_reel4_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 762 | state->tilemap = tilemap_create(machine,get_sfbonus_tile_info,tilemap_scan_rows,8,8, 128, 64); | |
| 763 | state->reel_tilemap = tilemap_create(machine,get_sfbonus_reel_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 764 | state->reel2_tilemap = tilemap_create(machine,get_sfbonus_reel2_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 765 | state->reel3_tilemap = tilemap_create(machine,get_sfbonus_reel3_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 766 | state->reel4_tilemap = tilemap_create(machine,get_sfbonus_reel4_tile_info,tilemap_scan_rows,8,32, 64, 16); | |
| 752 | 767 | |
| 753 | tilemap_set_transparent_pen(sfbonus_tilemap,0); | |
| 754 | tilemap_set_transparent_pen(sfbonus_reel_tilemap,255); | |
| 755 | tilemap_set_transparent_pen(sfbonus_reel2_tilemap,255); | |
| 756 | tilemap_set_transparent_pen(sfbonus_reel3_tilemap,255); | |
| 757 | tilemap_set_transparent_pen(sfbonus_reel4_tilemap,255); | |
| 768 | tilemap_set_transparent_pen(state->tilemap,0); | |
| 769 | tilemap_set_transparent_pen(state->reel_tilemap,255); | |
| 770 | tilemap_set_transparent_pen(state->reel2_tilemap,255); | |
| 771 | tilemap_set_transparent_pen(state->reel3_tilemap,255); | |
| 772 | tilemap_set_transparent_pen(state->reel4_tilemap,255); | |
| 758 | 773 | |
| 759 | tilemap_set_scroll_rows(s | |
| 774 | tilemap_set_scroll_rows(state-> | |
| 760 | 775 | |
| 761 | tilemap_set_scroll_cols(sfbonus_reel_tilemap, 64); | |
| 762 | tilemap_set_scroll_cols(sfbonus_reel2_tilemap, 64); | |
| 763 | tilemap_set_scroll_cols(sfbonus_reel3_tilemap, 64); | |
| 764 | tilemap_set_scroll_cols(sfbonus_reel4_tilemap, 64); | |
| 776 | tilemap_set_scroll_cols(state->reel_tilemap, 64); | |
| 777 | tilemap_set_scroll_cols(state->reel2_tilemap, 64); | |
| 778 | tilemap_set_scroll_cols(state->reel3_tilemap, 64); | |
| 779 | tilemap_set_scroll_cols(state->reel4_tilemap, 64); | |
| 765 | 780 | |
| 766 | 781 | |
| 767 | 782 | } |
| 768 | 783 | |
| 769 | 784 | static void sfbonus_draw_reel_layer(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int catagory) |
| 770 | 785 | { |
| 786 | sfbonus_state *state = screen->machine->driver_data<sfbonus_state>(); | |
| 771 | 787 | int zz; |
| 772 | 788 | int i; |
| 773 | 789 | int startclipmin; |
| 774 | 790 | const rectangle &visarea = screen->visible_area(); |
| 775 | UINT8* selectbase = &sfbonus_videoram[0x600]; | |
| 776 | UINT8* bg_scroll = &sfbonus_videoram[0x000]; | |
| 777 | UINT8* reels_rowscroll = &sfbonus_videoram[0x400]; | |
| 778 | int globalyscrollreels = (sfbonus_vregs[6] | sfbonus_vregs[7]<<8); | |
| 779 | int globalxscrollreels = (sfbonus_vregs[4] | sfbonus_vregs[5]<<8); | |
| 791 | UINT8* selectbase = &state->videoram[0x600]; | |
| 792 | UINT8* bg_scroll = &state->videoram[0x000]; | |
| 793 | UINT8* reels_rowscroll = &state->videoram[0x400]; | |
| 794 | int globalyscrollreels = (state->vregs[6] | state->vregs[7]<<8); | |
| 795 | int globalxscrollreels = (state->vregs[4] | state->vregs[5]<<8); | |
| 780 | 796 | globalyscrollreels += 8; |
| 781 | 797 | globalxscrollreels += 8; |
| 782 | 798 | |
| r10886 | r10887 | |
| 786 | 802 | { |
| 787 | 803 | int scroll; |
| 788 | 804 | scroll = bg_scroll[(i*2)+0x000] | (bg_scroll[(i*2)+0x001]<<8); |
| 789 | tilemap_set_scrolly(s | |
| 805 | tilemap_set_scrolly(state-> | |
| 790 | 806 | |
| 791 | 807 | scroll = bg_scroll[(i*2)+0x080] | (bg_scroll[(i*2)+0x081]<<8); |
| 792 | tilemap_set_scrolly(s | |
| 808 | tilemap_set_scrolly(state-> | |
| 793 | 809 | |
| 794 | 810 | scroll = bg_scroll[(i*2)+0x100] | (bg_scroll[(i*2)+0x101]<<8); |
| 795 | tilemap_set_scrolly(s | |
| 811 | tilemap_set_scrolly(state-> | |
| 796 | 812 | |
| 797 | 813 | scroll = bg_scroll[(i*2)+0x180] | (bg_scroll[(i*2)+0x181]<<8); |
| 798 | tilemap_set_scrolly(s | |
| 814 | tilemap_set_scrolly(state-> | |
| 799 | 815 | } |
| 800 | 816 | |
| 801 | 817 | // printf("------------\n"); |
| r10886 | r10887 | |
| 826 | 842 | { |
| 827 | 843 | rowscroll = reels_rowscroll[((line/8)*2)+0x000] | (reels_rowscroll[((line/8)*2)+0x001]<<8); |
| 828 | 844 | xxxscroll = globalxscrollreels + rowscroll; |
| 829 | tilemap_set_scrollx(sfbonus_reel_tilemap, 0, xxxscroll ); | |
| 830 | tilemap_set_scrollx(sfbonus_reel2_tilemap, 0, xxxscroll ); | |
| 831 | tilemap_set_scrollx(sfbonus_reel3_tilemap, 0, xxxscroll ); | |
| 832 | tilemap_set_scrollx(sfbonus_reel4_tilemap, 0, xxxscroll ); | |
| 845 | tilemap_set_scrollx(state->reel_tilemap, 0, xxxscroll ); | |
| 846 | tilemap_set_scrollx(state->reel2_tilemap, 0, xxxscroll ); | |
| 847 | tilemap_set_scrollx(state->reel3_tilemap, 0, xxxscroll ); | |
| 848 | tilemap_set_scrollx(state->reel4_tilemap, 0, xxxscroll ); | |
| 833 | 849 | } |
| 834 | 850 | else if (rowenable==0x1) |
| 835 | 851 | { |
| 836 | 852 | rowscroll = reels_rowscroll[((line/8)*2)+0x080] | (reels_rowscroll[((line/8)*2)+0x081]<<8); |
| 837 | 853 | xxxscroll = globalxscrollreels + rowscroll; |
| 838 | tilemap_set_scrollx(sfbonus_reel_tilemap, 0, xxxscroll ); | |
| 839 | tilemap_set_scrollx(sfbonus_reel2_tilemap, 0, xxxscroll ); | |
| 840 | tilemap_set_scrollx(sfbonus_reel3_tilemap, 0, xxxscroll ); | |
| 841 | tilemap_set_scrollx(sfbonus_reel4_tilemap, 0, xxxscroll ); | |
| 854 | tilemap_set_scrollx(state->reel_tilemap, 0, xxxscroll ); | |
| 855 | tilemap_set_scrollx(state->reel2_tilemap, 0, xxxscroll ); | |
| 856 | tilemap_set_scrollx(state->reel3_tilemap, 0, xxxscroll ); | |
| 857 | tilemap_set_scrollx(state->reel4_tilemap, 0, xxxscroll ); | |
| 842 | 858 | } |
| 843 | 859 | else if (rowenable==0x2) |
| 844 | 860 | { |
| 845 | 861 | rowscroll = reels_rowscroll[((line/8)*2)+0x100] | (reels_rowscroll[((line/8)*2)+0x101]<<8); |
| 846 | 862 | xxxscroll = globalxscrollreels + rowscroll; |
| 847 | tilemap_set_scrollx(sfbonus_reel_tilemap, 0, xxxscroll ); | |
| 848 | tilemap_set_scrollx(sfbonus_reel2_tilemap, 0, xxxscroll ); | |
| 849 | tilemap_set_scrollx(sfbonus_reel3_tilemap, 0, xxxscroll ); | |
| 850 | tilemap_set_scrollx(sfbonus_reel4_tilemap, 0, xxxscroll ); | |
| 863 | tilemap_set_scrollx(state->reel_tilemap, 0, xxxscroll ); | |
| 864 | tilemap_set_scrollx(state->reel2_tilemap, 0, xxxscroll ); | |
| 865 | tilemap_set_scrollx(state->reel3_tilemap, 0, xxxscroll ); | |
| 866 | tilemap_set_scrollx(state->reel4_tilemap, 0, xxxscroll ); | |
| 851 | 867 | } |
| 852 | 868 | else if (rowenable==0x3) |
| 853 | 869 | { |
| 854 | 870 | rowscroll = reels_rowscroll[((line/8)*2)+0x180] | (reels_rowscroll[((line/8)*2)+0x181]<<8); |
| 855 | 871 | xxxscroll = globalxscrollreels + rowscroll; |
| 856 | tilemap_set_scrollx(sfbonus_reel_tilemap, 0, xxxscroll ); | |
| 857 | tilemap_set_scrollx(sfbonus_reel2_tilemap, 0, xxxscroll ); | |
| 858 | tilemap_set_scrollx(sfbonus_reel3_tilemap, 0, xxxscroll ); | |
| 859 | tilemap_set_scrollx(sfbonus_reel4_tilemap, 0, xxxscroll ); | |
| 872 | tilemap_set_scrollx(state->reel_tilemap, 0, xxxscroll ); | |
| 873 | tilemap_set_scrollx(state->reel2_tilemap, 0, xxxscroll ); | |
| 874 | tilemap_set_scrollx(state->reel3_tilemap, 0, xxxscroll ); | |
| 875 | tilemap_set_scrollx(state->reel4_tilemap, 0, xxxscroll ); | |
| 860 | 876 | } |
| 861 | 877 | |
| 862 | 878 | if (rowenable2==0) |
| 863 | 879 | { |
| 864 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 880 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 865 | 881 | } |
| 866 | 882 | if (rowenable==0) |
| 867 | 883 | { |
| 868 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 884 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 869 | 885 | } |
| 870 | 886 | |
| 871 | 887 | if (rowenable2==0x1) |
| 872 | 888 | { |
| 873 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 889 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 874 | 890 | } |
| 875 | 891 | if (rowenable==0x1) |
| 876 | 892 | { |
| 877 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 893 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 878 | 894 | } |
| 879 | 895 | |
| 880 | 896 | if (rowenable2==0x2) |
| 881 | 897 | { |
| 882 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 898 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 883 | 899 | } |
| 884 | 900 | if (rowenable==0x2) |
| 885 | 901 | { |
| 886 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 902 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 887 | 903 | } |
| 888 | 904 | |
| 889 | 905 | if (rowenable2==0x3) |
| 890 | 906 | { |
| 891 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 907 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 892 | 908 | } |
| 893 | 909 | if (rowenable==0x3) |
| 894 | 910 | { |
| 895 | tilemap_draw(temp_reel_bitmap,&clip,s | |
| 911 | tilemap_draw(state->temp_reel_bitmap,&clip,state-> | |
| 896 | 912 | } |
| 897 | 913 | |
| 898 | 914 | |
| r10886 | r10887 | |
| 906 | 922 | |
| 907 | 923 | static SCREEN_UPDATE(sfbonus) |
| 908 | 924 | { |
| 925 | sfbonus_state *state = screen->machine->driver_data<sfbonus_state>(); | |
| 909 | 926 | |
| 910 | int globalyscroll = (sfbonus_vregs[2] | sfbonus_vregs[3]<<8); | |
| 911 | int globalxscroll = (sfbonus_vregs[0] | sfbonus_vregs[1]<<8); | |
| 912 | UINT8* front_rowscroll = &sfbonus_videoram[0x200]; | |
| 927 | int globalyscroll = (state->vregs[2] | state->vregs[3]<<8); | |
| 928 | int globalxscroll = (state->vregs[0] | state->vregs[1]<<8); | |
| 929 | UINT8* front_rowscroll = &state->videoram[0x200]; | |
| 913 | 930 | const input_port_token *ipt; |
| 914 | 931 | int i; |
| 915 | 932 | |
| r10886 | r10887 | |
| 918 | 935 | globalxscroll += 8; |
| 919 | 936 | |
| 920 | 937 | bitmap_fill(bitmap,cliprect,screen->machine->pens[0]); |
| 921 | bitmap_fill(temp_reel_bitmap,cliprect,screen->machine->pens[0]); | |
| 938 | bitmap_fill(state->temp_reel_bitmap,cliprect,screen->machine->pens[0]); | |
| 922 | 939 | |
| 923 | 940 | /* render reels to bitmap */ |
| 924 | sfbonus_draw_reel_layer(screen,temp_reel_bitmap,cliprect,0); | |
| 941 | sfbonus_draw_reel_layer(screen,state->temp_reel_bitmap,cliprect,0); | |
| 925 | 942 | |
| 926 | 943 | { |
| 927 | 944 | int y,x; |
| r10886 | r10887 | |
| 930 | 947 | { |
| 931 | 948 | for (x=0;x<512;x++) |
| 932 | 949 | { |
| 933 | UINT16* src = BITMAP_ADDR16(temp_reel_bitmap, y, x); | |
| 950 | UINT16* src = BITMAP_ADDR16(state->temp_reel_bitmap, y, x); | |
| 934 | 951 | UINT16* dst = BITMAP_ADDR16(bitmap, y, x); |
| 935 | 952 | |
| 936 | 953 | if ((src[0]&0x100)==0x000) |
| r10886 | r10887 | |
| 940 | 957 | } |
| 941 | 958 | |
| 942 | 959 | /* Normal Tilemap */ |
| 943 | tilemap_set_scrolly(s | |
| 960 | tilemap_set_scrolly(state-> | |
| 944 | 961 | for (i=0;i<64;i++) |
| 945 | 962 | { |
| 946 | 963 | int scroll; |
| 947 | 964 | scroll = front_rowscroll[(i*2)+0x000] | (front_rowscroll[(i*2)+0x001]<<8); |
| 948 | tilemap_set_scrollx(s | |
| 965 | tilemap_set_scrollx(state-> | |
| 949 | 966 | } |
| 950 | tilemap_draw(bitmap,cliprect,s | |
| 967 | tilemap_draw(bitmap,cliprect,state-> | |
| 951 | 968 | |
| 952 | 969 | { |
| 953 | 970 | int y,x; |
| r10886 | r10887 | |
| 956 | 973 | { |
| 957 | 974 | for (x=0;x<512;x++) |
| 958 | 975 | { |
| 959 | UINT16* src = BITMAP_ADDR16(temp_reel_bitmap, y, x); | |
| 976 | UINT16* src = BITMAP_ADDR16(state->temp_reel_bitmap, y, x); | |
| 960 | 977 | UINT16* dst = BITMAP_ADDR16(bitmap, y, x); |
| 961 | 978 | |
| 962 | 979 | if ((src[0]&0x100)==0x100) |
| r10886 | r10887 | |
| 966 | 983 | } |
| 967 | 984 | #if 0 |
| 968 | 985 | popmessage("%02x %02x %02x %02x %02x %02x %02x %02x -- %02x -- %02x %02x -- %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", |
| 969 | sfbonus_3800_regs[0], | |
| 970 | sfbonus_3800_regs[1], | |
| 971 | sfbonus_3800_regs[2], | |
| 972 | sfbonus_3800_regs[3], | |
| 973 | sfbonus_3800_regs[4], | |
| 974 | sfbonus_3800_regs[5], | |
| 975 | sfbonus_3800_regs[6], | |
| 976 | sfbonus_3800_regs[7], | |
| 977 | sfbonus_3000_regs[0], | |
| 978 | sfbonus_2801_regs[0], | |
| 979 | sfbonus_2c01_regs[0], | |
| 980 | sfbonus_vregs[8], | |
| 981 | sfbonus_vregs[0], | |
| 982 | sfbonus_vregs[10], | |
| 983 | sfbonus_vregs[11], | |
| 984 | sfbonus_vregs[12], | |
| 985 | sfbonus_vregs[13], | |
| 986 | sfbonus_vregs[14], | |
| 987 | sfbonus_vregs[15], | |
| 988 | sfbonus_vregs[16], | |
| 989 | sfbonus_vregs[17], | |
| 990 | sfbonus_vregs[18], | |
| 991 | sfbonus_vregs[19], | |
| 992 | sfbonus_vregs[20], | |
| 993 | sfbonus_vregs[21], | |
| 994 | sfbonus_vregs[22], | |
| 995 | sfbonus_vregs[23], | |
| 996 | sfbonus_vregs[24], | |
| 997 | sfbonus_vregs[25], | |
| 998 | sfbonus_vregs[26], | |
| 999 | sfbonus_vregs[27], | |
| 1000 | sfbonus_vregs[28], | |
| 1001 | sfbonus_vregs[29], | |
| 1002 | sfbonus_vregs[30], | |
| 1003 | sfbonus_vregs[31] | |
| 986 | state->_3800_regs[0], | |
| 987 | state->_3800_regs[1], | |
| 988 | state->_3800_regs[2], | |
| 989 | state->_3800_regs[3], | |
| 990 | state->_3800_regs[4], | |
| 991 | state->_3800_regs[5], | |
| 992 | state->_3800_regs[6], | |
| 993 | state->_3800_regs[7], | |
| 994 | state->_3000_regs[0], | |
| 995 | state->_2801_regs[0], | |
| 996 | state->_2c01_regs[0], | |
| 997 | state->vregs[8], | |
| 998 | state->vregs[0], | |
| 999 | state->vregs[10], | |
| 1000 | state->vregs[11], | |
| 1001 | state->vregs[12], | |
| 1002 | state->vregs[13], | |
| 1003 | state->vregs[14], | |
| 1004 | state->vregs[15], | |
| 1005 | state->vregs[16], | |
| 1006 | state->vregs[17], | |
| 1007 | state->vregs[18], | |
| 1008 | state->vregs[19], | |
| 1009 | state->vregs[20], | |
| 1010 | state->vregs[21], | |
| 1011 | state->vregs[22], | |
| 1012 | state->vregs[23], | |
| 1013 | state->vregs[24], | |
| 1014 | state->vregs[25], | |
| 1015 | state->vregs[26], | |
| 1016 | state->vregs[27], | |
| 1017 | state->vregs[28], | |
| 1018 | state->vregs[29], | |
| 1019 | state->vregs[30], | |
| 1020 | state->vregs[31] | |
| 1004 | 1021 | ); |
| 1005 | 1022 | |
| 1006 | 1023 | popmessage("-- %02x %02x %02x %02x %02x %02x %02x %02x", |
| 1007 | sfbonus_1800_regs[0], | |
| 1008 | sfbonus_1800_regs[1], | |
| 1009 | sfbonus_1800_regs[2], | |
| 1010 | sfbonus_1800_regs[3], | |
| 1011 | sfbonus_1800_regs[4], | |
| 1012 | sfbonus_1800_regs[5], | |
| 1013 | sfbonus_1800_regs[6], | |
| 1014 | sfbonus_1800_regs[7]); | |
| 1024 | state->_1800_regs[0], | |
| 1025 | state->_1800_regs[1], | |
| 1026 | state->_1800_regs[2], | |
| 1027 | state->_1800_regs[3], | |
| 1028 | state->_1800_regs[4], | |
| 1029 | state->_1800_regs[5], | |
| 1030 | state->_1800_regs[6], | |
| 1031 | state->_1800_regs[7]); | |
| 1015 | 1032 | #endif |
| 1016 | 1033 | |
| 1017 | 1034 | ipt = screen->machine->gamedrv->ipt; |
| r10886 | r10887 | |
| 1019 | 1036 | || (ipt == INPUT_PORTS_NAME(amcoe2_poker))) |
| 1020 | 1037 | { |
| 1021 | 1038 | // based on pirpok2 |
| 1022 | output_set_lamp_value(0, (sfbonus_1800_regs[6] & 0x1) >> 0); | |
| 1023 | output_set_lamp_value(1, (sfbonus_1800_regs[6] & 0x4) >> 2); | |
| 1024 | output_set_lamp_value(2, (sfbonus_1800_regs[5] & 0x4) >> 2); | |
| 1025 | output_set_lamp_value(3, (sfbonus_1800_regs[5] & 0x1) >> 0); | |
| 1026 | output_set_lamp_value(4, (sfbonus_1800_regs[4] & 0x4) >> 2); | |
| 1027 | output_set_lamp_value(5, (sfbonus_1800_regs[4] & 0x1) >> 0); | |
| 1039 | output_set_lamp_value(0, (state->_1800_regs[6] & 0x1) >> 0); | |
| 1040 | output_set_lamp_value(1, (state->_1800_regs[6] & 0x4) >> 2); | |
| 1041 | output_set_lamp_value(2, (state->_1800_regs[5] & 0x4) >> 2); | |
| 1042 | output_set_lamp_value(3, (state->_1800_regs[5] & 0x1) >> 0); | |
| 1043 | output_set_lamp_value(4, (state->_1800_regs[4] & 0x4) >> 2); | |
| 1044 | output_set_lamp_value(5, (state->_1800_regs[4] & 0x1) >> 0); | |
| 1028 | 1045 | } |
| 1029 | 1046 | else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4)) |
| 1030 | 1047 | || (ipt == INPUT_PORTS_NAME(amcoe1_poker))) |
| 1031 | 1048 | { |
| 1032 | output_set_lamp_value(0, (sfbonus_1800_regs[0] & 0x2) >> 1); | |
| 1033 | output_set_lamp_value(1, (sfbonus_1800_regs[4] & 0x2) >> 1); | |
| 1034 | output_set_lamp_value(2, (sfbonus_1800_regs[3] & 0x2) >> 1); | |
| 1035 | output_set_lamp_value(3, (sfbonus_1800_regs[6] & 0x4) >> 2); | |
| 1036 | output_set_lamp_value(4, (sfbonus_1800_regs[4] & 0x4) >> 2); | |
| 1037 | output_set_lamp_value(5, (sfbonus_1800_regs[3] & 0x4) >> 2); | |
| 1049 | output_set_lamp_value(0, (state->_1800_regs[0] & 0x2) >> 1); | |
| 1050 | output_set_lamp_value(1, (state->_1800_regs[4] & 0x2) >> 1); | |
| 1051 | output_set_lamp_value(2, (state->_1800_regs[3] & 0x2) >> 1); | |
| 1052 | output_set_lamp_value(3, (state->_1800_regs[6] & 0x4) >> 2); | |
| 1053 | output_set_lamp_value(4, (state->_1800_regs[4] & 0x4) >> 2); | |
| 1054 | output_set_lamp_value(5, (state->_1800_regs[3] & 0x4) >> 2); | |
| 1038 | 1055 | } |
| 1039 | 1056 | |
| 1040 | 1057 | return 0; |
| r10886 | r10887 | |
| 1043 | 1060 | |
| 1044 | 1061 | static WRITE8_HANDLER( paletteram_io_w ) |
| 1045 | 1062 | { |
| 1046 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 1047 | ||
| 1063 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1048 | 1064 | switch(offset) |
| 1049 | 1065 | { |
| 1050 | 1066 | case 0: |
| 1051 | pal | |
| 1067 | state->pal.offs = data; | |
| 1052 | 1068 | break; |
| 1053 | 1069 | case 2: |
| 1054 | | |
| 1070 | s | |
| 1055 | 1071 | break; |
| 1056 | 1072 | case 1: |
| 1057 | switch( | |
| 1073 | switch(s | |
| 1058 | 1074 | { |
| 1059 | 1075 | case 0: |
| 1060 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1061 | internal_pal_offs++; | |
| 1076 | state->pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1077 | state->pal.offs_internal++; | |
| 1062 | 1078 | break; |
| 1063 | 1079 | case 1: |
| 1064 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1065 | internal_pal_offs++; | |
| 1080 | state->pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1081 | state->pal.offs_internal++; | |
| 1066 | 1082 | break; |
| 1067 | 1083 | case 2: |
| 1068 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1069 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 1070 | internal_pal_offs = 0; | |
| 1071 | pal_offs++; | |
| 1084 | state->pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 1085 | palette_set_color(space->machine, state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 1086 | state->pal.offs_internal = 0; | |
| 1087 | state->pal.offs++; | |
| 1072 | 1088 | break; |
| 1073 | 1089 | } |
| 1074 | 1090 | |
| r10886 | r10887 | |
| 1080 | 1096 | |
| 1081 | 1097 | static ADDRESS_MAP_START( sfbonus_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1082 | 1098 | AM_RANGE(0x0000, 0xefff) AM_ROMBANK("bank1") AM_WRITE(sfbonus_videoram_w) |
| 1083 | AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE( | |
| 1099 | AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE_MEMBER(sfbonus_state, nvram) AM_SIZE_MEMBER(sfbonus_state, nvram_size) | |
| 1084 | 1100 | ADDRESS_MAP_END |
| 1085 | 1101 | |
| 1086 | 1102 | static WRITE8_HANDLER( sfbonus_bank_w ) |
| r10886 | r10887 | |
| 1124 | 1140 | // lamps and coin counters |
| 1125 | 1141 | static WRITE8_HANDLER( sfbonus_1800_w ) |
| 1126 | 1142 | { |
| 1127 | sfbonus_1800_regs[offset] = data; | |
| 1143 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1144 | state->_1800_regs[offset] = data; | |
| 1128 | 1145 | } |
| 1129 | 1146 | |
| 1130 | 1147 | static WRITE8_HANDLER( sfbonus_3800_w ) |
| 1131 | 1148 | { |
| 1132 | sfbonus_3800_regs[offset] = data; | |
| 1149 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1150 | state->_3800_regs[offset] = data; | |
| 1133 | 1151 | } |
| 1134 | 1152 | |
| 1135 | 1153 | static WRITE8_HANDLER( sfbonus_3000_w ) |
| 1136 | 1154 | { |
| 1137 | sfbonus_3000_regs[offset] = data; | |
| 1155 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1156 | state->_3000_regs[offset] = data; | |
| 1138 | 1157 | } |
| 1139 | 1158 | |
| 1140 | 1159 | static WRITE8_HANDLER( sfbonus_2801_w ) |
| 1141 | 1160 | { |
| 1142 | sfbonus_2801_regs[offset] = data; | |
| 1161 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1162 | state->_2801_regs[offset] = data; | |
| 1143 | 1163 | } |
| 1144 | 1164 | |
| 1145 | 1165 | static WRITE8_HANDLER( sfbonus_2c01_w ) |
| 1146 | 1166 | { |
| 1147 | sfbonus_2c01_regs[offset] = data; | |
| 1167 | sfbonus_state *state = space->machine->driver_data<sfbonus_state>(); | |
| 1168 | state->_2c01_regs[offset] = data; | |
| 1148 | 1169 | } |
| 1149 | 1170 | |
| 1150 | 1171 | |
| r10886 | r10887 | |
| 1163 | 1184 | |
| 1164 | 1185 | AM_RANGE(0x0c00, 0x0c03) AM_WRITE( paletteram_io_w ) |
| 1165 | 1186 | |
| 1166 | AM_RANGE(0x1800, 0x1807) AM_WRITE(sfbonus_1800_w) AM_BASE( | |
| 1187 | AM_RANGE(0x1800, 0x1807) AM_WRITE(sfbonus_1800_w) AM_BASE_MEMBER( | |
| 1167 | 1188 | |
| 1168 | AM_RANGE(0x2400, 0x241f) AM_RAM AM_BASE( | |
| 1189 | AM_RANGE(0x2400, 0x241f) AM_RAM AM_BASE_MEMBER( | |
| 1169 | 1190 | |
| 1170 | 1191 | AM_RANGE(0x2800, 0x2800) AM_READ(sfbonus_2800_r) |
| 1171 | AM_RANGE(0x2801, 0x2801) AM_READ(sfbonus_2801_r) AM_WRITE(sfbonus_2801_w) AM_BASE( | |
| 1192 | AM_RANGE(0x2801, 0x2801) AM_READ(sfbonus_2801_r) AM_WRITE(sfbonus_2801_w) AM_BASE_MEMBER( | |
| 1172 | 1193 | |
| 1173 | 1194 | AM_RANGE(0x2c00, 0x2c00) AM_READ(sfbonus_2c00_r) |
| 1174 | AM_RANGE(0x2c01, 0x2c01) AM_READ(sfbonus_2c01_r) AM_WRITE(sfbonus_2c01_w) AM_BASE( | |
| 1195 | AM_RANGE(0x2c01, 0x2c01) AM_READ(sfbonus_2c01_r) AM_WRITE(sfbonus_2c01_w) AM_BASE_MEMBER( | |
| 1175 | 1196 | |
| 1176 | AM_RANGE(0x3000, 0x3000) AM_WRITE(sfbonus_3000_w) AM_BASE( | |
| 1197 | AM_RANGE(0x3000, 0x3000) AM_WRITE(sfbonus_3000_w) AM_BASE_MEMBER( | |
| 1177 | 1198 | AM_RANGE(0x3400, 0x3400) AM_WRITE(sfbonus_bank_w) |
| 1178 | 1199 | AM_RANGE(0x3800, 0x3800) AM_READ(sfbonus_3800_r) |
| 1179 | 1200 | |
| 1180 | AM_RANGE(0x3800, 0x3807) AM_WRITE(sfbonus_3800_w) AM_BASE( | |
| 1201 | AM_RANGE(0x3800, 0x3807) AM_WRITE(sfbonus_3800_w) AM_BASE_MEMBER( | |
| 1181 | 1202 | ADDRESS_MAP_END |
| 1182 | 1203 | |
| 1183 | 1204 | |
| r10886 | r10887 | |
| 1224 | 1245 | |
| 1225 | 1246 | static NVRAM_HANDLER( sfbonus ) |
| 1226 | 1247 | { |
| 1248 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 1227 | 1249 | if (read_or_write) |
| 1228 | file->write(nvram,nvram_size); | |
| 1250 | file->write(state->nvram,state->nvram_size); | |
| 1229 | 1251 | else |
| 1230 | 1252 | { |
| 1231 | 1253 | if (file) |
| 1232 | 1254 | { |
| 1233 | memset(nvram,0x00,nvram_size); | |
| 1234 | file->read(nvram,nvram_size); | |
| 1255 | memset(state->nvram,0x00,state->nvram_size); | |
| 1256 | file->read(state->nvram,state->nvram_size); | |
| 1235 | 1257 | } |
| 1236 | 1258 | else |
| 1237 | 1259 | { |
| 1238 | 1260 | UINT8* defaultram = machine->region("defaults")->base(); |
| 1239 | memset(nvram,0x00,nvram_size); | |
| 1261 | memset(state->nvram,0x00,state->nvram_size); | |
| 1240 | 1262 | |
| 1241 | 1263 | if (defaultram) |
| 1242 | 1264 | if ((defaultram[0x02]==0x00) && (defaultram[0x03]==0x00)) // hack! rom region optional regions get cleared with garbage if no rom is present, this is not good! |
| 1243 | memcpy(nvram, machine->region("defaults")->base(), machine->region("defaults")->bytes()); | |
| 1265 | memcpy(state->nvram, machine->region("defaults")->base(), machine->region("defaults")->bytes()); | |
| 1244 | 1266 | } |
| 1245 | 1267 | } |
| 1246 | 1268 | } |
| 1247 | 1269 | |
| 1248 | 1270 | |
| 1249 | static MACHINE_CONFIG_START( sfbonus, | |
| 1271 | static MACHINE_CONFIG_START( sfbonus, sfbonus_stat | |
| 1250 | 1272 | MCFG_CPU_ADD("maincpu", Z80, 6000000) // custom packaged z80 CPU ?? Mhz |
| 1251 | 1273 | MCFG_CPU_PROGRAM_MAP(sfbonus_map) |
| 1252 | 1274 | MCFG_CPU_IO_MAP(sfbonus_io) |
| r10886 | r10887 | |
| 5444 | 5466 | |
| 5445 | 5467 | static DRIVER_INIT( sfbonus_common) |
| 5446 | 5468 | { |
| 5447 | sfbonus_tilemap_ram = auto_alloc_array(machine, UINT8, 0x4000); | |
| 5448 | memset(sfbonus_tilemap_ram, 0xff, 0x4000); | |
| 5449 | state_save_register_global_pointer(machine, sfbonus_tilemap_ram , 0x4000); | |
| 5469 | sfbonus_state *state = machine->driver_data<sfbonus_state>(); | |
| 5470 | state->tilemap_ram = auto_alloc_array(machine, UINT8, 0x4000); | |
| 5471 | memset(state->tilemap_ram, 0xff, 0x4000); | |
| 5472 | state_save_register_global_pointer(machine, state->tilemap_ram , 0x4000); | |
| 5450 | 5473 | |
| 5451 | sfbonus_reel_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5452 | memset(sfbonus_reel_ram, 0xff ,0x0800); | |
| 5453 | state_save_register_global_pointer(machine, sfbonus_reel_ram , 0x0800); | |
| 5474 | state->reel_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5475 | memset(state->reel_ram, 0xff ,0x0800); | |
| 5476 | state_save_register_global_pointer(machine, state->reel_ram , 0x0800); | |
| 5454 | 5477 | |
| 5455 | sfbonus_reel2_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5456 | memset(sfbonus_reel2_ram, 0xff, 0x0800); | |
| 5457 | state_save_register_global_pointer(machine, sfbonus_reel2_ram , 0x0800); | |
| 5478 | state->reel2_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5479 | memset(state->reel2_ram, 0xff, 0x0800); | |
| 5480 | state_save_register_global_pointer(machine, state->reel2_ram , 0x0800); | |
| 5458 | 5481 | |
| 5459 | sfbonus_reel3_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5460 | memset(sfbonus_reel3_ram, 0xff, 0x0800); | |
| 5461 | state_save_register_global_pointer(machine, sfbonus_reel3_ram , 0x0800); | |
| 5482 | state->reel3_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5483 | memset(state->reel3_ram, 0xff, 0x0800); | |
| 5484 | state_save_register_global_pointer(machine, state->reel3_ram , 0x0800); | |
| 5462 | 5485 | |
| 5463 | sfbonus_reel4_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5464 | memset(sfbonus_reel4_ram, 0xff, 0x0800); | |
| 5465 | state_save_register_global_pointer(machine, sfbonus_reel4_ram , 0x0800); | |
| 5486 | state->reel4_ram = auto_alloc_array(machine, UINT8, 0x0800); | |
| 5487 | memset(state->reel4_ram, 0xff, 0x0800); | |
| 5488 | state_save_register_global_pointer(machine, state->reel4_ram , 0x0800); | |
| 5466 | 5489 | |
| 5467 | 5490 | // hack, because the debugger is broken |
| 5468 | sfbonus_videoram = machine->region("debugram")->base(); | |
| 5469 | if (!sfbonus_videoram) | |
| 5470 | sfbonus_videoram = auto_alloc_array(machine, UINT8, 0x10000); | |
| 5491 | state->videoram = machine->region("debugram")->base(); | |
| 5492 | if (!state->videoram) | |
| 5493 | state->videoram = auto_alloc_array(machine, UINT8, 0x10000); | |
| 5471 | 5494 | |
| 5472 | memset(s | |
| 5495 | memset(state-> | |
| 5473 | 5496 | |
| 5474 | state_save_register_global_pointer(machine, s | |
| 5497 | state_save_register_global_pointer(machine, state-> | |
| 5475 | 5498 | |
| 5476 | 5499 | // dummy.rom helper |
| 5477 | 5500 | { |
| r10886 | r10887 | |
|---|---|---|
| 84 | 84 | /* "No Coin B" = coins produce sound, but no effect on coin counter */ |
| 85 | 85 | |
| 86 | 86 | PORT_START("DSW2") |
| 87 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 87 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:1,2") | |
| 88 | 88 | PORT_DIPSETTING( 0x03, "3" ) |
| 89 | 89 | PORT_DIPSETTING( 0x02, "4" ) |
| 90 | 90 | PORT_DIPSETTING( 0x01, "5" ) |
| 91 | 91 | PORT_DIPSETTING( 0x00, "255 (Cheat)") |
| 92 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) | |
| 92 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("DSW2:3") | |
| 93 | 93 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 94 | 94 | PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) ) |
| 95 | PORT_DIPNAME( 0x78, 0x | |
| 95 | PORT_DIPNAME( 0x78, 0x58, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:4,5,6,7") | |
| 96 | 96 | PORT_DIPSETTING( 0x78, "Easy 1" ) |
| 97 | 97 | PORT_DIPSETTING( 0x70, "Easy 2" ) |
| 98 | 98 | PORT_DIPSETTING( 0x68, "Easy 3" ) |
| r10886 | r10887 | |
| 109 | 109 | PORT_DIPSETTING( 0x10, "Difficult 2" ) |
| 110 | 110 | PORT_DIPSETTING( 0x08, "Difficult 3" ) |
| 111 | 111 | PORT_DIPSETTING( 0x00, "Difficult 4" ) |
| 112 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 112 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:8") | |
| 113 | 113 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 114 | 114 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 115 | 115 | |
| 116 | 116 | PORT_START("DSW3") |
| 117 | PORT_DIPNAME( 0x07, 0x07, "First Bonus" ) | |
| 117 | PORT_DIPNAME( 0x07, 0x07, "First Bonus" ) PORT_DIPLOCATION("DSW3:1,2,3") | |
| 118 | 118 | PORT_DIPSETTING( 0x07, "20000" ) |
| 119 | 119 | PORT_DIPSETTING( 0x05, "30000" ) |
| 120 | 120 | PORT_DIPSETTING( 0x04, "40000" ) |
| r10886 | r10887 | |
| 123 | 123 | PORT_DIPSETTING( 0x01, "70000" ) |
| 124 | 124 | PORT_DIPSETTING( 0x00, "80000" ) |
| 125 | 125 | /* 0x06 gives 20000 */ |
| 126 | PORT_DIPNAME( 0x38, 0x | |
| 126 | PORT_DIPNAME( 0x38, 0x10, "Repeated Bonus" ) PORT_DIPLOCATION("DSW3:4,5,6") | |
| 127 | 127 | PORT_DIPSETTING( 0x38, "40000" ) |
| 128 | 128 | PORT_DIPSETTING( 0x18, "50000" ) |
| 129 | 129 | PORT_DIPSETTING( 0x10, "60000" ) |
| 130 | 130 | PORT_DIPSETTING( 0x08, "70000" ) |
| 131 | 131 | PORT_DIPSETTING( 0x00, "80000" ) |
| 132 | 132 | /* 0x20, 0x28 and 0x30 all gives 40000 */ |
| 133 | PORT_DIPNAME( 0x40, 0x00, "Grant Repeated Bonus" ) | |
| 133 | PORT_DIPNAME( 0x40, 0x00, "Grant Repeated Bonus" ) PORT_DIPLOCATION("DSW3:7") | |
| 134 | 134 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 135 | 135 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 136 | PORT_DIPNAME( 0x80, 0x00, "Unknown DSW 8" ) | |
| 137 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 138 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 136 | PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "DSW3:8" ) | |
| 137 | // PORT_DIPNAME( 0x80, 0x00, "Unknown DSW 8" ) | |
| 138 | // PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 139 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 139 | 140 | INPUT_PORTS_END |
| 140 | 141 | |
| 141 | 142 | |
| r10886 | r10887 | |
| 284 | 285 | ROM_LOAD( "h100.6g", 0x0000, 0x0001, NO_DUMP ) /* 20 Pin chip. Appears to be a PAL. Schematics obsfucated. */ |
| 285 | 286 | ROM_END |
| 286 | 287 | |
| 288 | /* Rope Man (a pirate of Roc'n'Rope) | |
| 287 | 289 | |
| 290 | 4K files were 2732 and were on the sound board | |
| 291 | 8K files were 2764 | |
| 292 | The SUB devices were 82S153 PLS's | |
| 293 | G06 was a MMI PAL10L8CN | |
| 294 | A17 was a TBP18S030 read as an 82S123 and is probably the colour PROM. | |
| 295 | B16 was a TBP24S10 read as an 82S131 | |
| 288 | 296 | |
| 297 | Very popular bootleg that was once in MAME and was taken out due to only being a gfx/copyright hack. */ | |
| 298 | ||
| 299 | ROM_START( ropeman ) | |
| 300 | ROM_REGION( 0x10000, "maincpu", 0 ) | |
| 301 | ROM_LOAD( "j01_rm01.bin", 0x6000, 0x2000, CRC(6310a1fe) SHA1(7a32c5f24175b303bd40726c53c061951b9de594) ) | |
| 302 | ROM_LOAD( "j02_rm02.bin", 0x8000, 0x2000, CRC(75af8697) SHA1(70bb4b838cdafedf3d94425fad84f77815898d83) ) | |
| 303 | ROM_LOAD( "j03_rm03.bin", 0xa000, 0x2000, CRC(b21372b1) SHA1(c08ab3caaa646f4752f890d8339bce6b723864bb) ) | |
| 304 | ROM_LOAD( "j04_rm04.bin", 0xc000, 0x2000, CRC(7acb2a05) SHA1(93762d1890f40abc98372a2aa9fe0f63252b6389) ) | |
| 305 | ROM_LOAD( "j05_rm05.bin", 0xe000, 0x2000, CRC(150a6264) SHA1(930ccf8dcf4971d0a15f406d9114be5ecfaa1727) ) | |
| 306 | ||
| 307 | ROM_REGION( 0x10000, "tpsound", 0 ) | |
| 308 | ROM_LOAD( "j07_rm12.bin", 0x0000, 0x1000, CRC(75d2c4e2) SHA1(b701019b4e7b06b268be660ce7958b5367318c27) ) | |
| 309 | ROM_LOAD( "j08_rm13.bin", 0x1000, 0x1000, CRC(ca4325ae) SHA1(34ac035c0c2ed6bcafde1491d976bb9e9d2a2a7d) ) | |
| 310 | ||
| 311 | ROM_REGION( 0x8000, "gfx1", 0 ) | |
| 312 | ROM_LOAD( "a11_rm10.bin", 0x0000, 0x2000, CRC(afdaba5e) SHA1(27c090cb1c3767c997daeedbe1ba24786f9e78f1) ) | |
| 313 | ROM_LOAD( "a12_rm11.bin", 0x2000, 0x2000, CRC(054cafeb) SHA1(4c3cd850b347217af3dd5c9bb84bcff7b30689bd) ) | |
| 314 | ROM_LOAD( "a9_rm08.bin", 0x4000, 0x2000, CRC(9d2166b2) SHA1(42d2b05360e58b1b2b3ad06c98eb46d9da2b1c21) ) | |
| 315 | ROM_LOAD( "a10_rm09.bin", 0x6000, 0x2000, CRC(aff6e22f) SHA1(476d67821519feddc9f9c8537b46e6eede790035) ) | |
| 316 | ||
| 317 | ROM_REGION( 0x4000, "gfx2", 0 ) | |
| 318 | ROM_LOAD( "j12_rm07.bin", 0x0000, 0x2000, CRC(cd8ac4bf) SHA1(22bfd9ac0188bec6a1e8daa8ab915af1a5de7bd7) ) | |
| 319 | ROM_LOAD( "j11_rm06.bin", 0x2000, 0x2000, CRC(35891835) SHA1(9dc6795e336c61b5349cf7bf69a3dc9438ae9336) ) | |
| 320 | ||
| 321 | ROM_REGION( 0x0220, "proms", 0 ) /* Used from original board */ | |
| 322 | ROM_LOAD( "a17_prom.bin", 0x0000, 0x0020, CRC(22ad2c3e) SHA1(1c2198b286c75aa9e78d000432795b1ce86ad6b9) ) | |
| 323 | ROM_LOAD( "b16_prom.bin", 0x0020, 0x0100, CRC(750a9677) SHA1(7a5b4aed5f87180850657b8852bb3f3138d58b5b) ) | |
| 324 | ROM_LOAD( "rocnrope.pr3", 0x0120, 0x0100, CRC(b5c75a27) SHA1(923d6ccf015fd7458494416cc05426cc922a9238) ) | |
| 325 | ||
| 326 | ROM_REGION( 0x0001, "pal_cpuvidbd", 0 ) /* PAL located on the cpu/video board */ | |
| 327 | ROM_LOAD( "h100.6g", 0x0000, 0x0001, NO_DUMP ) /* 20 Pin chip. Appears to be a PAL. Schematics obsfucated. */ | |
| 328 | ROM_END | |
| 329 | ||
| 289 | 330 | /************************************* |
| 290 | 331 | * |
| 291 | 332 | * Driver initialization |
| r10886 | r10887 | |
| 313 | 354 | |
| 314 | 355 | GAME( 1983, rocnrope, 0, rocnrope, rocnrope, rocnrope, ROT270, "Konami", "Roc'n Rope", GAME_SUPPORTS_SAVE ) |
| 315 | 356 | GAME( 1983, rocnropek,rocnrope, rocnrope, rocnrope, rocnropk, ROT270, "Konami / Kosuka", "Roc'n Rope (Kosuka)", GAME_SUPPORTS_SAVE ) |
| 357 | GAME( 1983, ropeman, rocnrope, rocnrope, rocnrope, rocnrope, ROT270, "bootleg", "Ropeman (bootleg of Roc'n Rope)", GAME_SUPPORTS_SAVE ) |
| r10886 | r10887 | |
|---|---|---|
| 82 | 82 | #include "video/mc6845.h" |
| 83 | 83 | #include "luckgrln.lh" |
| 84 | 84 | |
| 85 | static UINT8 *luck_vram1,*luck_vram2,*luck_vram3; | |
| 86 | static UINT8 nmi_enable; | |
| 87 | static tilemap_t *reel1_tilemap, *reel2_tilemap, *reel3_tilemap, *reel4_tilemap; | |
| 88 | static UINT8* reel1_ram; | |
| 89 | static UINT8* reel2_ram; | |
| 90 | static UINT8* reel3_ram; | |
| 91 | static UINT8* reel4_ram; | |
| 92 | static UINT8* reel1_scroll; | |
| 93 | static UINT8* reel2_scroll; | |
| 94 | static UINT8* reel3_scroll; | |
| 95 | static UINT8* reel4_scroll; | |
| 96 | static UINT8* reel1_attr; | |
| 97 | static UINT8* reel2_attr; | |
| 98 | static UINT8* reel3_attr; | |
| 99 | static UINT8* reel4_attr; | |
| 100 | 85 | |
| 86 | class luckgrln_state : public driver_device | |
| 87 | { | |
| 88 | public: | |
| 89 | luckgrln_state(running_machine &machine, const driver_device_config_base &config) | |
| 90 | : driver_device(machine, config) { } | |
| 101 | 91 | |
| 92 | UINT8 *luck_vram1; | |
| 93 | UINT8 *luck_vram2; | |
| 94 | UINT8 *luck_vram3; | |
| 95 | UINT8 nmi_enable; | |
| 96 | tilemap_t *reel1_tilemap; | |
| 97 | tilemap_t *reel2_tilemap; | |
| 98 | tilemap_t *reel3_tilemap; | |
| 99 | tilemap_t *reel4_tilemap; | |
| 100 | UINT8* reel1_ram; | |
| 101 | UINT8* reel2_ram; | |
| 102 | UINT8* reel3_ram; | |
| 103 | UINT8* reel4_ram; | |
| 104 | UINT8* reel1_scroll; | |
| 105 | UINT8* reel2_scroll; | |
| 106 | UINT8* reel3_scroll; | |
| 107 | UINT8* reel4_scroll; | |
| 108 | UINT8* reel1_attr; | |
| 109 | UINT8* reel2_attr; | |
| 110 | UINT8* reel3_attr; | |
| 111 | UINT8* reel4_attr; | |
| 112 | int palette_count; | |
| 113 | UINT8 palette_ram[0x10000]; | |
| 114 | }; | |
| 102 | 115 | |
| 116 | ||
| 103 | 117 | static WRITE8_HANDLER( luckgrln_reel1_ram_w ) |
| 104 | 118 | { |
| 105 | reel1_ram[offset] = data; | |
| 106 | tilemap_mark_tile_dirty(reel1_tilemap,offset); | |
| 119 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 120 | state->reel1_ram[offset] = data; | |
| 121 | tilemap_mark_tile_dirty(state->reel1_tilemap,offset); | |
| 107 | 122 | } |
| 108 | 123 | |
| 109 | 124 | static WRITE8_HANDLER( luckgrln_reel1_attr_w ) |
| 110 | 125 | { |
| 111 | reel1_attr[offset] = data; | |
| 112 | tilemap_mark_tile_dirty(reel1_tilemap,offset); | |
| 126 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 127 | state->reel1_attr[offset] = data; | |
| 128 | tilemap_mark_tile_dirty(state->reel1_tilemap,offset); | |
| 113 | 129 | } |
| 114 | 130 | |
| 115 | 131 | |
| 116 | 132 | |
| 117 | 133 | static TILE_GET_INFO( get_luckgrln_reel1_tile_info ) |
| 118 | 134 | { |
| 119 | int code = reel1_ram[tile_index]; | |
| 120 | int attr = reel1_attr[tile_index]; | |
| 135 | luckgrln_state *state = machine->driver_data<luckgrln_state>(); | |
| 136 | int code = state->reel1_ram[tile_index]; | |
| 137 | int attr = state->reel1_attr[tile_index]; | |
| 121 | 138 | int col = (attr & 0x1f); |
| 122 | 139 | |
| 123 | 140 | code |= (attr & 0xe0)<<3; |
| r10886 | r10887 | |
| 133 | 150 | |
| 134 | 151 | static WRITE8_HANDLER( luckgrln_reel2_ram_w ) |
| 135 | 152 | { |
| 136 | reel2_ram[offset] = data; | |
| 137 | tilemap_mark_tile_dirty(reel2_tilemap,offset); | |
| 153 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 154 | state->reel2_ram[offset] = data; | |
| 155 | tilemap_mark_tile_dirty(state->reel2_tilemap,offset); | |
| 138 | 156 | } |
| 139 | 157 | |
| 140 | 158 | static WRITE8_HANDLER( luckgrln_reel2_attr_w ) |
| 141 | 159 | { |
| 142 | reel2_attr[offset] = data; | |
| 143 | tilemap_mark_tile_dirty(reel2_tilemap,offset); | |
| 160 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 161 | state->reel2_attr[offset] = data; | |
| 162 | tilemap_mark_tile_dirty(state->reel2_tilemap,offset); | |
| 144 | 163 | } |
| 145 | 164 | |
| 146 | 165 | |
| 147 | 166 | static TILE_GET_INFO( get_luckgrln_reel2_tile_info ) |
| 148 | 167 | { |
| 149 | int code = reel2_ram[tile_index]; | |
| 150 | int attr = reel2_attr[tile_index]; | |
| 168 | luckgrln_state *state = machine->driver_data<luckgrln_state>(); | |
| 169 | int code = state->reel2_ram[tile_index]; | |
| 170 | int attr = state->reel2_attr[tile_index]; | |
| 151 | 171 | int col = (attr & 0x1f); |
| 152 | 172 | |
| 153 | 173 | code |= (attr & 0xe0)<<3; |
| r10886 | r10887 | |
| 162 | 182 | |
| 163 | 183 | static WRITE8_HANDLER( luckgrln_reel3_ram_w ) |
| 164 | 184 | { |
| 165 | reel3_ram[offset] = data; | |
| 166 | tilemap_mark_tile_dirty(reel3_tilemap,offset); | |
| 185 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 186 | state->reel3_ram[offset] = data; | |
| 187 | tilemap_mark_tile_dirty(state->reel3_tilemap,offset); | |
| 167 | 188 | } |
| 168 | 189 | |
| 169 | 190 | static WRITE8_HANDLER( luckgrln_reel3_attr_w ) |
| 170 | 191 | { |
| 171 | reel3_attr[offset] = data; | |
| 172 | tilemap_mark_tile_dirty(reel3_tilemap,offset); | |
| 192 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 193 | state->reel3_attr[offset] = data; | |
| 194 | tilemap_mark_tile_dirty(state->reel3_tilemap,offset); | |
| 173 | 195 | } |
| 174 | 196 | |
| 175 | 197 | |
| 176 | 198 | static TILE_GET_INFO( get_luckgrln_reel3_tile_info ) |
| 177 | 199 | { |
| 178 | int code = reel3_ram[tile_index]; | |
| 179 | int attr = reel3_attr[tile_index]; | |
| 200 | luckgrln_state *state = machine->driver_data<luckgrln_state>(); | |
| 201 | int code = state->reel3_ram[tile_index]; | |
| 202 | int attr = state->reel3_attr[tile_index]; | |
| 180 | 203 | int col = (attr & 0x1f); |
| 181 | 204 | |
| 182 | 205 | code |= (attr & 0xe0)<<3; |
| r10886 | r10887 | |
| 190 | 213 | |
| 191 | 214 | static WRITE8_HANDLER( luckgrln_reel4_ram_w ) |
| 192 | 215 | { |
| 193 | reel4_ram[offset] = data; | |
| 194 | tilemap_mark_tile_dirty(reel4_tilemap,offset); | |
| 216 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 217 | state->reel4_ram[offset] = data; | |
| 218 | tilemap_mark_tile_dirty(state->reel4_tilemap,offset); | |
| 195 | 219 | } |
| 196 | 220 | |
| 197 | 221 | static WRITE8_HANDLER( luckgrln_reel4_attr_w ) |
| 198 | 222 | { |
| 199 | reel4_attr[offset] = data; | |
| 200 | tilemap_mark_tile_dirty(reel4_tilemap,offset); | |
| 223 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 224 | state->reel4_attr[offset] = data; | |
| 225 | tilemap_mark_tile_dirty(state->reel4_tilemap,offset); | |
| 201 | 226 | } |
| 202 | 227 | |
| 203 | 228 | |
| 204 | 229 | static TILE_GET_INFO( get_luckgrln_reel4_tile_info ) |
| 205 | 230 | { |
| 206 | int code = reel4_ram[tile_index]; | |
| 207 | int attr = reel4_attr[tile_index]; | |
| 231 | luckgrln_state *state = machine->driver_data<luckgrln_state>(); | |
| 232 | int code = state->reel4_ram[tile_index]; | |
| 233 | int attr = state->reel4_attr[tile_index]; | |
| 208 | 234 | int col = (attr & 0x1f); |
| 209 | 235 | |
| 210 | 236 | code |= (attr & 0xe0)<<3; |
| r10886 | r10887 | |
| 218 | 244 | |
| 219 | 245 | static VIDEO_START(luckgrln) |
| 220 | 246 | { |
| 221 | reel1_tilemap = tilemap_create(machine,get_luckgrln_reel1_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 222 | reel2_tilemap = tilemap_create(machine,get_luckgrln_reel2_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 223 | reel3_tilemap = tilemap_create(machine,get_luckgrln_reel3_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 224 | reel4_tilemap = tilemap_create(machine,get_luckgrln_reel4_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 247 | luckgrln_state *state = machine->driver_data<luckgrln_state>(); | |
| 248 | state->reel1_tilemap = tilemap_create(machine,get_luckgrln_reel1_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 249 | state->reel2_tilemap = tilemap_create(machine,get_luckgrln_reel2_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 250 | state->reel3_tilemap = tilemap_create(machine,get_luckgrln_reel3_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 251 | state->reel4_tilemap = tilemap_create(machine,get_luckgrln_reel4_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 225 | 252 | |
| 226 | tilemap_set_scroll_cols(reel1_tilemap, 64); | |
| 227 | tilemap_set_scroll_cols(reel2_tilemap, 64); | |
| 228 | tilemap_set_scroll_cols(reel3_tilemap, 64); | |
| 229 | tilemap_set_scroll_cols(reel4_tilemap, 64); | |
| 253 | tilemap_set_scroll_cols(state->reel1_tilemap, 64); | |
| 254 | tilemap_set_scroll_cols(state->reel2_tilemap, 64); | |
| 255 | tilemap_set_scroll_cols(state->reel3_tilemap, 64); | |
| 256 | tilemap_set_scroll_cols(state->reel4_tilemap, 64); | |
| 230 | 257 | |
| 231 | tilemap_set_transparent_pen( reel1_tilemap, 0 ); | |
| 232 | tilemap_set_transparent_pen( reel2_tilemap, 0 ); | |
| 233 | tilemap_set_transparent_pen( reel3_tilemap, 0 ); | |
| 234 | tilemap_set_transparent_pen( reel4_tilemap, 0 ); | |
| 258 | tilemap_set_transparent_pen( state->reel1_tilemap, 0 ); | |
| 259 | tilemap_set_transparent_pen( state->reel2_tilemap, 0 ); | |
| 260 | tilemap_set_transparent_pen( state->reel3_tilemap, 0 ); | |
| 261 | tilemap_set_transparent_pen( state->reel4_tilemap, 0 ); | |
| 235 | 262 | } |
| 236 | 263 | |
| 237 | 264 | static SCREEN_UPDATE(luckgrln) |
| 238 | 265 | { |
| 266 | luckgrln_state *state = screen->machine->driver_data<luckgrln_state>(); | |
| 239 | 267 | int y,x; |
| 240 | 268 | int count = 0; |
| 241 | 269 | const rectangle &visarea = screen->visible_area(); |
| r10886 | r10887 | |
| 252 | 280 | |
| 253 | 281 | for (i= 0;i < 64;i++) |
| 254 | 282 | { |
| 255 | tilemap_set_scrolly(reel1_tilemap, i, reel1_scroll[i]); | |
| 256 | tilemap_set_scrolly(reel2_tilemap, i, reel2_scroll[i]); | |
| 257 | tilemap_set_scrolly(reel3_tilemap, i, reel3_scroll[i]); | |
| 258 | tilemap_set_scrolly(reel4_tilemap, i, reel4_scroll[i]); | |
| 283 | tilemap_set_scrolly(state->reel1_tilemap, i, state->reel1_scroll[i]); | |
| 284 | tilemap_set_scrolly(state->reel2_tilemap, i, state->reel2_scroll[i]); | |
| 285 | tilemap_set_scrolly(state->reel3_tilemap, i, state->reel3_scroll[i]); | |
| 286 | tilemap_set_scrolly(state->reel4_tilemap, i, state->reel4_scroll[i]); | |
| 259 | 287 | } |
| 260 | 288 | |
| 261 | 289 | |
| r10886 | r10887 | |
| 269 | 297 | |
| 270 | 298 | for (x=0;x<64;x++) |
| 271 | 299 | { |
| 272 | UINT16 tile = (luck_vram1[count] & 0xff); | |
| 273 | UINT16 tile_high = (luck_vram2[count]); | |
| 274 | UINT16 tileattr = (luck_vram3[count]); | |
| 300 | UINT16 tile = (state->luck_vram1[count] & 0xff); | |
| 301 | UINT16 tile_high = (state->luck_vram2[count]); | |
| 302 | UINT16 tileattr = (state->luck_vram3[count]); | |
| 275 | 303 | UINT8 col = 0; |
| 276 | 304 | UINT8 region = 0; |
| 277 | 305 | UINT8 bgenable; |
| r10886 | r10887 | |
| 283 | 311 | if (clip.max_x>visarea.max_x) clip.max_x = visarea.max_x; |
| 284 | 312 | |
| 285 | 313 | /* |
| 286 | luck_vram1 tttt tttt (t = low tile bits) | |
| 287 | luck_vram2 tttt ppp? (t = high tile bits) (p = pal select)? | |
| 314 | state->luck_vram1 tttt tttt (t = low tile bits) | |
| 315 | state->luck_vram2 tttt ppp? (t = high tile bits) (p = pal select)? | |
| 288 | 316 | |
| 289 | 317 | |
| 290 | 318 | */ |
| r10886 | r10887 | |
| 295 | 323 | // ?? low bit is used too |
| 296 | 324 | col = tile_high&0xf; |
| 297 | 325 | |
| 298 | // --ss fbt- luck_vram3 | |
| 326 | // --ss fbt- state->luck_vram3 | |
| 299 | 327 | // - = unused? |
| 300 | 328 | // s = reel layer select for this 8x8 region |
| 301 | 329 | // f = fg enabled for this 8x8 region (or priority?) |
| r10886 | r10887 | |
| 307 | 335 | #if 0 // treat bit as fg enable |
| 308 | 336 | if (tileattr&0x04) |
| 309 | 337 | { |
| 310 | if (bgenable==0) tilemap_draw(bitmap, &clip, reel1_tilemap, 0, 0); | |
| 311 | if (bgenable==1) tilemap_draw(bitmap, &clip, reel2_tilemap, 0, 0); | |
| 312 | if (bgenable==2) tilemap_draw(bitmap, &clip, reel3_tilemap, 0, 0); | |
| 313 | if (bgenable==3) tilemap_draw(bitmap, &clip, reel4_tilemap, 0, 0); | |
| 338 | if (bgenable==0) tilemap_draw(bitmap, &clip, state->reel1_tilemap, 0, 0); | |
| 339 | if (bgenable==1) tilemap_draw(bitmap, &clip, state->reel2_tilemap, 0, 0); | |
| 340 | if (bgenable==2) tilemap_draw(bitmap, &clip, state->reel3_tilemap, 0, 0); | |
| 341 | if (bgenable==3) tilemap_draw(bitmap, &clip, state->reel4_tilemap, 0, 0); | |
| 314 | 342 | } |
| 315 | 343 | |
| 316 | 344 | if (tileattr&0x08) drawgfx_transpen(bitmap,&clip,screen->machine->gfx[region],tile,col,0,0,x*8,y*8, 0); |
| r10886 | r10887 | |
| 320 | 348 | |
| 321 | 349 | if (tileattr&0x04) |
| 322 | 350 | { |
| 323 | if (bgenable==0) tilemap_draw(bitmap, &clip, reel1_tilemap, 0, 0); | |
| 324 | if (bgenable==1) tilemap_draw(bitmap, &clip, reel2_tilemap, 0, 0); | |
| 325 | if (bgenable==2) tilemap_draw(bitmap, &clip, reel3_tilemap, 0, 0); | |
| 326 | if (bgenable==3) tilemap_draw(bitmap, &clip, reel4_tilemap, 0, 0); | |
| 351 | if (bgenable==0) tilemap_draw(bitmap, &clip, state->reel1_tilemap, 0, 0); | |
| 352 | if (bgenable==1) tilemap_draw(bitmap, &clip, state->reel2_tilemap, 0, 0); | |
| 353 | if (bgenable==2) tilemap_draw(bitmap, &clip, state->reel3_tilemap, 0, 0); | |
| 354 | if (bgenable==3) tilemap_draw(bitmap, &clip, state->reel4_tilemap, 0, 0); | |
| 327 | 355 | } |
| 328 | 356 | |
| 329 | 357 | if ((tileattr&0x08)) drawgfx_transpen(bitmap,&clip,screen->machine->gfx[region],tile,col,0,0,x*8,y*8, 0); |
| r10886 | r10887 | |
| 340 | 368 | AM_RANGE(0x10000, 0x1ffff) AM_ROM AM_REGION("rom_data",0x10000) |
| 341 | 369 | AM_RANGE(0x20000, 0x2ffff) AM_ROM AM_REGION("rom_data",0x00000) |
| 342 | 370 | |
| 343 | AM_RANGE(0x0c000, 0x0c1ff) AM_RAM_WRITE(luckgrln_reel1_ram_w) AM_BASE(&reel1_ram) // only written to half way | |
| 344 | AM_RANGE(0x0c800, 0x0c9ff) AM_RAM_WRITE(luckgrln_reel1_attr_w) AM_BASE(&reel1_attr) | |
| 345 | AM_RANGE(0x0d000, 0x0d03f) AM_RAM AM_BASE(&reel1_scroll) AM_MIRROR(0x000c0) | |
| 371 | AM_RANGE(0x0c000, 0x0c1ff) AM_RAM_WRITE(luckgrln_reel1_ram_w) AM_BASE_MEMBER(luckgrln_state, reel1_ram) // only written to half way | |
| 372 | AM_RANGE(0x0c800, 0x0c9ff) AM_RAM_WRITE(luckgrln_reel1_attr_w) AM_BASE_MEMBER(luckgrln_state, reel1_attr) | |
| 373 | AM_RANGE(0x0d000, 0x0d03f) AM_RAM AM_BASE_MEMBER(luckgrln_state, reel1_scroll) AM_MIRROR(0x000c0) | |
| 346 | 374 | |
| 347 | AM_RANGE(0x0c200, 0x0c3ff) AM_RAM_WRITE(luckgrln_reel2_ram_w) AM_BASE(&reel2_ram) | |
| 348 | AM_RANGE(0x0ca00, 0x0cbff) AM_RAM_WRITE(luckgrln_reel2_attr_w) AM_BASE(&reel2_attr) | |
| 349 | AM_RANGE(0x0d200, 0x0d23f) AM_RAM AM_BASE(&reel2_scroll) AM_MIRROR(0x000c0) | |
| 375 | AM_RANGE(0x0c200, 0x0c3ff) AM_RAM_WRITE(luckgrln_reel2_ram_w) AM_BASE_MEMBER(luckgrln_state, reel2_ram) | |
| 376 | AM_RANGE(0x0ca00, 0x0cbff) AM_RAM_WRITE(luckgrln_reel2_attr_w) AM_BASE_MEMBER(luckgrln_state, reel2_attr) | |
| 377 | AM_RANGE(0x0d200, 0x0d23f) AM_RAM AM_BASE_MEMBER(luckgrln_state, reel2_scroll) AM_MIRROR(0x000c0) | |
| 350 | 378 | |
| 351 | AM_RANGE(0x0c400, 0x0c5ff) AM_RAM_WRITE(luckgrln_reel3_ram_w ) AM_BASE(&reel3_ram) | |
| 352 | AM_RANGE(0x0cc00, 0x0cdff) AM_RAM_WRITE(luckgrln_reel3_attr_w) AM_BASE(&reel3_attr) | |
| 353 | AM_RANGE(0x0d400, 0x0d43f) AM_RAM AM_BASE(&reel3_scroll) AM_MIRROR(0x000c0) | |
| 379 | AM_RANGE(0x0c400, 0x0c5ff) AM_RAM_WRITE(luckgrln_reel3_ram_w ) AM_BASE_MEMBER(luckgrln_state, reel3_ram) | |
| 380 | AM_RANGE(0x0cc00, 0x0cdff) AM_RAM_WRITE(luckgrln_reel3_attr_w) AM_BASE_MEMBER(luckgrln_state, reel3_attr) | |
| 381 | AM_RANGE(0x0d400, 0x0d43f) AM_RAM AM_BASE_MEMBER(luckgrln_state, reel3_scroll) AM_MIRROR(0x000c0) | |
| 354 | 382 | |
| 355 | AM_RANGE(0x0c600, 0x0c7ff) AM_RAM_WRITE(luckgrln_reel4_ram_w ) AM_BASE(&reel4_ram) | |
| 356 | AM_RANGE(0x0ce00, 0x0cfff) AM_RAM_WRITE(luckgrln_reel4_attr_w) AM_BASE(&reel4_attr) | |
| 357 | AM_RANGE(0x0d600, 0x0d63f) AM_RAM AM_BASE(&reel4_scroll) | |
| 383 | AM_RANGE(0x0c600, 0x0c7ff) AM_RAM_WRITE(luckgrln_reel4_ram_w ) AM_BASE_MEMBER(luckgrln_state, reel4_ram) | |
| 384 | AM_RANGE(0x0ce00, 0x0cfff) AM_RAM_WRITE(luckgrln_reel4_attr_w) AM_BASE_MEMBER(luckgrln_state, reel4_attr) | |
| 385 | AM_RANGE(0x0d600, 0x0d63f) AM_RAM AM_BASE_MEMBER(luckgrln_state, reel4_scroll) | |
| 358 | 386 | |
| 359 | 387 | // AM_RANGE(0x0d200, 0x0d2ff) AM_RAM |
| 360 | 388 | |
| 361 | 389 | |
| 362 | 390 | AM_RANGE(0x0d800, 0x0dfff) AM_RAM // nvram |
| 363 | 391 | |
| 364 | AM_RANGE(0x0e000, 0x0e7ff) AM_RAM AM_BASE(&luck_vram1) | |
| 365 | AM_RANGE(0x0e800, 0x0efff) AM_RAM AM_BASE(&luck_vram2) | |
| 366 | AM_RANGE(0x0f000, 0x0f7ff) AM_RAM AM_BASE(&luck_vram3) | |
| 392 | AM_RANGE(0x0e000, 0x0e7ff) AM_RAM AM_BASE_MEMBER(luckgrln_state, luck_vram1) | |
| 393 | AM_RANGE(0x0e800, 0x0efff) AM_RAM AM_BASE_MEMBER(luckgrln_state, luck_vram2) | |
| 394 | AM_RANGE(0x0f000, 0x0f7ff) AM_RAM AM_BASE_MEMBER(luckgrln_state, luck_vram3) | |
| 367 | 395 | |
| 368 | 396 | |
| 369 | 397 | AM_RANGE(0x0f800, 0x0ffff) AM_RAM |
| r10886 | r10887 | |
| 373 | 401 | |
| 374 | 402 | static WRITE8_HANDLER( output_w ) |
| 375 | 403 | { |
| 404 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 376 | 405 | /* correct? */ |
| 377 | 406 | if (data==0x84) |
| 378 | nmi_enable = 0; | |
| 407 | state->nmi_enable = 0; | |
| 379 | 408 | else if (data==0x85) |
| 380 | nmi_enable = 1; | |
| 409 | state->nmi_enable = 1; | |
| 381 | 410 | else |
| 382 | 411 | printf("output_w unk data %02x\n",data); |
| 383 | 412 | } |
| 384 | 413 | |
| 385 | 414 | |
| 386 | static int palette_count = 0; | |
| 387 | static UINT8 palette_ram[0x10000]; | |
| 388 | 415 | |
| 389 | 416 | static WRITE8_HANDLER( palette_offset_low_w ) |
| 390 | 417 | { |
| 391 | palette_count = data<<1; | |
| 418 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 419 | state->palette_count = data<<1; | |
| 392 | 420 | } |
| 393 | 421 | static WRITE8_HANDLER( palette_offset_high_w ) |
| 394 | 422 | { |
| 395 | palette_count = palette_count | data<<9; | |
| 423 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 424 | state->palette_count = state->palette_count | data<<9; | |
| 396 | 425 | } |
| 397 | 426 | |
| 398 | 427 | |
| 399 | 428 | static WRITE8_HANDLER( palette_w ) |
| 400 | 429 | { |
| 401 | palette_ram[palette_count] = data; | |
| 430 | luckgrln_state *state = space->machine->driver_data<luckgrln_state>(); | |
| 431 | state->palette_ram[state->palette_count] = data; | |
| 402 | 432 | |
| 403 | 433 | |
| 404 | 434 | { |
| 405 | 435 | int r,g,b; |
| 406 | 436 | int offs; |
| 407 | 437 | UINT16 dat; |
| 408 | offs = palette_count&~0x1; | |
| 409 | dat = palette_ram[offs] | palette_ram[offs+1]<<8; | |
| 438 | offs = state->palette_count&~0x1; | |
| 439 | dat = state->palette_ram[offs] | state->palette_ram[offs+1]<<8; | |
| 410 | 440 | |
| 411 | 441 | r = (dat >> 0) & 0x1f; |
| 412 | 442 | g = (dat >> 5) & 0x1f; |
| r10886 | r10887 | |
| 416 | 446 | |
| 417 | 447 | } |
| 418 | 448 | |
| 419 | palette_count++; | |
| 449 | state->palette_count++; | |
| 420 | 450 | |
| 421 | 451 | } |
| 422 | 452 | |
| r10886 | r10887 | |
| 811 | 841 | |
| 812 | 842 | static INTERRUPT_GEN( luckgrln_irq ) |
| 813 | 843 | { |
| 814 | if(nmi_enable) | |
| 844 | luckgrln_state *state = device->machine->driver_data<luckgrln_state>(); | |
| 845 | if(state->nmi_enable) | |
| 815 | 846 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 816 | 847 | } |
| 817 | 848 | |
| 818 | static MACHINE_CONFIG_START( luckgrln, | |
| 849 | static MACHINE_CONFIG_START( luckgrln, luckgrln | |
| 819 | 850 | MCFG_CPU_ADD("maincpu", Z180,8000000) |
| 820 | 851 | MCFG_CPU_PROGRAM_MAP(mainmap) |
| 821 | 852 | MCFG_CPU_IO_MAP(portmap) |
| r10886 | r10887 | |
|---|---|---|
| 97 | 97 | #include "machine/pckeybrd.h" |
| 98 | 98 | #include "machine/idectrl.h" |
| 99 | 99 | |
| 100 | static void ide_interrupt(device_t *device, int state); | |
| 101 | 100 | |
| 102 | static UINT32 *bios_ram; | |
| 103 | static UINT32 *vga_vram; | |
| 101 | class calchase_state : public driver_device | |
| 102 | { | |
| 103 | public: | |
| 104 | calchase_state(running_machine &machine, const driver_device_config_base &config) | |
| 105 | : driver_device(machine, config) { } | |
| 104 | 106 | |
| 105 | static struct { | |
| 107 | UINT32 *bios_ram; | |
| 108 | UINT32 *vga_vram; | |
| 109 | int dma_channel; | |
| 110 | UINT8 dma_offset[2][4]; | |
| 111 | UINT8 at_pages[0x10]; | |
| 112 | UINT8 mxtc_config_reg[256]; | |
| 113 | UINT8 piix4_config_reg[4][256]; | |
| 114 | ||
| 106 | 115 | device_t *pit8254; |
| 107 | 116 | device_t *pic8259_1; |
| 108 | 117 | device_t *pic8259_2; |
| 109 | 118 | device_t *dma8237_1; |
| 110 | 119 | device_t *dma8237_2; |
| 111 | } | |
| 120 | } | |
| 112 | 121 | |
| 113 | 122 | |
| 123 | static void ide_interrupt(device_t *device, int state); | |
| 124 | ||
| 125 | ||
| 114 | 126 | static VIDEO_START(calchase) |
| 115 | 127 | { |
| 116 | ||
| 117 | 128 | } |
| 118 | 129 | |
| 119 | 130 | static SCREEN_UPDATE(calchase) |
| 120 | 131 | { |
| 132 | calchase_state *state = screen->machine->driver_data<calchase_state>(); | |
| 121 | 133 | int x,y,count,i; |
| 122 | 134 | |
| 123 | 135 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| r10886 | r10887 | |
| 132 | 144 | { |
| 133 | 145 | UINT32 color; |
| 134 | 146 | |
| 135 | color = (vga_vram[count])>>(32-i) & 0x1; | |
| 147 | color = (state->vga_vram[count])>>(32-i) & 0x1; | |
| 136 | 148 | |
| 137 | 149 | if((x+i)<screen->visible_area().max_x && ((y)+0)<screen->visible_area().max_y) |
| 138 | 150 | *BITMAP_ADDR32(bitmap, y, x+(32-i)) = screen->machine->pens[color]; |
| r10886 | r10887 | |
| 166 | 178 | write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask); |
| 167 | 179 | } |
| 168 | 180 | |
| 169 | static int dma_channel; | |
| 170 | static UINT8 dma_offset[2][4]; | |
| 171 | static UINT8 at_pages[0x10]; | |
| 172 | 181 | |
| 173 | 182 | |
| 174 | 183 | static READ8_HANDLER(at_page8_r) |
| 175 | 184 | { |
| 176 | UINT8 data = at_pages[offset % 0x10]; | |
| 185 | calchase_state *state = space->machine->driver_data<calchase_state>(); | |
| 186 | UINT8 data = state->at_pages[offset % 0x10]; | |
| 177 | 187 | |
| 178 | 188 | switch(offset % 8) { |
| 179 | 189 | case 1: |
| 180 | data = dma_offset[(offset / 8) & 1][2]; | |
| 190 | data = state->dma_offset[(offset / 8) & 1][2]; | |
| 181 | 191 | break; |
| 182 | 192 | case 2: |
| 183 | data = dma_offset[(offset / 8) & 1][3]; | |
| 193 | data = state->dma_offset[(offset / 8) & 1][3]; | |
| 184 | 194 | break; |
| 185 | 195 | case 3: |
| 186 | data = dma_offset[(offset / 8) & 1][1]; | |
| 196 | data = state->dma_offset[(offset / 8) & 1][1]; | |
| 187 | 197 | break; |
| 188 | 198 | case 7: |
| 189 | data = dma_offset[(offset / 8) & 1][0]; | |
| 199 | data = state->dma_offset[(offset / 8) & 1][0]; | |
| 190 | 200 | break; |
| 191 | 201 | } |
| 192 | 202 | return data; |
| r10886 | r10887 | |
| 195 | 205 | |
| 196 | 206 | static WRITE8_HANDLER(at_page8_w) |
| 197 | 207 | { |
| 198 | at_pages[offset % 0x10] = data; | |
| 208 | calchase_state *state = space->machine->driver_data<calchase_state>(); | |
| 209 | state->at_pages[offset % 0x10] = data; | |
| 199 | 210 | |
| 200 | 211 | switch(offset % 8) { |
| 201 | 212 | case 1: |
| 202 | dma_offset[(offset / 8) & 1][2] = data; | |
| 213 | state->dma_offset[(offset / 8) & 1][2] = data; | |
| 203 | 214 | break; |
| 204 | 215 | case 2: |
| 205 | dma_offset[(offset / 8) & 1][3] = data; | |
| 216 | state->dma_offset[(offset / 8) & 1][3] = data; | |
| 206 | 217 | break; |
| 207 | 218 | case 3: |
| 208 | dma_offset[(offset / 8) & 1][1] = data; | |
| 219 | state->dma_offset[(offset / 8) & 1][1] = data; | |
| 209 | 220 | break; |
| 210 | 221 | case 7: |
| 211 | dma_offset[(offset / 8) & 1][0] = data; | |
| 222 | state->dma_offset[(offset / 8) & 1][0] = data; | |
| 212 | 223 | break; |
| 213 | 224 | } |
| 214 | 225 | } |
| r10886 | r10887 | |
| 225 | 236 | |
| 226 | 237 | static READ8_HANDLER( pc_dma_read_byte ) |
| 227 | 238 | { |
| 228 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 239 | calchase_state *state = space->machine->driver_data<calchase_state>(); | |
| 240 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 229 | 241 | & 0xFF0000; |
| 230 | 242 | |
| 231 | 243 | return space->read_byte(page_offset + offset); |
| r10886 | r10887 | |
| 234 | 246 | |
| 235 | 247 | static WRITE8_HANDLER( pc_dma_write_byte ) |
| 236 | 248 | { |
| 237 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 249 | calchase_state *state = space->machine->driver_data<calchase_state>(); | |
| 250 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 238 | 251 | & 0xFF0000; |
| 239 | 252 | |
| 240 | 253 | space->write_byte(page_offset + offset, data); |
| r10886 | r10887 | |
| 242 | 255 | |
| 243 | 256 | static void set_dma_channel(device_t *device, int channel, int state) |
| 244 | 257 | { |
| 245 | if (!state) dma_channel = channel; | |
| 258 | calchase_state *drvstate = device->machine->driver_data<calchase_state>(); | |
| 259 | if (!state) drvstate->dma_channel = channel; | |
| 246 | 260 | } |
| 247 | 261 | |
| 248 | 262 | static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); } |
| r10886 | r10887 | |
| 305 | 319 | } |
| 306 | 320 | |
| 307 | 321 | // Intel 82439TX System Controller (MXTC) |
| 308 | static UINT8 mxtc_config_reg[256]; | |
| 309 | 322 | |
| 310 | 323 | static UINT8 mxtc_config_r(device_t *busdevice, device_t *device, int function, int reg) |
| 311 | 324 | { |
| 325 | calchase_state *state = busdevice->machine->driver_data<calchase_state>(); | |
| 312 | 326 | // mame_printf_debug("MXTC: read %d, %02X\n", function, reg); |
| 313 | 327 | |
| 314 | return mxtc_config_reg[reg]; | |
| 328 | return state->mxtc_config_reg[reg]; | |
| 315 | 329 | } |
| 316 | 330 | |
| 317 | 331 | static void mxtc_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data) |
| 318 | 332 | { |
| 333 | calchase_state *state = busdevice->machine->driver_data<calchase_state>(); | |
| 319 | 334 | // mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data); |
| 320 | 335 | |
| 321 | 336 | switch(reg) |
| r10886 | r10887 | |
| 324 | 339 | { |
| 325 | 340 | if (data & 0x10) // enable RAM access to region 0xf0000 - 0xfffff |
| 326 | 341 | { |
| 327 | memory_set_bankptr(busdevice->machine, "bank1", bios_ram); | |
| 342 | memory_set_bankptr(busdevice->machine, "bank1", state->bios_ram); | |
| 328 | 343 | } |
| 329 | 344 | else // disable RAM access (reads go to BIOS ROM) |
| 330 | 345 | { |
| r10886 | r10887 | |
| 334 | 349 | } |
| 335 | 350 | } |
| 336 | 351 | |
| 337 | mxtc_config_reg[reg] = data; | |
| 352 | state->mxtc_config_reg[reg] = data; | |
| 338 | 353 | } |
| 339 | 354 | |
| 340 | static void intel82439tx_init( | |
| 355 | static void intel82439tx_init(running_machine *machine) | |
| 341 | 356 | { |
| 342 | mxtc_config_reg[0x60] = 0x02; | |
| 343 | mxtc_config_reg[0x61] = 0x02; | |
| 344 | mxtc_config_reg[0x62] = 0x02; | |
| 345 | mxtc_config_reg[0x63] = 0x02; | |
| 346 | mxtc_config_reg[0x64] = 0x02; | |
| 347 | mxtc_config_reg[0x65] = 0x02; | |
| 357 | calchase_state *state = machine->driver_data<calchase_state>(); | |
| 358 | state->mxtc_config_reg[0x60] = 0x02; | |
| 359 | state->mxtc_config_reg[0x61] = 0x02; | |
| 360 | state->mxtc_config_reg[0x62] = 0x02; | |
| 361 | state->mxtc_config_reg[0x63] = 0x02; | |
| 362 | state->mxtc_config_reg[0x64] = 0x02; | |
| 363 | state->mxtc_config_reg[0x65] = 0x02; | |
| 348 | 364 | } |
| 349 | 365 | |
| 350 | 366 | static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) |
| r10886 | r10887 | |
| 390 | 406 | } |
| 391 | 407 | |
| 392 | 408 | // Intel 82371AB PCI-to-ISA / IDE bridge (PIIX4) |
| 393 | static UINT8 piix4_config_reg[4][256]; | |
| 394 | 409 | |
| 395 | 410 | static UINT8 piix4_config_r(device_t *busdevice, device_t *device, int function, int reg) |
| 396 | 411 | { |
| 412 | calchase_state *state = busdevice->machine->driver_data<calchase_state>(); | |
| 397 | 413 | // mame_printf_debug("PIIX4: read %d, %02X\n", function, reg); |
| 398 | return piix4_config_reg[function][reg]; | |
| 414 | return state->piix4_config_reg[function][reg]; | |
| 399 | 415 | } |
| 400 | 416 | |
| 401 | 417 | static void piix4_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data) |
| 402 | 418 | { |
| 419 | calchase_state *state = busdevice->machine->driver_data<calchase_state>(); | |
| 403 | 420 | // mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine->describe_context(), function, reg, data); |
| 404 | piix4_config_reg[function][reg] = data; | |
| 421 | state->piix4_config_reg[function][reg] = data; | |
| 405 | 422 | } |
| 406 | 423 | |
| 407 | 424 | static UINT32 intel82371ab_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) |
| r10886 | r10887 | |
| 448 | 465 | |
| 449 | 466 | static WRITE32_HANDLER(bios_ram_w) |
| 450 | 467 | { |
| 451 | if (mxtc_config_reg[0x59] & 0x20) // write to RAM if this region is write-enabled | |
| 468 | calchase_state *state = space->machine->driver_data<calchase_state>(); | |
| 469 | if (state->mxtc_config_reg[0x59] & 0x20) // write to RAM if this region is write-enabled | |
| 452 | 470 | { |
| 453 | COMBINE_DATA(bios_ram + offset); | |
| 471 | COMBINE_DATA(state->bios_ram + offset); | |
| 454 | 472 | } |
| 455 | 473 | } |
| 456 | 474 | |
| 457 | 475 | static ADDRESS_MAP_START( calchase_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 458 | 476 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAM |
| 459 | AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE( | |
| 477 | AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE_MEMBER(calchase_state, vga_vram) | |
| 460 | 478 | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) |
| 461 | 479 | AM_RANGE(0x000e0000, 0x000effff) AM_RAM |
| 462 | 480 | AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bank1") |
| r10886 | r10887 | |
| 547 | 565 | |
| 548 | 566 | static IRQ_CALLBACK(irq_callback) |
| 549 | 567 | { |
| 568 | calchase_state *state = device->machine->driver_data<calchase_state>(); | |
| 550 | 569 | int r = 0; |
| 551 | r = pic8259_acknowledge( | |
| 570 | r = pic8259_acknowledge( | |
| 552 | 571 | if (r==0) |
| 553 | 572 | { |
| 554 | r = pic8259_acknowledge( | |
| 573 | r = pic8259_acknowledge( | |
| 555 | 574 | } |
| 556 | 575 | return r; |
| 557 | 576 | } |
| 558 | 577 | |
| 559 | 578 | static MACHINE_START(calchase) |
| 560 | 579 | { |
| 580 | calchase_state *state = machine->driver_data<calchase_state>(); | |
| 561 | 581 | cpu_set_irq_callback(machine->device("maincpu"), irq_callback); |
| 562 | 582 | |
| 563 | calchase_devices.pit8254 = machine->device( "pit8254" ); | |
| 564 | calchase_devices.pic8259_1 = machine->device( "pic8259_1" ); | |
| 565 | calchase_devices.pic8259_2 = machine->device( "pic8259_2" ); | |
| 566 | calchase_devices.dma8237_1 = machine->device( "dma8237_1" ); | |
| 567 | calchase_devices.dma8237_2 = machine->device( "dma8237_2" ); | |
| 583 | state->pit8254 = machine->device( "pit8254" ); | |
| 584 | state->pic8259_1 = machine->device( "pic8259_1" ); | |
| 585 | state->pic8259_2 = machine->device( "pic8259_2" ); | |
| 586 | state->dma8237_1 = machine->device( "dma8237_1" ); | |
| 587 | state->dma8237_2 = machine->device( "dma8237_2" ); | |
| 568 | 588 | } |
| 569 | 589 | |
| 570 | 590 | /************************************************************* |
| r10886 | r10887 | |
| 626 | 646 | |
| 627 | 647 | static void keyboard_interrupt(running_machine *machine, int state) |
| 628 | 648 | { |
| 629 | pic8259_ir1_w(calchase_devices.pic8259_1, state); | |
| 649 | calchase_state *drvstate = machine->driver_data<calchase_state>(); | |
| 650 | pic8259_ir1_w(drvstate->pic8259_1, state); | |
| 630 | 651 | } |
| 631 | 652 | |
| 632 | 653 | static void ide_interrupt(device_t *device, int state) |
| 633 | 654 | { |
| 634 | pic8259_ir6_w(calchase_devices.pic8259_2, state); | |
| 655 | calchase_state *drvstate = device->machine->driver_data<calchase_state>(); | |
| 656 | pic8259_ir6_w(drvstate->pic8259_2, state); | |
| 635 | 657 | } |
| 636 | 658 | |
| 637 | static int calchase_get_out2(running_machine *machine) { | |
| 638 | return pit8253_get_output(calchase_devices.pit8254, 2 ); | |
| 659 | static int calchase_get_out2(running_machine *machine) | |
| 660 | { | |
| 661 | calchase_state *state = machine->driver_data<calchase_state>(); | |
| 662 | return pit8253_get_output(state->pit8254, 2 ); | |
| 639 | 663 | } |
| 640 | 664 | |
| 641 | 665 | static const struct kbdc8042_interface at8042 = |
| r10886 | r10887 | |
| 643 | 667 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt, calchase_get_out2 |
| 644 | 668 | }; |
| 645 | 669 | |
| 646 | static void calchase_set_keyb_int(running_machine *machine, int state) { | |
| 647 | pic8259_ir1_w(calchase_devices.pic8259_1, state); | |
| 670 | static void calchase_set_keyb_int(running_machine *machine, int state) | |
| 671 | { | |
| 672 | calchase_state *drvstate = machine->driver_data<calchase_state>(); | |
| 673 | pic8259_ir1_w(drvstate->pic8259_1, state); | |
| 648 | 674 | } |
| 649 | 675 | |
| 650 | 676 | |
| 651 | static MACHINE_CONFIG_START( calchase, | |
| 677 | static MACHINE_CONFIG_START( calchase, calchase | |
| 652 | 678 | MCFG_CPU_ADD("maincpu", PENTIUM, 200000000) // Cyrix 686MX-PR200 CPU |
| 653 | 679 | MCFG_CPU_PROGRAM_MAP(calchase_map) |
| 654 | 680 | MCFG_CPU_IO_MAP(calchase_io) |
| r10886 | r10887 | |
| 683 | 709 | |
| 684 | 710 | static DRIVER_INIT( calchase ) |
| 685 | 711 | { |
| 686 | bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 712 | calchase_state *state = machine->driver_data<calchase_state>(); | |
| 713 | state->bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 687 | 714 | |
| 688 | 715 | init_pc_common(machine, PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int); |
| 689 | 716 | |
| 690 | intel82439tx_init(); | |
| 717 | intel82439tx_init(machine); | |
| 691 | 718 | |
| 692 | 719 | kbdc8042_init(machine, &at8042); |
| 693 | 720 | } |
| r10886 | r10887 | |
|---|---|---|
| 44 | 44 | /-------------------------------------------------------------------*/ |
| 45 | 45 | ROM_START(spcgambl) |
| 46 | 46 | ROM_REGION(0x10000, "maincpu", 0) |
| 47 | ROM_LOAD("spcgamba.bin", 0x0000, 0x0400, CRC(da312699) SHA1(b1fabfe23d4e5d512623f9b0f3fa8dd38bdbba43)) | |
| 48 | ROM_LOAD("spcgambb.bin", 0x0400, 0x0400, NO_DUMP) | |
| 47 | ROM_LOAD("spcgamba.bin", 0x0000, 0x0400, CRC(3b6e5287) SHA1(4d2fae779bb4117a99a9311b96ab79799f40067b)) | |
| 48 | ROM_LOAD("spcgambb.bin", 0x0400, 0x0400, CRC(5c61f25c) SHA1(44b2d74926bf5678146b6d2347b4147e8a29a660)) | |
| 49 | 49 | ROM_END |
| 50 | 50 | |
| 51 | 51 | /*------------------------------------------------------------------- |
| r10886 | r10887 | |
|---|---|---|
| 293 | 293 | #include "babypkr.lh" |
| 294 | 294 | #include "babydad.lh" |
| 295 | 295 | |
| 296 | #define DATA_NVRAM_SIZE 0x100 | |
| 297 | 296 | |
| 298 | static UINT8 data_ram[0x100]; | |
| 299 | static UINT8 video_ram[0x0400]; | |
| 300 | static UINT8 color_ram[0x0400]; | |
| 301 | static UINT16 p1, p2; | |
| 302 | static UINT8 t0_latch; | |
| 303 | static UINT16 n_offs; | |
| 297 | class videopkr_state : public driver_device | |
| 298 | { | |
| 299 | public: | |
| 300 | videopkr_state(running_machine &machine, const driver_device_config_base &config) | |
| 301 | : driver_device(machine, config) { } | |
| 304 | 302 | |
| 305 | static UINT8 vp_sound_p2; | |
| 306 | static UINT8 p24_data; | |
| 307 | static UINT8 sound_latch; | |
| 308 | static UINT8 baby_latch; | |
| 309 | static UINT8 sound_ant; | |
| 310 | static UINT8 dc_4020; | |
| 311 | static UINT8 dc_40103; | |
| 312 | static UINT8 te_40103; | |
| 313 | static UINT8 ld_40103; | |
| 303 | UINT8 data_ram[0x100]; | |
| 304 | UINT8 video_ram[0x0400]; | |
| 305 | UINT8 color_ram[0x0400]; | |
| 306 | UINT16 p1; | |
| 307 | UINT16 p2; | |
| 308 | UINT8 t0_latch; | |
| 309 | UINT16 n_offs; | |
| 310 | UINT8 vp_sound_p2; | |
| 311 | UINT8 p24_data; | |
| 312 | UINT8 sound_latch; | |
| 313 | UINT8 baby_latch; | |
| 314 | UINT8 sound_ant; | |
| 315 | UINT8 dc_4020; | |
| 316 | UINT8 dc_40103; | |
| 317 | UINT8 te_40103; | |
| 318 | UINT8 ld_40103; | |
| 319 | UINT8 ant_jckp; | |
| 320 | UINT8 jckp; | |
| 321 | UINT8 ant_cio; | |
| 322 | UINT8 c_io; | |
| 323 | UINT8 hp_1; | |
| 324 | UINT8 hp_2; | |
| 325 | UINT8 bell; | |
| 326 | UINT8 aux3; | |
| 327 | UINT8 dvrt; | |
| 328 | unsigned long count0; | |
| 329 | unsigned long count1; | |
| 330 | unsigned long count2; | |
| 331 | unsigned long count3; | |
| 332 | unsigned long count4; | |
| 333 | UINT8 sbp0; | |
| 334 | UINT8 sbp2; | |
| 335 | UINT8 sbp3; | |
| 336 | tilemap_t *bg_tilemap; | |
| 337 | }; | |
| 314 | 338 | |
| 315 | static UINT8 ant_jckp, jckp, ant_cio, c_io, hp_1, hp_2, bell, aux3, dvrt; | |
| 316 | static unsigned long count0, count1, count2, count3, count4; | |
| 317 | 339 | |
| 318 | /* Baby vars */ | |
| 319 | static UINT8 sbp0, sbp2, sbp3; | |
| 340 | #define DATA_NVRAM_SIZE 0x100 | |
| 320 | 341 | |
| 321 | ||
| 322 | 342 | /************************* |
| 323 | 343 | * Video Hardware * |
| 324 | 344 | *************************/ |
| 325 | 345 | |
| 326 | static tilemap_t *bg_tilemap; | |
| 327 | 346 | |
| 328 | 347 | /* BCD to Seven Segment Decoder */ |
| 329 | 348 | static UINT8 dec_7seg(int data) |
| r10886 | r10887 | |
| 450 | 469 | |
| 451 | 470 | static TILE_GET_INFO( get_bg_tile_info ) |
| 452 | 471 | { |
| 472 | videopkr_state *state = machine->driver_data<videopkr_state>(); | |
| 453 | 473 | int offs = tile_index; |
| 454 | int attr = color_ram[offs] + input_port_read(machine, "IN2"); /* Color Switch Action */ | |
| 455 | int code = video_ram[offs]; | |
| 474 | int attr = state->color_ram[offs] + input_port_read(machine, "IN2"); /* Color Switch Action */ | |
| 475 | int code = state->video_ram[offs]; | |
| 456 | 476 | int color = attr; |
| 457 | 477 | SET_TILE_INFO(0, code, color, 0); |
| 458 | 478 | } |
| r10886 | r10887 | |
| 460 | 480 | |
| 461 | 481 | static VIDEO_START( videopkr ) |
| 462 | 482 | { |
| 463 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 483 | videopkr_state *state = machine->driver_data<videopkr_state>(); | |
| 484 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 464 | 485 | } |
| 465 | 486 | |
| 466 | 487 | static VIDEO_START( vidadcba ) |
| 467 | 488 | { |
| 468 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 8, 32, 32); | |
| 489 | videopkr_state *state = machine->driver_data<videopkr_state>(); | |
| 490 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 8, 32, 32); | |
| 469 | 491 | } |
| 470 | 492 | |
| 471 | 493 | |
| 472 | 494 | static SCREEN_UPDATE( videopkr ) |
| 473 | 495 | { |
| 474 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 475 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 496 | videopkr_state *state = screen->machine->driver_data<videopkr_state>(); | |
| 497 | tilemap_mark_all_tiles_dirty(state->bg_tilemap); | |
| 498 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 476 | 499 | return 0; |
| 477 | 500 | } |
| 478 | 501 | |
| r10886 | r10887 | |
| 483 | 506 | |
| 484 | 507 | static READ8_HANDLER( videopkr_io_r ) |
| 485 | 508 | { |
| 509 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 486 | 510 | UINT8 valor = 0, hf, co; |
| 487 | 511 | |
| 488 | 512 | UINT16 kbdin; |
| 489 | 513 | |
| 490 | switch (p2) | |
| 514 | switch (state->p2) | |
| 491 | 515 | { |
| 492 | 516 | case 0xef: /* inputs are multiplexed through a diode matrix */ |
| 493 | 517 | { |
| r10886 | r10887 | |
| 525 | 549 | |
| 526 | 550 | case 0xdf: |
| 527 | 551 | { |
| 528 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 529 | valor = data_ram[offset]; | |
| 552 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 553 | valor = state->data_ram[offset]; | |
| 530 | 554 | break; |
| 531 | 555 | } |
| 532 | 556 | |
| 533 | 557 | case 0x5f: |
| 534 | 558 | { |
| 535 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 536 | valor = data_ram[offset]; | |
| 559 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 560 | valor = state->data_ram[offset]; | |
| 537 | 561 | break; |
| 538 | 562 | } |
| 539 | 563 | |
| r10886 | r10887 | |
| 542 | 566 | case 0x7e: |
| 543 | 567 | case 0x7f: |
| 544 | 568 | { |
| 545 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 546 | valor = color_ram[n_offs]; | |
| 569 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 570 | valor = state->color_ram[state->n_offs]; | |
| 547 | 571 | break; |
| 548 | 572 | } |
| 549 | 573 | |
| r10886 | r10887 | |
| 552 | 576 | case 0xbe: |
| 553 | 577 | case 0xbf: |
| 554 | 578 | { |
| 555 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 556 | valor = video_ram[n_offs]; | |
| 579 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 580 | valor = state->video_ram[state->n_offs]; | |
| 557 | 581 | break; |
| 558 | 582 | } |
| 559 | 583 | } |
| r10886 | r10887 | |
| 563 | 587 | |
| 564 | 588 | static WRITE8_HANDLER( videopkr_io_w ) |
| 565 | 589 | { |
| 566 | switch (p2) | |
| 590 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 591 | switch (state->p2) | |
| 567 | 592 | { |
| 568 | 593 | case 0x3c: |
| 569 | 594 | case 0x3d: |
| 570 | 595 | case 0x3e: |
| 571 | 596 | case 0x3f: |
| 572 | 597 | { |
| 573 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 574 | color_ram[n_offs] = data & 0x0f; | |
| 575 | video_ram[n_offs] = data; | |
| 576 | tilemap_mark_tile_dirty(bg_tilemap, n_offs); | |
| 598 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 599 | state->color_ram[state->n_offs] = data & 0x0f; | |
| 600 | state->video_ram[state->n_offs] = data; | |
| 601 | tilemap_mark_tile_dirty(state->bg_tilemap, state->n_offs); | |
| 577 | 602 | break; |
| 578 | 603 | } |
| 579 | 604 | |
| 580 | 605 | case 0xdf: |
| 581 | 606 | { |
| 582 | data_ram[offset] = (data & 0x0f) + 0xf0; | |
| 607 | state->data_ram[offset] = (data & 0x0f) + 0xf0; | |
| 583 | 608 | break; |
| 584 | 609 | } |
| 585 | 610 | |
| r10886 | r10887 | |
| 588 | 613 | case 0x7e: |
| 589 | 614 | case 0x7f: |
| 590 | 615 | { |
| 591 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 592 | color_ram[n_offs] = data & 0x0f; | |
| 593 | tilemap_mark_tile_dirty(bg_tilemap, n_offs); | |
| 616 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 617 | state->color_ram[state->n_offs] = data & 0x0f; | |
| 618 | tilemap_mark_tile_dirty(state->bg_tilemap, state->n_offs); | |
| 594 | 619 | break; |
| 595 | 620 | } |
| 596 | 621 | |
| r10886 | r10887 | |
| 599 | 624 | case 0xbe: |
| 600 | 625 | case 0xbf: |
| 601 | 626 | { |
| 602 | n_offs = ((p1 & 0xc0) << 2 ) + offset; | |
| 603 | video_ram[n_offs] = data; | |
| 604 | tilemap_mark_tile_dirty(bg_tilemap, n_offs); | |
| 627 | state->n_offs = ((state->p1 & 0xc0) << 2 ) + offset; | |
| 628 | state->video_ram[state->n_offs] = data; | |
| 629 | tilemap_mark_tile_dirty(state->bg_tilemap, state->n_offs); | |
| 605 | 630 | break; |
| 606 | 631 | } |
| 607 | 632 | |
| r10886 | r10887 | |
| 615 | 640 | output_set_lamp_value(5, ((data >> 5) & 1)); /* Hopper_1 */ |
| 616 | 641 | output_set_lamp_value(6, ((data >> 6) & 1)); /* Hopper_2 */ |
| 617 | 642 | output_set_lamp_value(7, ((data >> 7) & 1)); /* Diverter */ |
| 618 | p24_data = data; | |
| 619 | hp_1 = (~p24_data >> 6) & 1; | |
| 620 | hp_2 = (~p24_data >> 5) & 1; | |
| 621 | dvrt = (~p24_data >> 7) & 1; | |
| 643 | state->p24_data = data; | |
| 644 | state->hp_1 = (~state->p24_data >> 6) & 1; | |
| 645 | state->hp_2 = (~state->p24_data >> 5) & 1; | |
| 646 | state->dvrt = (~state->p24_data >> 7) & 1; | |
| 622 | 647 | break; |
| 623 | 648 | } |
| 624 | 649 | |
| 625 | 650 | case 0xff: |
| 626 | 651 | { |
| 627 | t0_latch = t0_latch ^ 0x01; /* fix the bookkeeping mode */ | |
| 652 | state->t0_latch = state->t0_latch ^ 0x01; /* fix the bookkeeping mode */ | |
| 628 | 653 | break; |
| 629 | 654 | } |
| 630 | 655 | } |
| r10886 | r10887 | |
| 632 | 657 | |
| 633 | 658 | static READ8_HANDLER( videopkr_p1_data_r ) |
| 634 | 659 | { |
| 635 | return p1; | |
| 660 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 661 | return state->p1; | |
| 636 | 662 | } |
| 637 | 663 | |
| 638 | 664 | static READ8_HANDLER( videopkr_p2_data_r ) |
| 639 | 665 | { |
| 640 | return p2; | |
| 666 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 667 | return state->p2; | |
| 641 | 668 | } |
| 642 | 669 | |
| 643 | 670 | static WRITE8_HANDLER( videopkr_p1_data_w ) |
| 644 | 671 | { |
| 645 | p1 = data; | |
| 672 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 673 | state->p1 = data; | |
| 646 | 674 | |
| 647 | 675 | output_set_lamp_value(8, (data & 1)); /* Aux_0 - Jackpot mech. counter (Baby Games)*/ |
| 648 | 676 | output_set_lamp_value(9, ((data >> 1) & 1)); /* Aux_1 - */ |
| r10886 | r10887 | |
| 651 | 679 | output_set_lamp_value(12, ((data >> 4) & 1)); /* Aux_4 - Bell */ |
| 652 | 680 | output_set_lamp_value(13, ((data >> 5) & 1)); /* Aux_5 - /CIO */ |
| 653 | 681 | |
| 654 | jckp = p1 & 1; | |
| 682 | state->jckp = state->p1 & 1; | |
| 655 | 683 | |
| 656 | if ((~c_io & 1) & ant_cio & hp_1 & hp_2) | |
| 684 | if ((~state->c_io & 1) & state->ant_cio & state->hp_1 & state->hp_2) | |
| 657 | 685 | { |
| 658 | ++count1; /* Decoded Coin In Mech. Counter*/ | |
| 686 | ++state->count1; /* Decoded Coin In Mech. Counter*/ | |
| 659 | 687 | } |
| 660 | 688 | |
| 661 | if ((~c_io & 1) & ant_cio & (~hp_1 & 1) & (~hp_2 & 1)) | |
| 689 | if ((~state->c_io & 1) & state->ant_cio & (~state->hp_1 & 1) & (~state->hp_2 & 1)) | |
| 662 | 690 | { |
| 663 | ++count2; /* Decoded Coind Out Mech. Counter */ | |
| 691 | ++state->count2; /* Decoded Coind Out Mech. Counter */ | |
| 664 | 692 | } |
| 665 | 693 | |
| 666 | if (~c_io & ant_cio & hp_1 & hp_2 & ~dvrt) | |
| 694 | if (~state->c_io & state->ant_cio & state->hp_1 & state->hp_2 & ~state->dvrt) | |
| 667 | 695 | { |
| 668 | ++count3; /* Decoded Coin to Drop Mech. Counter */ | |
| 696 | ++state->count3; /* Decoded Coin to Drop Mech. Counter */ | |
| 669 | 697 | } |
| 670 | 698 | |
| 671 | if (~jckp & ant_jckp) | |
| 699 | if (~state->jckp & state->ant_jckp) | |
| 672 | 700 | { |
| 673 | ++count4; /* Decoded Jackpot Mech. Counter */ | |
| 701 | ++state->count4; /* Decoded Jackpot Mech. Counter */ | |
| 674 | 702 | } |
| 675 | 703 | |
| 676 | count_7dig(count1, 0); | |
| 677 | count_7dig(count2, 7); | |
| 678 | count_7dig(count3, 14); | |
| 679 | count_7dig(count4, 21); | |
| 704 | count_7dig(state->count1, 0); | |
| 705 | count_7dig(state->count2, 7); | |
| 706 | count_7dig(state->count3, 14); | |
| 707 | count_7dig(state->count4, 21); | |
| 680 | 708 | |
| 681 | ant_cio = c_io; | |
| 682 | ant_jckp = jckp; | |
| 709 | state->ant_cio = state->c_io; | |
| 710 | state->ant_jckp = state->jckp; | |
| 683 | 711 | } |
| 684 | 712 | |
| 685 | 713 | static WRITE8_HANDLER( videopkr_p2_data_w ) |
| 686 | 714 | { |
| 687 | p2 = data; | |
| 715 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 716 | state->p2 = data; | |
| 688 | 717 | } |
| 689 | 718 | |
| 690 | 719 | static READ8_HANDLER( videopkr_t0_latch ) |
| 691 | 720 | { |
| 692 | return t0_latch; | |
| 721 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 722 | return state->t0_latch; | |
| 693 | 723 | } |
| 694 | 724 | |
| 695 | 725 | static WRITE8_HANDLER( prog_w ) |
| r10886 | r10887 | |
| 736 | 766 | |
| 737 | 767 | static READ8_HANDLER(sound_io_r) |
| 738 | 768 | { |
| 739 | switch (vp_sound_p2) | |
| 769 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 770 | switch (state->vp_sound_p2) | |
| 740 | 771 | { |
| 741 | 772 | case 0xbf: |
| 742 | 773 | { |
| 743 | c_io = (p1 >> 5) & 1; | |
| 744 | hp_1 = (~p24_data >> 6) & 1; | |
| 745 | hp_2 = (~p24_data >> 5) & 1; | |
| 746 | bell = (p1 >> 4) & 1; | |
| 747 | aux3 = (p1 >> 3) & 1; | |
| 748 | dvrt = (~p24_data >> 7) & 1; | |
| 749 | sound_ant = sound_latch; | |
| 750 | sound_latch = c_io + (hp_1 << 1) + (hp_2 << 2) + (bell << 3) + 0xf0; | |
| 774 | state->c_io = (state->p1 >> 5) & 1; | |
| 775 | state->hp_1 = (~state->p24_data >> 6) & 1; | |
| 776 | state->hp_2 = (~state->p24_data >> 5) & 1; | |
| 777 | state->bell = (state->p1 >> 4) & 1; | |
| 778 | state->aux3 = (state->p1 >> 3) & 1; | |
| 779 | state->dvrt = (~state->p24_data >> 7) & 1; | |
| 780 | state->sound_ant = state->sound_latch; | |
| 781 | state->sound_latch = state->c_io + (state->hp_1 << 1) + (state->hp_2 << 2) + (state->bell << 3) + 0xf0; | |
| 751 | 782 | |
| 752 | 783 | break; |
| 753 | 784 | } |
| 754 | 785 | } |
| 755 | 786 | |
| 756 | return sound_latch; | |
| 787 | return state->sound_latch; | |
| 757 | 788 | } |
| 758 | 789 | |
| 759 | 790 | static WRITE8_HANDLER(sound_io_w) |
| 760 | 791 | { |
| 761 | if (vp_sound_p2 == 0x5f || vp_sound_p2 == 0xdf) | |
| 792 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 793 | if (state->vp_sound_p2 == 0x5f || state->vp_sound_p2 == 0xdf) | |
| 762 | 794 | { |
| 763 | dc_40103 = data; | |
| 764 | dc_4020 = 0; | |
| 795 | state->dc_40103 = data; | |
| 796 | state->dc_4020 = 0; | |
| 765 | 797 | } |
| 766 | 798 | } |
| 767 | 799 | |
| 768 | 800 | static READ8_HANDLER(sound_p2_r) |
| 769 | 801 | { |
| 770 | return vp_sound_p2; | |
| 802 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 803 | return state->vp_sound_p2; | |
| 771 | 804 | } |
| 772 | 805 | |
| 773 | 806 | static WRITE8_HANDLER(sound_p2_w) |
| 774 | 807 | { |
| 775 | vp_sound_p2 = data; | |
| 808 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 809 | state->vp_sound_p2 = data; | |
| 776 | 810 | |
| 777 | 811 | switch (data) |
| 778 | 812 | { |
| 779 | 813 | case 0x5f: |
| 780 | 814 | { |
| 781 | te_40103 = 0; /* p2.7 LOW */ | |
| 782 | ld_40103 = 0; /* p2.5 LOW */ | |
| 815 | state->te_40103 = 0; /* p2.7 LOW */ | |
| 816 | state->ld_40103 = 0; /* p2.5 LOW */ | |
| 783 | 817 | break; |
| 784 | 818 | } |
| 785 | 819 | |
| 786 | 820 | case 0x7f: |
| 787 | 821 | { |
| 788 | te_40103 = 0; | |
| 789 | ld_40103 = 1; | |
| 822 | state->te_40103 = 0; | |
| 823 | state->ld_40103 = 1; | |
| 790 | 824 | break; |
| 791 | 825 | } |
| 792 | 826 | |
| 793 | 827 | case 0xff: |
| 794 | 828 | { |
| 795 | te_40103 = 1; | |
| 796 | ld_40103 = 1; | |
| 829 | state->te_40103 = 1; | |
| 830 | state->ld_40103 = 1; | |
| 797 | 831 | break; |
| 798 | 832 | } |
| 799 | 833 | } |
| r10886 | r10887 | |
| 804 | 838 | |
| 805 | 839 | static READ8_HANDLER(baby_sound_p0_r) |
| 806 | 840 | { |
| 807 | return sbp0; | |
| 841 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 842 | return state->sbp0; | |
| 808 | 843 | } |
| 809 | 844 | |
| 810 | 845 | static WRITE8_HANDLER(baby_sound_p0_w) |
| 811 | 846 | { |
| 812 | sbp0 = data; | |
| 847 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 848 | state->sbp0 = data; | |
| 813 | 849 | } |
| 814 | 850 | |
| 815 | 851 | static READ8_HANDLER(baby_sound_p1_r) |
| 816 | 852 | { |
| 817 | c_io = (p1 >> 5) & 1; | |
| 818 | hp_1 = (~p24_data >> 6) & 1; | |
| 819 | hp_2 = (~p24_data >> 5) & 1; | |
| 820 | bell = (p1 >> 4) & 1; | |
| 821 | aux3 = (p1 >> 3) & 1; | |
| 822 | baby_latch = c_io + (hp_1 << 1) + (hp_2 << 2) + (bell << 3) + (aux3 << 4) + 0xe0; | |
| 823 | return baby_latch; | |
| 853 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 854 | state->c_io = (state->p1 >> 5) & 1; | |
| 855 | state->hp_1 = (~state->p24_data >> 6) & 1; | |
| 856 | state->hp_2 = (~state->p24_data >> 5) & 1; | |
| 857 | state->bell = (state->p1 >> 4) & 1; | |
| 858 | state->aux3 = (state->p1 >> 3) & 1; | |
| 859 | state->baby_latch = state->c_io + (state->hp_1 << 1) + (state->hp_2 << 2) + (state->bell << 3) + (state->aux3 << 4) + 0xe0; | |
| 860 | return state->baby_latch; | |
| 824 | 861 | } |
| 825 | 862 | |
| 826 | 863 | static WRITE8_HANDLER(baby_sound_p1_w) |
| 827 | 864 | { |
| 828 | baby_latch = baby_latch | data; | |
| 865 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 866 | state->baby_latch = state->baby_latch | data; | |
| 829 | 867 | } |
| 830 | 868 | |
| 831 | 869 | static READ8_HANDLER(baby_sound_p2_r) |
| 832 | 870 | { |
| 833 | return sbp2; | |
| 871 | videopkr_state *state = space->machine->driver_data<videopkr_state>(); | |
| 872 | return state->sbp2; | |
| 834 | 873 | } |
| 835 | 874 | |
| 836 | 875 | static WRITE8_DEVICE_HANDLER(baby_sound_p2_w) |
| 837 | 876 | { |
| 838 | sbp2 = data; | |
| 877 | videopkr_state *state = device->machine->driver_data<videopkr_state>(); | |
| 878 | state->sbp2 = data; | |
| 839 | 879 | dac_data_w(device, data); |
| 840 | 880 | } |
| 841 | 881 | |
| 842 | 882 | static READ8_DEVICE_HANDLER(baby_sound_p3_r) |
| 843 | 883 | { |
| 844 | return sbp3; | |
| 884 | videopkr_state *state = device->machine->driver_data<videopkr_state>(); | |
| 885 | return state->sbp3; | |
| 845 | 886 | } |
| 846 | 887 | |
| 847 | 888 | static WRITE8_DEVICE_HANDLER(baby_sound_p3_w) |
| 848 | 889 | { |
| 890 | videopkr_state *state = device->machine->driver_data<videopkr_state>(); | |
| 849 | 891 | UINT8 lmp_ports, ay_intf; |
| 850 | sbp3 = data; | |
| 851 | lmp_ports = sbp3 >> 1 & 0x07; | |
| 892 | state->sbp3 = data; | |
| 893 | lmp_ports = state->sbp3 >> 1 & 0x07; | |
| 852 | 894 | |
| 853 | 895 | output_set_value("TOP_1", (lmp_ports >> 0) & 1); |
| 854 | 896 | output_set_value("TOP_2", (lmp_ports >> 1) & 1); |
| 855 | 897 | output_set_value("TOP_3", (lmp_ports >> 2) & 1); |
| 856 | 898 | |
| 857 | if (!(sbp3 & 0x10)) | |
| 899 | if (!(state->sbp3 & 0x10)) | |
| 858 | 900 | { |
| 859 | 901 | device->reset(); |
| 860 | 902 | logerror("AY3-8910: Reset\n"); |
| 861 | 903 | } |
| 862 | 904 | |
| 863 | ay_intf = (sbp3 >> 5) & 0x07; | |
| 905 | ay_intf = (state->sbp3 >> 5) & 0x07; | |
| 864 | 906 | |
| 865 | 907 | switch (ay_intf) |
| 866 | 908 | { |
| 867 | 909 | case 0x00: break; |
| 868 | 910 | case 0x01: break; |
| 869 | 911 | case 0x02: break; |
| 870 | case 0x03: ay8910_data_w(device, 1, sbp0); break; | |
| 912 | case 0x03: ay8910_data_w(device, 1, state->sbp0); break; | |
| 871 | 913 | case 0x04: break; |
| 872 | case 0x05: sbp0 = ay8910_r(device, sbp0); break; | |
| 914 | case 0x05: state->sbp0 = ay8910_r(device, state->sbp0); break; | |
| 873 | 915 | case 0x06: break; |
| 874 | case 0x07: ay8910_address_w(device, 0, sbp0); break; | |
| 916 | case 0x07: ay8910_address_w(device, 0, state->sbp0); break; | |
| 875 | 917 | } |
| 876 | 918 | } |
| 877 | 919 | |
| 878 | 920 | |
| 879 | 921 | static TIMER_DEVICE_CALLBACK(sound_t1_callback) |
| 880 | 922 | { |
| 881 | if (te_40103 == 1) | |
| 923 | videopkr_state *state = timer.machine->driver_data<videopkr_state>(); | |
| 924 | if (state->te_40103 == 1) | |
| 882 | 925 | { |
| 883 | dc_40103++; | |
| 926 | state->dc_40103++; | |
| 884 | 927 | |
| 885 | if (dc_40103 == 0) | |
| 928 | if (state->dc_40103 == 0) | |
| 886 | 929 | { |
| 887 | 930 | cputag_set_input_line(timer.machine, "soundcpu", 0, ASSERT_LINE); |
| 888 | 931 | } |
| r10886 | r10887 | |
| 1150 | 1193 | |
| 1151 | 1194 | static MACHINE_START(videopkr) |
| 1152 | 1195 | { |
| 1153 | vp_sound_p2 = 0xff; /* default P2 latch value */ | |
| 1154 | sound_latch = 0xff; /* default sound data latch value */ | |
| 1155 | p24_data = 0xff; | |
| 1156 | p1 = 0xff; | |
| 1157 | ant_cio = 0; | |
| 1158 | count0 = 0; | |
| 1196 | videopkr_state *state = machine->driver_data<videopkr_state>(); | |
| 1197 | state->vp_sound_p2 = 0xff; /* default P2 latch value */ | |
| 1198 | state->sound_latch = 0xff; /* default sound data latch value */ | |
| 1199 | state->p24_data = 0xff; | |
| 1200 | state->p1 = 0xff; | |
| 1201 | state->ant_cio = 0; | |
| 1202 | state->count0 = 0; | |
| 1159 | 1203 | |
| 1160 | machine->device<nvram_device>("nvram")->set_base(data_ram, sizeof(data_ram)); | |
| 1204 | machine->device<nvram_device>("nvram")->set_base(state->data_ram, sizeof(state->data_ram)); | |
| 1161 | 1205 | } |
| 1162 | 1206 | |
| 1163 | 1207 | static const ay8910_interface ay8910_config = |
| r10886 | r10887 | |
| 1175 | 1219 | * Machine Drivers * |
| 1176 | 1220 | ************************/ |
| 1177 | 1221 | |
| 1178 | static MACHINE_CONFIG_START( videopkr, | |
| 1222 | static MACHINE_CONFIG_START( videopkr, | |
| 1179 | 1223 | |
| 1180 | 1224 | /* basic machine hardware */ |
| 1181 | 1225 | MCFG_CPU_ADD("maincpu", I8039, CPU_CLOCK) |
| r10886 | r10887 | |
|---|---|---|
| 91 | 91 | #include "mil4000.lh" |
| 92 | 92 | |
| 93 | 93 | |
| 94 | static UINT16 *sc0_vram,*sc1_vram,*sc2_vram,*sc3_vram; | |
| 95 | static tilemap_t *sc0_tilemap,*sc1_tilemap,*sc2_tilemap,*sc3_tilemap; | |
| 94 | class mil4000_state : public driver_device | |
| 95 | { | |
| 96 | public: | |
| 97 | mil4000_state(running_machine &machine, const driver_device_config_base &config) | |
| 98 | : driver_device(machine, config) { } | |
| 96 | 99 | |
| 100 | UINT16 *sc0_vram; | |
| 101 | UINT16 *sc1_vram; | |
| 102 | UINT16 *sc2_vram; | |
| 103 | UINT16 *sc3_vram; | |
| 104 | tilemap_t *sc0_tilemap; | |
| 105 | tilemap_t *sc1_tilemap; | |
| 106 | tilemap_t *sc2_tilemap; | |
| 107 | tilemap_t *sc3_tilemap; | |
| 108 | UINT16 vblank; | |
| 109 | UINT16 hblank; | |
| 110 | }; | |
| 111 | ||
| 112 | ||
| 97 | 113 | static TILE_GET_INFO( get_sc0_tile_info ) |
| 98 | 114 | { |
| 99 | UINT32 data = (sc0_vram[tile_index*2]<<16) | sc0_vram[tile_index*2+1]; | |
| 115 | mil4000_state *state = machine->driver_data<mil4000_state>(); | |
| 116 | UINT32 data = (state->sc0_vram[tile_index*2]<<16) | state->sc0_vram[tile_index*2+1]; | |
| 100 | 117 | int tile = data >> 14; |
| 101 | int color = (sc0_vram[tile_index*2+1] & 0x1f)+0; | |
| 118 | int color = (state->sc0_vram[tile_index*2+1] & 0x1f)+0; | |
| 102 | 119 | |
| 103 | 120 | SET_TILE_INFO( |
| 104 | 121 | 0, |
| r10886 | r10887 | |
| 109 | 126 | |
| 110 | 127 | static TILE_GET_INFO( get_sc1_tile_info ) |
| 111 | 128 | { |
| 112 | UINT32 data = (sc1_vram[tile_index*2]<<16) | sc1_vram[tile_index*2+1]; | |
| 129 | mil4000_state *state = machine->driver_data<mil4000_state>(); | |
| 130 | UINT32 data = (state->sc1_vram[tile_index*2]<<16) | state->sc1_vram[tile_index*2+1]; | |
| 113 | 131 | int tile = data >> 14; |
| 114 | int color = (sc1_vram[tile_index*2+1] & 0x1f)+0x10; | |
| 132 | int color = (state->sc1_vram[tile_index*2+1] & 0x1f)+0x10; | |
| 115 | 133 | |
| 116 | 134 | SET_TILE_INFO( |
| 117 | 135 | 0, |
| r10886 | r10887 | |
| 122 | 140 | |
| 123 | 141 | static TILE_GET_INFO( get_sc2_tile_info ) |
| 124 | 142 | { |
| 125 | UINT32 data = (sc2_vram[tile_index*2]<<16) | sc2_vram[tile_index*2+1]; | |
| 143 | mil4000_state *state = machine->driver_data<mil4000_state>(); | |
| 144 | UINT32 data = (state->sc2_vram[tile_index*2]<<16) | state->sc2_vram[tile_index*2+1]; | |
| 126 | 145 | int tile = data >> 14; |
| 127 | int color = (sc2_vram[tile_index*2+1] & 0x1f)+0x20; | |
| 146 | int color = (state->sc2_vram[tile_index*2+1] & 0x1f)+0x20; | |
| 128 | 147 | |
| 129 | 148 | SET_TILE_INFO( |
| 130 | 149 | 0, |
| r10886 | r10887 | |
| 135 | 154 | |
| 136 | 155 | static TILE_GET_INFO( get_sc3_tile_info ) |
| 137 | 156 | { |
| 138 | UINT32 data = (sc3_vram[tile_index*2]<<16) | sc3_vram[tile_index*2+1]; | |
| 157 | mil4000_state *state = machine->driver_data<mil4000_state>(); | |
| 158 | UINT32 data = (state->sc3_vram[tile_index*2]<<16) | state->sc3_vram[tile_index*2+1]; | |
| 139 | 159 | int tile = data >> 14; |
| 140 | int color = (sc3_vram[tile_index*2+1] & 0x1f)+0x30; | |
| 160 | int color = (state->sc3_vram[tile_index*2+1] & 0x1f)+0x30; | |
| 141 | 161 | |
| 142 | 162 | SET_TILE_INFO( |
| 143 | 163 | 0, |
| r10886 | r10887 | |
| 148 | 168 | |
| 149 | 169 | static VIDEO_START(mil4000) |
| 150 | 170 | { |
| 151 | sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 152 | sc1_tilemap = tilemap_create(machine, get_sc1_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 153 | sc2_tilemap = tilemap_create(machine, get_sc2_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 154 | sc3_tilemap = tilemap_create(machine, get_sc3_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 171 | mil4000_state *state = machine->driver_data<mil4000_state>(); | |
| 172 | state->sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 173 | state->sc1_tilemap = tilemap_create(machine, get_sc1_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 174 | state->sc2_tilemap = tilemap_create(machine, get_sc2_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 175 | state->sc3_tilemap = tilemap_create(machine, get_sc3_tile_info,tilemap_scan_rows,8,8,64,64); | |
| 155 | 176 | |
| 156 | tilemap_set_transparent_pen(sc1_tilemap,0); | |
| 157 | tilemap_set_transparent_pen(sc2_tilemap,0); | |
| 158 | tilemap_set_transparent_pen(sc3_tilemap,0); | |
| 177 | tilemap_set_transparent_pen(state->sc1_tilemap,0); | |
| 178 | tilemap_set_transparent_pen(state->sc2_tilemap,0); | |
| 179 | tilemap_set_transparent_pen(state->sc3_tilemap,0); | |
| 159 | 180 | } |
| 160 | 181 | |
| 161 | 182 | static SCREEN_UPDATE(mil4000) |
| 162 | 183 | { |
| 163 | tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); | |
| 164 | tilemap_draw(bitmap,cliprect,sc1_tilemap,0,0); | |
| 165 | tilemap_draw(bitmap,cliprect,sc2_tilemap,0,0); | |
| 166 | tilemap_draw(bitmap,cliprect,sc3_tilemap,0,0); | |
| 184 | mil4000_state *state = screen->machine->driver_data<mil4000_state>(); | |
| 185 | tilemap_draw(bitmap,cliprect,state->sc0_tilemap,0,0); | |
| 186 | tilemap_draw(bitmap,cliprect,state->sc1_tilemap,0,0); | |
| 187 | tilemap_draw(bitmap,cliprect,state->sc2_tilemap,0,0); | |
| 188 | tilemap_draw(bitmap,cliprect,state->sc3_tilemap,0,0); | |
| 167 | 189 | return 0; |
| 168 | 190 | } |
| 169 | 191 | |
| 170 | 192 | /*TODO*/ |
| 171 | 193 | static READ16_HANDLER( hvretrace_r ) |
| 172 | 194 | { |
| 173 | static UINT16 res; | |
| 174 | static UINT16 vblank = 0,hblank = 0; | |
| 195 | mil4000_state *state = space->machine->driver_data<mil4000_state>(); | |
| 196 | UINT16 res; | |
| 175 | 197 | |
| 176 | 198 | res = 0; |
| 177 | 199 | |
| 178 | vblank^=1; | |
| 179 | hblank^=1; | |
| 200 | state->vblank^=1; | |
| 201 | state->hblank^=1; | |
| 180 | 202 | |
| 181 | 203 | /*V-Blank*/ |
| 182 | if (vblank) | |
| 204 | if (state->vblank) | |
| 183 | 205 | res|= 0x80; |
| 184 | 206 | |
| 185 | 207 | /*H-Blank*/ |
| 186 | if (hblank) | |
| 208 | if (state->hblank) | |
| 187 | 209 | res|= 0x40; |
| 188 | 210 | |
| 189 | 211 | return res; |
| r10886 | r10887 | |
| 192 | 214 | |
| 193 | 215 | static WRITE16_HANDLER( sc0_vram_w ) |
| 194 | 216 | { |
| 195 | sc0_vram[offset] = data; | |
| 196 | tilemap_mark_tile_dirty(sc0_tilemap,offset/2); | |
| 217 | mil4000_state *state = space->machine->driver_data<mil4000_state>(); | |
| 218 | state->sc0_vram[offset] = data; | |
| 219 | tilemap_mark_tile_dirty(state->sc0_tilemap,offset/2); | |
| 197 | 220 | } |
| 198 | 221 | |
| 199 | 222 | static WRITE16_HANDLER( sc1_vram_w ) |
| 200 | 223 | { |
| 201 | sc1_vram[offset] = data; | |
| 202 | tilemap_mark_tile_dirty(sc1_tilemap,offset/2); | |
| 224 | mil4000_state *state = space->machine->driver_data<mil4000_state>(); | |
| 225 | state->sc1_vram[offset] = data; | |
| 226 | tilemap_mark_tile_dirty(state->sc1_tilemap,offset/2); | |
| 203 | 227 | } |
| 204 | 228 | |
| 205 | 229 | static WRITE16_HANDLER( sc2_vram_w ) |
| 206 | 230 | { |
| 207 | sc2_vram[offset] = data; | |
| 208 | tilemap_mark_tile_dirty(sc2_tilemap,offset/2); | |
| 231 | mil4000_state *state = space->machine->driver_data<mil4000_state>(); | |
| 232 | state->sc2_vram[offset] = data; | |
| 233 | tilemap_mark_tile_dirty(state->sc2_tilemap,offset/2); | |
| 209 | 234 | } |
| 210 | 235 | |
| 211 | 236 | static WRITE16_HANDLER( sc3_vram_w ) |
| 212 | 237 | { |
| 213 | sc3_vram[offset] = data; | |
| 214 | tilemap_mark_tile_dirty(sc3_tilemap,offset/2); | |
| 238 | mil4000_state *state = space->machine->driver_data<mil4000_state>(); | |
| 239 | state->sc3_vram[offset] = data; | |
| 240 | tilemap_mark_tile_dirty(state->sc3_tilemap,offset/2); | |
| 215 | 241 | } |
| 216 | 242 | |
| 217 | 243 | /*end of video stuff*/ |
| r10886 | r10887 | |
| 228 | 254 | */ |
| 229 | 255 | static WRITE16_HANDLER( output_w ) |
| 230 | 256 | { |
| 231 | | |
| 257 | | |
| 232 | 258 | |
| 233 | 259 | for(i=0;i<3;i++) |
| 234 | 260 | coin_counter_w(space->machine, i, data & 0x2000); |
| r10886 | r10887 | |
| 246 | 272 | |
| 247 | 273 | static ADDRESS_MAP_START( mil4000_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 248 | 274 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 249 | AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(&sc0_vram) // CY62256L-70, U77 | |
| 250 | AM_RANGE(0x504000, 0x507fff) AM_RAM_WRITE(sc1_vram_w) AM_BASE(&sc1_vram) // CY62256L-70, U77 | |
| 251 | AM_RANGE(0x508000, 0x50bfff) AM_RAM_WRITE(sc2_vram_w) AM_BASE(&sc2_vram) // CY62256L-70, U78 | |
| 252 | AM_RANGE(0x50c000, 0x50ffff) AM_RAM_WRITE(sc3_vram_w) AM_BASE(&sc3_vram) // CY62256L-70, U78 | |
| 275 | AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(sc0_vram_w) AM_BASE_MEMBER(mil4000_state, sc0_vram) // CY62256L-70, U77 | |
| 276 | AM_RANGE(0x504000, 0x507fff) AM_RAM_WRITE(sc1_vram_w) AM_BASE_MEMBER(mil4000_state, sc1_vram) // CY62256L-70, U77 | |
| 277 | AM_RANGE(0x508000, 0x50bfff) AM_RAM_WRITE(sc2_vram_w) AM_BASE_MEMBER(mil4000_state, sc2_vram) // CY62256L-70, U78 | |
| 278 | AM_RANGE(0x50c000, 0x50ffff) AM_RAM_WRITE(sc3_vram_w) AM_BASE_MEMBER(mil4000_state, sc3_vram) // CY62256L-70, U78 | |
| 253 | 279 | |
| 254 | 280 | AM_RANGE(0x708000, 0x708001) AM_READ_PORT("IN0") |
| 255 | 281 | AM_RANGE(0x708002, 0x708003) AM_READ_PORT("IN1") |
| r10886 | r10887 | |
| 337 | 363 | GFXDECODE_END |
| 338 | 364 | |
| 339 | 365 | |
| 340 | static MACHINE_CONFIG_START( mil4000, | |
| 366 | static MACHINE_CONFIG_START( mil4000, m | |
| 341 | 367 | MCFG_CPU_ADD("maincpu", M68000, 12000000 ) // ? |
| 342 | 368 | MCFG_CPU_PROGRAM_MAP(mil4000_map) |
| 343 | 369 | // irq 2/4/5 point to the same place, others invalid |
| r10886 | r10887 | |
|---|---|---|
| 165 | 165 | #include "sound/c140.h" |
| 166 | 166 | #include "cpu/m37710/m37710.h" |
| 167 | 167 | |
| 168 | static UINT16 *mpBank0, *mpBank1; | |
| 169 | static int mEnableInterrupts; | |
| 170 | static int namcona1_gametype; | |
| 171 | 168 | |
| 172 | 169 | /*************************************************************************/ |
| 173 | 170 | |
| r10886 | r10887 | |
| 203 | 200 | 0x00,0x02,0x00,0x00,0x00,0x01 |
| 204 | 201 | }; /* CgangpzlDefaultNvMem */ |
| 205 | 202 | |
| 206 | static UINT8 namcona1_nvmem[NA1_NVRAM_SIZE]; | |
| 207 | 203 | |
| 208 | 204 | static NVRAM_HANDLER( namcosna1 ) |
| 209 | 205 | { |
| 206 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 210 | 207 | if( read_or_write ) |
| 211 | 208 | { |
| 212 | file->write( | |
| 209 | file->write( state-> | |
| 213 | 210 | } |
| 214 | 211 | else |
| 215 | 212 | { |
| 216 | 213 | if (file) |
| 217 | 214 | { |
| 218 | file->read( | |
| 215 | file->read( state-> | |
| 219 | 216 | } |
| 220 | 217 | else |
| 221 | 218 | { |
| 222 | memset( | |
| 219 | memset( state-> | |
| 223 | 220 | |
| 224 | switch( | |
| 221 | switch( state-> | |
| 225 | 222 | { |
| 226 | 223 | case NAMCO_EXBANIA: |
| 227 | memcpy( | |
| 224 | memcpy( state-> | |
| 228 | 225 | break; |
| 229 | 226 | |
| 230 | 227 | case NAMCO_QUIZTOU: |
| 231 | memcpy( | |
| 228 | memcpy( state-> | |
| 232 | 229 | break; |
| 233 | 230 | |
| 234 | 231 | case NAMCO_CGANGPZL: |
| 235 | memcpy( | |
| 232 | memcpy( state-> | |
| 236 | 233 | break; |
| 237 | 234 | } |
| 238 | 235 | } |
| r10886 | r10887 | |
| 241 | 238 | |
| 242 | 239 | static READ16_HANDLER( namcona1_nvram_r ) |
| 243 | 240 | { |
| 244 | return namcona1_nvmem[offset]; | |
| 241 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 242 | return state->nvmem[offset]; | |
| 245 | 243 | } /* namcona1_nvram_r */ |
| 246 | 244 | |
| 247 | 245 | static WRITE16_HANDLER( namcona1_nvram_w ) |
| 248 | 246 | { |
| 247 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 249 | 248 | if( ACCESSING_BITS_0_7 ) |
| 250 | 249 | { |
| 251 | | |
| 250 | state-> | |
| 252 | 251 | } |
| 253 | 252 | } /* namcona1_nvram_w */ |
| 254 | 253 | |
| r10886 | r10887 | |
| 372 | 371 | /* FIXME: These two functions shouldn't be necessary? */ |
| 373 | 372 | static void simulate_mcu( running_machine *machine ) |
| 374 | 373 | { |
| 375 | namcona1_workram[0xf60/2] = 0x0000; /* mcu ready */ | |
| 374 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 375 | state->workram[0xf60/2] = 0x0000; /* mcu ready */ | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
| 379 | 379 | /* NA2 hardware sends a special command to the MCU, then tests to |
| 380 | 380 | * see if the proper BIOS version string appears in shared memory. |
| 381 | 381 | */ |
| 382 | static void write_version_info( | |
| 382 | static void write_version_info( namcona1_state *state ) | |
| 383 | 383 | { |
| 384 | 384 | static const UINT16 source[0x8] = |
| 385 | 385 | { /* "NSA-BIOS ver"... */ |
| r10886 | r10887 | |
| 388 | 388 | int i; |
| 389 | 389 | for( i=0; i<8; i++ ) |
| 390 | 390 | { |
| 391 | | |
| 391 | state-> | |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| r10886 | r10887 | |
| 403 | 403 | */ |
| 404 | 404 | static READ16_HANDLER( custom_key_r ) |
| 405 | 405 | { |
| 406 | static UINT16 count; | |
| 407 | static UINT32 keyval; | |
| 406 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 408 | 407 | int old_count; |
| 409 | 408 | |
| 410 | old_count = count; | |
| 409 | old_count = state->count; | |
| 411 | 410 | do |
| 412 | 411 | { |
| 413 | count = space->machine->rand(); | |
| 414 | } while( old_count == count ); | |
| 412 | state->count = space->machine->rand(); | |
| 413 | } while( old_count == state->count ); | |
| 415 | 414 | |
| 416 | switch( | |
| 415 | switch( state-> | |
| 417 | 416 | { |
| 418 | 417 | case NAMCO_BKRTMAQ: |
| 419 | 418 | if( offset==2 ) return 0x015c; |
| r10886 | r10887 | |
| 421 | 420 | |
| 422 | 421 | case NAMCO_FA: |
| 423 | 422 | if( offset==2 ) return 0x015d; |
| 424 | if( offset==4 ) return count; | |
| 423 | if( offset==4 ) return state->count; | |
| 425 | 424 | break; |
| 426 | 425 | |
| 427 | 426 | case NAMCO_EXBANIA: |
| r10886 | r10887 | |
| 430 | 429 | |
| 431 | 430 | case NAMCO_CGANGPZL: |
| 432 | 431 | if( offset==1 ) return 0x0164; |
| 433 | if( offset==2 ) return count; | |
| 432 | if( offset==2 ) return state->count; | |
| 434 | 433 | break; |
| 435 | 434 | |
| 436 | 435 | case NAMCO_SWCOURT: |
| 437 | 436 | if( offset==1 ) return 0x0165; |
| 438 | if( offset==2 ) return count; | |
| 437 | if( offset==2 ) return state->count; | |
| 439 | 438 | break; |
| 440 | 439 | |
| 441 | 440 | case NAMCO_EMERALDA: |
| 442 | 441 | if( offset==1 ) return 0x0166; |
| 443 | if( offset==2 ) return count; | |
| 442 | if( offset==2 ) return state->count; | |
| 444 | 443 | break; |
| 445 | 444 | |
| 446 | 445 | case NAMCO_NUMANATH: |
| 447 | 446 | if( offset==1 ) return 0x0167; |
| 448 | if( offset==2 ) return count; | |
| 447 | if( offset==2 ) return state->count; | |
| 449 | 448 | break; |
| 450 | 449 | |
| 451 | 450 | case NAMCO_KNCKHEAD: |
| 452 | 451 | if( offset==1 ) return 0x0168; |
| 453 | if( offset==2 ) return count; | |
| 452 | if( offset==2 ) return state->count; | |
| 454 | 453 | break; |
| 455 | 454 | |
| 456 | 455 | case NAMCO_QUIZTOU: |
| r10886 | r10887 | |
| 459 | 458 | |
| 460 | 459 | case NAMCO_TINKLPIT: |
| 461 | 460 | if( offset==7 ) return 0x016f; |
| 462 | if( offset==4 ) keyval = 0; | |
| 461 | if( offset==4 ) state->keyval = 0; | |
| 463 | 462 | if( offset==3 ) |
| 464 | 463 | { |
| 465 | 464 | UINT16 res; |
| 466 | res = BITSWAP16(keyval, 22,26,31,23,18,20,16,30,24,21,25,19,17,29,28,27); | |
| 465 | res = BITSWAP16(state->keyval, 22,26,31,23,18,20,16,30,24,21,25,19,17,29,28,27); | |
| 467 | 466 | |
| 468 | keyval >>= 1; | |
| 469 | // printf("popcount(%08X) = %d\n", keyval & 0x58000c00, popcount(keyval & 0x58000c00)); | |
| 470 | if((!keyval) || (popcount(keyval & 0x58000c00) & 1)) | |
| 471 | keyval ^= 0x80000000; | |
| 467 | state->keyval >>= 1; | |
| 468 | // printf("popcount(%08X) = %d\n", state->keyval & 0x58000c00, popcount(state->keyval & 0x58000c00)); | |
| 469 | if((!state->keyval) || (popcount(state->keyval & 0x58000c00) & 1)) | |
| 470 | state->keyval ^= 0x80000000; | |
| 472 | 471 | |
| 473 | 472 | return res; |
| 474 | 473 | } |
| r10886 | r10887 | |
| 476 | 475 | |
| 477 | 476 | case NAMCO_XDAY2: |
| 478 | 477 | if( offset==2 ) return 0x018a; |
| 479 | if( offset==3 ) return count; | |
| 478 | if( offset==3 ) return state->count; | |
| 480 | 479 | break; |
| 481 | 480 | |
| 482 | 481 | default: |
| r10886 | r10887 | |
| 493 | 492 | |
| 494 | 493 | static READ16_HANDLER( namcona1_vreg_r ) |
| 495 | 494 | { |
| 496 | return namcona1_vreg[offset]; | |
| 495 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 496 | return state->vreg[offset]; | |
| 497 | 497 | } /* namcona1_vreg_r */ |
| 498 | 498 | |
| 499 | 499 | static int transfer_dword( running_machine *machine, UINT32 dest, UINT32 source ) |
| r10886 | r10887 | |
| 504 | 504 | |
| 505 | 505 | if( source>=0x400000 && source<0xc00000 ) |
| 506 | 506 | { |
| 507 | data = mpBank1[(source-0x400000)/2]; | |
| 507 | data = state->mpBank1[(source-0x400000)/2]; | |
| 508 | 508 | } |
| 509 | 509 | else if( source>=0xc00000 && source<0xe00000 ) |
| 510 | 510 | { |
| 511 | data = mpBank0[(source-0xc00000)/2]; | |
| 511 | data = state->mpBank0[(source-0xc00000)/2]; | |
| 512 | 512 | } |
| 513 | 513 | else if( source<0x80000 && source>=0x1000 ) |
| 514 | 514 | { |
| 515 | data = | |
| 515 | data = state-> | |
| 516 | 516 | } |
| 517 | 517 | else |
| 518 | 518 | { |
| r10886 | r10887 | |
| 616 | 616 | |
| 617 | 617 | static void namcona1_blit( running_machine *machine ) |
| 618 | 618 | { |
| 619 | int src0 = namcona1_vreg[0x0]; | |
| 620 | int src1 = namcona1_vreg[0x1]; | |
| 621 | int src2 = namcona1_vreg[0x2]; | |
| 619 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 620 | int src0 = state->vreg[0x0]; | |
| 621 | int src1 = state->vreg[0x1]; | |
| 622 | int src2 = state->vreg[0x2]; | |
| 622 | 623 | |
| 623 | int dst0 = namcona1_vreg[0x3]; | |
| 624 | int dst1 = namcona1_vreg[0x4]; | |
| 625 | int dst2 = namcona1_vreg[0x5]; | |
| 624 | int dst0 = state->vreg[0x3]; | |
| 625 | int dst1 = state->vreg[0x4]; | |
| 626 | int dst2 = state->vreg[0x5]; | |
| 626 | 627 | |
| 627 | int gfxbank = | |
| 628 | int gfxbank = state-> | |
| 628 | 629 | |
| 629 | 630 | /* dest and source are provided as dword offsets */ |
| 630 | UINT32 src_baseaddr = 2*(0xffffff&((namcona1_vreg[0x7]<<16)|namcona1_vreg[0x8])); | |
| 631 | UINT32 dst_baseaddr = 2*(0xffffff&((namcona1_vreg[0x9]<<16)|namcona1_vreg[0xa])); | |
| 631 | UINT32 src_baseaddr = 2*(0xffffff&((state->vreg[0x7]<<16)|state->vreg[0x8])); | |
| 632 | UINT32 dst_baseaddr = 2*(0xffffff&((state->vreg[0x9]<<16)|state->vreg[0xa])); | |
| 632 | 633 | |
| 633 | int num_bytes = | |
| 634 | int num_bytes = state-> | |
| 634 | 635 | |
| 635 | 636 | int dst_offset, src_offset; |
| 636 | 637 | int dst_bytes_per_row, dst_pitch; |
| r10886 | r10887 | |
| 693 | 694 | |
| 694 | 695 | static WRITE16_HANDLER( namcona1_vreg_w ) |
| 695 | 696 | { |
| 696 | COMBINE_DATA( &namcona1_vreg[offset] ); | |
| 697 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 698 | COMBINE_DATA( &state->vreg[offset] ); | |
| 697 | 699 | |
| 698 | 700 | switch( offset ) |
| 699 | 701 | { |
| r10886 | r10887 | |
| 703 | 705 | break; |
| 704 | 706 | |
| 705 | 707 | case 0x1a/2: |
| 706 | mEnableInterrupts = 1; | |
| 708 | state->mEnableInterrupts = 1; | |
| 707 | 709 | /* interrupt enable mask; 0 enables INT level */ |
| 708 | 710 | break; |
| 709 | 711 | } |
| r10886 | r10887 | |
| 712 | 714 | /***************************************************************/ |
| 713 | 715 | |
| 714 | 716 | // MCU "mailslot" handler - has 8 16-bit slots mirrored |
| 715 | static UINT16 mcu_mailbox[8]; | |
| 716 | 717 | |
| 717 | 718 | static READ16_HANDLER( mcu_mailbox_r ) |
| 718 | 719 | { |
| 719 | return mcu_mailbox[offset%8]; | |
| 720 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 721 | return state->mcu_mailbox[offset%8]; | |
| 720 | 722 | } |
| 721 | 723 | |
| 722 | 724 | static WRITE16_HANDLER( mcu_mailbox_w_68k ) |
| 723 | 725 | { |
| 726 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 724 | 727 | // logerror("mailbox_w_68k: %x @ %x\n", data, offset); |
| 725 | 728 | |
| 726 | 729 | if (offset == 4) |
| 727 | 730 | cputag_set_input_line(space->machine, "mcu", M37710_LINE_IRQ0, HOLD_LINE); |
| 728 | 731 | |
| 729 | COMBINE_DATA(&mcu_mailbox[offset%8]); | |
| 732 | COMBINE_DATA(&state->mcu_mailbox[offset%8]); | |
| 730 | 733 | |
| 731 | 734 | /* FIXME: This shouldn't be necessary now that the C70 BIOS is implemented, |
| 732 | 735 | but for some reason the MCU never responds to the version string command */ |
| 733 | if ( ( | |
| 736 | if ( (state-> | |
| 734 | 737 | { |
| 735 | if ((namcona1_workram[0xf72/2] >> 8) == 7) | |
| 736 | write_version_info(); | |
| 738 | if ((state->workram[0xf72/2] >> 8) == 7) | |
| 739 | write_version_info(state); | |
| 737 | 740 | } |
| 738 | 741 | } |
| 739 | 742 | |
| 740 | 743 | static WRITE16_HANDLER( mcu_mailbox_w_mcu ) |
| 741 | 744 | { |
| 742 | COMBINE_DATA(&mcu_mailbox[offset%8]); | |
| 745 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 746 | COMBINE_DATA(&state->mcu_mailbox[offset%8]); | |
| 743 | 747 | } |
| 744 | 748 | |
| 745 | 749 | static ADDRESS_MAP_START( namcona1_main_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 746 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE( | |
| 750 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE_MEMBER( | |
| 747 | 751 | AM_RANGE(0x3f8000, 0x3fffff) AM_READWRITE(mcu_mailbox_r, mcu_mailbox_w_68k) |
| 748 | 752 | AM_RANGE(0x400000, 0xbfffff) AM_ROM AM_REGION("maincpu", 0x280000) /* data */ |
| 749 | 753 | AM_RANGE(0xc00000, 0xdfffff) AM_ROM AM_REGION("maincpu", 0x080000) /* code */ |
| 750 | 754 | AM_RANGE(0xe00000, 0xe00fff) AM_READWRITE(namcona1_nvram_r, namcona1_nvram_w) |
| 751 | 755 | AM_RANGE(0xe40000, 0xe4000f) AM_READWRITE(custom_key_r, custom_key_w) |
| 752 | AM_RANGE(0xefff00, 0xefffff) AM_READWRITE(namcona1_vreg_r, namcona1_vreg_w) AM_BASE( | |
| 756 | AM_RANGE(0xefff00, 0xefffff) AM_READWRITE(namcona1_vreg_r, namcona1_vreg_w) AM_BASE_MEMBER( | |
| 753 | 757 | AM_RANGE(0xf00000, 0xf01fff) AM_READWRITE(namcona1_paletteram_r, namcona1_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 754 | 758 | AM_RANGE(0xf40000, 0xf7ffff) AM_READWRITE(namcona1_gfxram_r, namcona1_gfxram_w) |
| 755 | 759 | AM_RANGE(0xff0000, 0xffbfff) AM_READWRITE(namcona1_videoram_r, namcona1_videoram_w) AM_BASE_MEMBER(namcona1_state, videoram) |
| 756 | 760 | AM_RANGE(0xffd000, 0xffdfff) AM_RAM /* unknown */ |
| 757 | AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_BASE( | |
| 761 | AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_BASE_MEMBER( | |
| 758 | 762 | AM_RANGE(0xfff000, 0xffffff) AM_RAM AM_BASE_MEMBER(namcona1_state, spriteram) /* spriteram */ |
| 759 | 763 | ADDRESS_MAP_END |
| 760 | 764 | |
| 761 | 765 | |
| 762 | 766 | static ADDRESS_MAP_START( namcona2_main_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 763 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE( | |
| 767 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE_MEMBER( | |
| 764 | 768 | AM_RANGE(0x3f8000, 0x3fffff) AM_READWRITE(mcu_mailbox_r, mcu_mailbox_w_68k) |
| 765 | 769 | AM_RANGE(0x400000, 0xbfffff) AM_ROM AM_REGION("maincpu", 0x280000) /* data */ |
| 766 | 770 | AM_RANGE(0xd00000, 0xd00001) AM_WRITENOP /* xday: serial out? */ |
| r10886 | r10887 | |
| 771 | 775 | AM_RANGE(0xe00000, 0xe00fff) AM_READWRITE(namcona1_nvram_r, namcona1_nvram_w) |
| 772 | 776 | /* xday: additional battery-backed ram at 00E024FA? */ |
| 773 | 777 | AM_RANGE(0xe40000, 0xe4000f) AM_READWRITE(custom_key_r, custom_key_w) |
| 774 | AM_RANGE(0xefff00, 0xefffff) AM_READWRITE(namcona1_vreg_r, namcona1_vreg_w) AM_BASE( | |
| 778 | AM_RANGE(0xefff00, 0xefffff) AM_READWRITE(namcona1_vreg_r, namcona1_vreg_w) AM_BASE_MEMBER( | |
| 775 | 779 | AM_RANGE(0xf00000, 0xf01fff) AM_READWRITE(namcona1_paletteram_r, namcona1_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 776 | 780 | AM_RANGE(0xf40000, 0xf7ffff) AM_READWRITE(namcona1_gfxram_r, namcona1_gfxram_w) |
| 777 | 781 | AM_RANGE(0xff0000, 0xffbfff) AM_READWRITE(namcona1_videoram_r, namcona1_videoram_w) AM_BASE_MEMBER(namcona1_state, videoram) |
| 778 | 782 | AM_RANGE(0xffd000, 0xffdfff) AM_RAM /* unknown */ |
| 779 | AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_BASE( | |
| 783 | AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_BASE_MEMBER( | |
| 780 | 784 | AM_RANGE(0xfff000, 0xffffff) AM_RAM AM_BASE_MEMBER(namcona1_state, spriteram) /* spriteram */ |
| 781 | 785 | ADDRESS_MAP_END |
| 782 | 786 | |
| r10886 | r10887 | |
| 785 | 789 | |
| 786 | 790 | static READ16_HANDLER( na1mcu_shared_r ) |
| 787 | 791 | { |
| 792 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 788 | 793 | UINT16 data; |
| 789 | 794 | |
| 790 | data = | |
| 795 | data = state-> | |
| 791 | 796 | |
| 792 | 797 | #if 0 |
| 793 | 798 | if (offset >= 0x70000/2) |
| r10886 | r10887 | |
| 801 | 806 | |
| 802 | 807 | static WRITE16_HANDLER( na1mcu_shared_w ) |
| 803 | 808 | { |
| 809 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 804 | 810 | mem_mask = FLIPENDIAN_INT16(mem_mask); |
| 805 | 811 | data = FLIPENDIAN_INT16(data); |
| 806 | 812 | |
| 807 | COMBINE_DATA(& | |
| 813 | COMBINE_DATA(&state-> | |
| 808 | 814 | } |
| 809 | 815 | |
| 810 | 816 | static READ16_DEVICE_HANDLER(snd_r) |
| r10886 | r10887 | |
| 836 | 842 | AM_RANGE(0x200000, 0x27ffff) AM_READWRITE(na1mcu_shared_r, na1mcu_shared_w) // shared work RAM |
| 837 | 843 | ADDRESS_MAP_END |
| 838 | 844 | |
| 839 | static UINT8 mcu_port4, mcu_port5, mcu_port6, mcu_port8; | |
| 840 | 845 | |
| 841 | 846 | // port 4: bit 3 (0x08) enables the 68000 (see the 68k launch code at c604 in swcourt's BIOS) |
| 842 | 847 | static READ8_HANDLER( port4_r ) |
| 843 | 848 | { |
| 844 | return mcu_port4; | |
| 849 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 850 | return state->mcu_port4; | |
| 845 | 851 | } |
| 846 | 852 | |
| 847 | 853 | static WRITE8_HANDLER( port4_w ) |
| 848 | 854 | { |
| 849 | if ((data & 0x08) && !(mcu_port4 & 0x08)) | |
| 855 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 856 | if ((data & 0x08) && !(state->mcu_port4 & 0x08)) | |
| 850 | 857 | { |
| 851 | 858 | logerror("launching 68k, PC=%x\n", cpu_get_pc(space->cpu)); |
| 852 | 859 | |
| r10886 | r10887 | |
| 854 | 861 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE); |
| 855 | 862 | } |
| 856 | 863 | |
| 857 | mcu_port4 = data; | |
| 864 | state->mcu_port4 = data; | |
| 858 | 865 | } |
| 859 | 866 | |
| 860 | 867 | // port 5: not sure yet, but MCU code requires this interaction at least |
| 861 | 868 | static READ8_HANDLER( port5_r ) |
| 862 | 869 | { |
| 863 | return mcu_port5; | |
| 870 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 871 | return state->mcu_port5; | |
| 864 | 872 | } |
| 865 | 873 | |
| 866 | 874 | static WRITE8_HANDLER( port5_w ) |
| 867 | 875 | { |
| 868 | mcu_port5 = data; | |
| 876 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 877 | state->mcu_port5 = data; | |
| 869 | 878 | |
| 870 | 879 | // bit 0 must mirror bit 1 - this is checked at CCD3 in the C69 BIOS |
| 871 | mcu_port5 &= 0xfe; | |
| 872 | mcu_port5 |= ((mcu_port5 & 0x2)>>1); | |
| 880 | state->mcu_port5 &= 0xfe; | |
| 881 | state->mcu_port5 |= ((state->mcu_port5 & 0x2)>>1); | |
| 873 | 882 | } |
| 874 | 883 | |
| 875 | 884 | static READ8_HANDLER( port6_r ) |
| r10886 | r10887 | |
| 879 | 888 | |
| 880 | 889 | static WRITE8_HANDLER( port6_w ) |
| 881 | 890 | { |
| 882 | mcu_port6 = data; | |
| 891 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 892 | state->mcu_port6 = data; | |
| 883 | 893 | } |
| 884 | 894 | |
| 885 | 895 | static READ8_HANDLER( port7_r ) |
| 886 | 896 | { |
| 887 | switch (mcu_port6 & 0xe0) | |
| 897 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 898 | switch (state->mcu_port6 & 0xe0) | |
| 888 | 899 | { |
| 889 | 900 | case 0x40: |
| 890 | 901 | return input_port_read(space->machine, "P1"); |
| r10886 | r10887 | |
| 909 | 920 | // port 8: bit 5 (0x20) toggles, watchdog? |
| 910 | 921 | static READ8_HANDLER( port8_r ) |
| 911 | 922 | { |
| 912 | return mcu_port8; | |
| 923 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 924 | return state->mcu_port8; | |
| 913 | 925 | } |
| 914 | 926 | |
| 915 | 927 | static WRITE8_HANDLER( port8_w ) |
| 916 | 928 | { |
| 917 | mcu_port8 = data; | |
| 929 | namcona1_state *state = space->machine->driver_data<namcona1_state>(); | |
| 930 | state->mcu_port8 = data; | |
| 918 | 931 | } |
| 919 | 932 | |
| 920 | 933 | |
| 921 | 934 | static MACHINE_START( namcona1 ) |
| 922 | 935 | { |
| 923 | c140_set_base(machine->device("c140"), namcona1_workram); | |
| 936 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 937 | c140_set_base(machine->device("c140"), state->workram); | |
| 924 | 938 | } |
| 925 | 939 | |
| 926 | 940 | // for games with the MCU emulated, the MCU boots the 68000. don't allow it before that. |
| 927 | 941 | static MACHINE_RESET( namcona1_mcu ) |
| 928 | 942 | { |
| 943 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 929 | 944 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE); |
| 930 | 945 | |
| 931 | mcu_port5 = 1; | |
| 946 | state->mcu_port5 = 1; | |
| 932 | 947 | } |
| 933 | 948 | |
| 934 | 949 | // "encrypt" player 3 inputs |
| r10886 | r10887 | |
| 961 | 976 | |
| 962 | 977 | static INTERRUPT_GEN( namcona1_interrupt ) |
| 963 | 978 | { |
| 979 | namcona1_state *state = device->machine->driver_data<namcona1_state>(); | |
| 964 | 980 | int level = cpu_getiloops(device); /* 0,1,2,3,4 */ |
| 965 | 981 | if( level==0 ) |
| 966 | 982 | { |
| 967 | 983 | simulate_mcu( device->machine ); |
| 968 | 984 | } |
| 969 | if( mEnableInterrupts ) | |
| 985 | if( state->mEnableInterrupts ) | |
| 970 | 986 | { |
| 971 | if( ( | |
| 987 | if( (state-> | |
| 972 | 988 | { |
| 973 | 989 | if( level==2 ) |
| 974 | 990 | { // posirq used with dolphin in Emeraldia's "how to play" attract mode |
| 975 | int scanline = | |
| 991 | int scanline = state-> | |
| 976 | 992 | if( scanline ) |
| 977 | 993 | { |
| 978 | 994 | device->machine->primary_screen->update_partial(scanline ); |
| r10886 | r10887 | |
| 1068 | 1084 | |
| 1069 | 1085 | static void init_namcona1( running_machine *machine, int gametype ) |
| 1070 | 1086 | { |
| 1087 | namcona1_state *state = machine->driver_data<namcona1_state>(); | |
| 1071 | 1088 | UINT16 *pMem = (UINT16 *)machine->region( "maincpu" )->base(); |
| 1072 | 1089 | |
| 1073 | namcona1_gametype = gametype; | |
| 1074 | mpBank0 = &pMem[0x80000/2]; | |
| 1075 | mpBank1 = mpBank0 + 0x200000/2; | |
| 1090 | state->gametype = gametype; | |
| 1091 | state->mpBank0 = &pMem[0x80000/2]; | |
| 1092 | state->mpBank1 = state->mpBank0 + 0x200000/2; | |
| 1076 | 1093 | |
| 1077 | mEnableInterrupts = 0; | |
| 1094 | state->mEnableInterrupts = 0; | |
| 1078 | 1095 | } |
| 1079 | 1096 | |
| 1080 | 1097 | static DRIVER_INIT( bkrtmaq ){ init_namcona1(machine, NAMCO_BKRTMAQ); } |
| r10886 | r10887 | |
|---|---|---|
| 45 | 45 | #include "sound/okim6295.h" |
| 46 | 46 | |
| 47 | 47 | |
| 48 | static int test_x, test_y, start_offs; | |
| 48 | class itgambl3_state : public driver_device | |
| 49 | { | |
| 50 | public: | |
| 51 | itgambl3_state(running_machine &machine, const driver_device_config_base &config) | |
| 52 | : driver_device(machine, config) { } | |
| 49 | 53 | |
| 54 | int test_x; | |
| 55 | int test_y; | |
| 56 | int start_offs; | |
| 57 | }; | |
| 58 | ||
| 59 | ||
| 50 | 60 | /************************* |
| 51 | 61 | * Video Hardware * |
| 52 | 62 | *************************/ |
| 53 | 63 | |
| 54 | 64 | static VIDEO_START( itgambl3 ) |
| 55 | 65 | { |
| 56 | test_x = 256; | |
| 57 | test_y = 256; | |
| 58 | start_offs = 0; | |
| 66 | itgambl3_state *state = machine->driver_data<itgambl3_state>(); | |
| 67 | state->test_x = 256; | |
| 68 | state->test_y = 256; | |
| 69 | state->start_offs = 0; | |
| 59 | 70 | } |
| 60 | 71 | |
| 61 | 72 | /* (dirty) debug code for looking 8bpps blitter-based gfxs */ |
| 62 | 73 | static SCREEN_UPDATE( itgambl3 ) |
| 63 | 74 | { |
| 75 | itgambl3_state *state = screen->machine->driver_data<itgambl3_state>(); | |
| 64 | 76 | int x,y,count; |
| 65 | 77 | const UINT8 *blit_ram = screen->machine->region("gfx1")->base(); |
| 66 | 78 | |
| 67 | 79 | if(input_code_pressed(screen->machine, KEYCODE_Z)) |
| 68 | test_x++; | |
| 80 | state->test_x++; | |
| 69 | 81 | |
| 70 | 82 | if(input_code_pressed(screen->machine, KEYCODE_X)) |
| 71 | test_x--; | |
| 83 | state->test_x--; | |
| 72 | 84 | |
| 73 | 85 | if(input_code_pressed(screen->machine, KEYCODE_A)) |
| 74 | test_y++; | |
| 86 | state->test_y++; | |
| 75 | 87 | |
| 76 | 88 | if(input_code_pressed(screen->machine, KEYCODE_S)) |
| 77 | test_y--; | |
| 89 | state->test_y--; | |
| 78 | 90 | |
| 79 | 91 | if(input_code_pressed(screen->machine, KEYCODE_Q)) |
| 80 | start_offs+=0x200; | |
| 92 | state->start_offs+=0x200; | |
| 81 | 93 | |
| 82 | 94 | if(input_code_pressed(screen->machine, KEYCODE_W)) |
| 83 | start_offs-=0x200; | |
| 95 | state->start_offs-=0x200; | |
| 84 | 96 | |
| 85 | 97 | if(input_code_pressed(screen->machine, KEYCODE_E)) |
| 86 | start_offs++; | |
| 98 | state->start_offs++; | |
| 87 | 99 | |
| 88 | 100 | if(input_code_pressed(screen->machine, KEYCODE_R)) |
| 89 | start_offs--; | |
| 101 | state->start_offs--; | |
| 90 | 102 | |
| 91 | popmessage("%d %d %04x",test_x,test_y,start_offs); | |
| 103 | popmessage("%d %d %04x",state->test_x,state->test_y,state->start_offs); | |
| 92 | 104 | |
| 93 | 105 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 94 | 106 | |
| 95 | count = (start_offs); | |
| 107 | count = (state->start_offs); | |
| 96 | 108 | |
| 97 | for(y=0;y<test_y;y++) | |
| 109 | for(y=0;y<state->test_y;y++) | |
| 98 | 110 | { |
| 99 | for(x=0;x<test_x;x++) | |
| 111 | for(x=0;x<state->test_x;x++) | |
| 100 | 112 | { |
| 101 | 113 | UINT32 color; |
| 102 | 114 | |
| r10886 | r10887 | |
| 236 | 248 | * Machine Drivers * |
| 237 | 249 | **************************/ |
| 238 | 250 | |
| 239 | static MACHINE_CONFIG_START( itgambl3, | |
| 251 | static MACHINE_CONFIG_START( itgambl3, | |
| 240 | 252 | |
| 241 | 253 | /* basic machine hardware */ |
| 242 | 254 | MCFG_CPU_ADD("maincpu", H83044, MAIN_CLOCK) /* wrong CPU, but we have not a M16C core ATM */ |
| r10886 | r10887 | |
|---|---|---|
| 22 | 22 | : driver_device(machine, config) { } |
| 23 | 23 | |
| 24 | 24 | UINT8 *spriteram; |
| 25 | UINT8 *colorram; | |
| 26 | UINT8 *videoram; | |
| 27 | emu_timer *refresh_timer; | |
| 25 | 28 | }; |
| 26 | 29 | |
| 27 | 30 | |
| 28 | static UINT8 *colorram; | |
| 29 | static UINT8 *videoram; | |
| 30 | 31 | |
| 31 | 32 | static void acefruit_update_irq(running_machine *machine, int vpos ) |
| 32 | 33 | { |
| 34 | acefruit_state *state = machine->driver_data<acefruit_state>(); | |
| 33 | 35 | int col; |
| 34 | 36 | int row = vpos / 8; |
| 35 | 37 | |
| 36 | 38 | for( col = 0; col < 32; col++ ) |
| 37 | 39 | { |
| 38 | 40 | int tile_index = ( col * 32 ) + row; |
| 39 | int color = colorram[ tile_index ]; | |
| 41 | int color = state->colorram[ tile_index ]; | |
| 40 | 42 | |
| 41 | 43 | switch( color ) |
| 42 | 44 | { |
| r10886 | r10887 | |
| 47 | 49 | } |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | static emu_timer *acefruit_refresh_timer; | |
| 51 | 52 | |
| 52 | 53 | static TIMER_CALLBACK( acefruit_refresh ) |
| 53 | 54 | { |
| 55 | acefruit_state *state = machine->driver_data<acefruit_state>(); | |
| 54 | 56 | int vpos = machine->primary_screen->vpos(); |
| 55 | 57 | |
| 56 | 58 | machine->primary_screen->update_partial(vpos ); |
| r10886 | r10887 | |
| 58 | 60 | |
| 59 | 61 | vpos = ( ( vpos / 8 ) + 1 ) * 8; |
| 60 | 62 | |
| 61 | a | |
| 63 | sta | |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | static VIDEO_START( acefruit ) |
| 65 | 67 | { |
| 66 | acefruit_refresh_timer = machine->scheduler().timer_alloc(FUNC(acefruit_refresh)); | |
| 68 | acefruit_state *state = machine->driver_data<acefruit_state>(); | |
| 69 | state->refresh_timer = machine->scheduler().timer_alloc(FUNC(acefruit_refresh)); | |
| 67 | 70 | } |
| 68 | 71 | |
| 69 | 72 | static INTERRUPT_GEN( acefruit_vblank ) |
| 70 | 73 | { |
| 74 | acefruit_state *state = device->machine->driver_data<acefruit_state>(); | |
| 71 | 75 | cpu_set_input_line(device, 0, HOLD_LINE ); |
| 72 | a | |
| 76 | sta | |
| 73 | 77 | } |
| 74 | 78 | |
| 75 | 79 | static SCREEN_UPDATE( acefruit ) |
| r10886 | r10887 | |
| 89 | 93 | for( col = 0; col < 32; col++ ) |
| 90 | 94 | { |
| 91 | 95 | int tile_index = ( col * 32 ) + row; |
| 92 | int code = videoram[ tile_index ]; | |
| 93 | int color = colorram[ tile_index ]; | |
| 96 | int code = state->videoram[ tile_index ]; | |
| 97 | int color = state->colorram[ tile_index ]; | |
| 94 | 98 | |
| 95 | 99 | if( color < 0x4 ) |
| 96 | 100 | { |
| r10886 | r10887 | |
| 213 | 217 | |
| 214 | 218 | static WRITE8_HANDLER( acefruit_colorram_w ) |
| 215 | 219 | { |
| 216 | colorram[ offset ] = data & 0xf; | |
| 220 | acefruit_state *state = space->machine->driver_data<acefruit_state>(); | |
| 221 | state->colorram[ offset ] = data & 0xf; | |
| 217 | 222 | } |
| 218 | 223 | |
| 219 | 224 | static WRITE8_HANDLER( acefruit_coin_w ) |
| r10886 | r10887 | |
| 272 | 277 | static ADDRESS_MAP_START( acefruit_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 273 | 278 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 274 | 279 | AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("nvram") |
| 275 | AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) | |
| 276 | AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(acefruit_colorram_w) AM_BASE(&colorram) | |
| 280 | AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE_MEMBER(acefruit_state, videoram) | |
| 281 | AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(acefruit_colorram_w) AM_BASE_MEMBER(acefruit_state, colorram) | |
| 277 | 282 | AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN0") |
| 278 | 283 | AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN1") |
| 279 | 284 | AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN2") |
| r10886 | r10887 | |
|---|---|---|
| 38 | 38 | #include "machine/8255ppi.h" |
| 39 | 39 | #include "machine/nvram.h" |
| 40 | 40 | |
| 41 | static tilemap_t *tmap; | |
| 42 | 41 | |
| 43 | static UINT8 *skylncr_videoram,*skylncr_colorram; | |
| 42 | class skylncr_state : public driver_device | |
| 43 | { | |
| 44 | public: | |
| 45 | skylncr_state(running_machine &machine, const driver_device_config_base &config) | |
| 46 | : driver_device(machine, config) { } | |
| 44 | 47 | |
| 45 | static UINT8* reeltiles_1_ram; | |
| 46 | static UINT8* reeltiles_2_ram; | |
| 47 | static UINT8* reeltiles_3_ram; | |
| 48 | static UINT8* reeltiles_4_ram; | |
| 49 | static UINT8* reeltileshigh_1_ram; | |
| 50 | static UINT8* reeltileshigh_2_ram; | |
| 51 | static UINT8* reeltileshigh_3_ram; | |
| 52 | static UINT8* reeltileshigh_4_ram; | |
| 53 | static tilemap_t *reel_1_tilemap; | |
| 54 | static tilemap_t *reel_2_tilemap; | |
| 55 | static tilemap_t *reel_3_tilemap; | |
| 56 | static tilemap_t *reel_4_tilemap; | |
| 57 | static UINT8* reelscroll1; | |
| 58 | static UINT8* reelscroll2; | |
| 59 | static UINT8* reelscroll3; | |
| 60 | static UINT8* reelscroll4; | |
| 48 | tilemap_t *tmap; | |
| 49 | UINT8 *videoram; | |
| 50 | UINT8 *colorram; | |
| 51 | UINT8* reeltiles_1_ram; | |
| 52 | UINT8* reeltiles_2_ram; | |
| 53 | UINT8* reeltiles_3_ram; | |
| 54 | UINT8* reeltiles_4_ram; | |
| 55 | UINT8* reeltileshigh_1_ram; | |
| 56 | UINT8* reeltileshigh_2_ram; | |
| 57 | UINT8* reeltileshigh_3_ram; | |
| 58 | UINT8* reeltileshigh_4_ram; | |
| 59 | tilemap_t *reel_1_tilemap; | |
| 60 | tilemap_t *reel_2_tilemap; | |
| 61 | tilemap_t *reel_3_tilemap; | |
| 62 | tilemap_t *reel_4_tilemap; | |
| 63 | UINT8* reelscroll1; | |
| 64 | UINT8* reelscroll2; | |
| 65 | UINT8* reelscroll3; | |
| 66 | UINT8* reelscroll4; | |
| 67 | UINT8 nmi_enable; | |
| 68 | int color; | |
| 69 | int color2; | |
| 70 | }; | |
| 61 | 71 | |
| 62 | static UINT8 skylncr_nmi_enable; | |
| 63 | 72 | |
| 64 | ||
| 65 | 73 | /************************************** |
| 66 | 74 | * Video Hardware * |
| 67 | 75 | **************************************/ |
| 68 | 76 | |
| 69 | 77 | static WRITE8_HANDLER( skylncr_videoram_w ) |
| 70 | 78 | { |
| 71 | skylncr_videoram[offset] = data; | |
| 72 | tilemap_mark_tile_dirty(tmap, offset); | |
| 79 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 80 | state->videoram[offset] = data; | |
| 81 | tilemap_mark_tile_dirty(state->tmap, offset); | |
| 73 | 82 | } |
| 74 | 83 | |
| 75 | 84 | static WRITE8_HANDLER( skylncr_colorram_w ) |
| 76 | 85 | { |
| 77 | skylncr_colorram[offset] = data; | |
| 78 | tilemap_mark_tile_dirty(tmap, offset); | |
| 86 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 87 | state->colorram[offset] = data; | |
| 88 | tilemap_mark_tile_dirty(state->tmap, offset); | |
| 79 | 89 | } |
| 80 | 90 | |
| 81 | 91 | |
| 82 | 92 | static TILE_GET_INFO( get_tile_info ) |
| 83 | 93 | { |
| 84 | UINT16 code = skylncr_videoram[ tile_index ] + (skylncr_colorram[ tile_index ] << 8); | |
| 94 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 95 | UINT16 code = state->videoram[ tile_index ] + (state->colorram[ tile_index ] << 8); | |
| 85 | 96 | SET_TILE_INFO(0, code, 0, TILE_FLIPYX( 0 )); |
| 86 | 97 | } |
| 87 | 98 | |
| 88 | 99 | static TILE_GET_INFO( get_reel_1_tile_info ) |
| 89 | 100 | { |
| 90 | UINT16 code = reeltiles_1_ram[ tile_index ] + (reeltileshigh_1_ram[ tile_index ] << 8); | |
| 101 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 102 | UINT16 code = state->reeltiles_1_ram[ tile_index ] + (state->reeltileshigh_1_ram[ tile_index ] << 8); | |
| 91 | 103 | SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 )); |
| 92 | 104 | } |
| 93 | 105 | |
| 94 | 106 | static TILE_GET_INFO( get_reel_2_tile_info ) |
| 95 | 107 | { |
| 96 | UINT16 code = reeltiles_2_ram[ tile_index ] + (reeltileshigh_2_ram[ tile_index ] << 8); | |
| 108 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 109 | UINT16 code = state->reeltiles_2_ram[ tile_index ] + (state->reeltileshigh_2_ram[ tile_index ] << 8); | |
| 97 | 110 | SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 )); |
| 98 | 111 | } |
| 99 | 112 | |
| 100 | 113 | static TILE_GET_INFO( get_reel_3_tile_info ) |
| 101 | 114 | { |
| 102 | UINT16 code = reeltiles_3_ram[ tile_index ] + (reeltileshigh_3_ram[ tile_index ] << 8); | |
| 115 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 116 | UINT16 code = state->reeltiles_3_ram[ tile_index ] + (state->reeltileshigh_3_ram[ tile_index ] << 8); | |
| 103 | 117 | SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 )); |
| 104 | 118 | } |
| 105 | 119 | |
| 106 | 120 | static TILE_GET_INFO( get_reel_4_tile_info ) |
| 107 | 121 | { |
| 108 | UINT16 code = reeltiles_4_ram[ tile_index ] + (reeltileshigh_4_ram[ tile_index ] << 8); | |
| 122 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 123 | UINT16 code = state->reeltiles_4_ram[ tile_index ] + (state->reeltileshigh_4_ram[ tile_index ] << 8); | |
| 109 | 124 | SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 )); |
| 110 | 125 | } |
| 111 | 126 | |
| 112 | 127 | |
| 113 | 128 | static VIDEO_START( skylncr ) |
| 114 | 129 | { |
| 130 | skylncr_state *state = machine->driver_data<skylncr_state>(); | |
| 115 | 131 | |
| 116 | tmap = tilemap_create( machine, get_tile_info, tilemap_scan_rows, 8, 8, 0x40, 0x20 ); | |
| 132 | state->tmap = tilemap_create( machine, get_tile_info, tilemap_scan_rows, 8, 8, 0x40, 0x20 ); | |
| 117 | 133 | |
| 118 | reel_1_tilemap = tilemap_create(machine, get_reel_1_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 119 | reel_2_tilemap = tilemap_create(machine, get_reel_2_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 120 | reel_3_tilemap = tilemap_create(machine, get_reel_3_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 121 | reel_4_tilemap = tilemap_create(machine, get_reel_4_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 134 | state->reel_1_tilemap = tilemap_create(machine, get_reel_1_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 135 | state->reel_2_tilemap = tilemap_create(machine, get_reel_2_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 136 | state->reel_3_tilemap = tilemap_create(machine, get_reel_3_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 137 | state->reel_4_tilemap = tilemap_create(machine, get_reel_4_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 122 | 138 | |
| 123 | tilemap_set_scroll_cols(reel_2_tilemap, 0x40); | |
| 124 | tilemap_set_scroll_cols(reel_3_tilemap, 0x40); | |
| 125 | tilemap_set_scroll_cols(reel_4_tilemap, 0x40); | |
| 139 | tilemap_set_scroll_cols(state->reel_2_tilemap, 0x40); | |
| 140 | tilemap_set_scroll_cols(state->reel_3_tilemap, 0x40); | |
| 141 | tilemap_set_scroll_cols(state->reel_4_tilemap, 0x40); | |
| 126 | 142 | |
| 127 | tilemap_set_transparent_pen(reel_2_tilemap, 0); | |
| 128 | tilemap_set_transparent_pen(reel_3_tilemap, 0); | |
| 129 | tilemap_set_transparent_pen(reel_4_tilemap, 0); | |
| 143 | tilemap_set_transparent_pen(state->reel_2_tilemap, 0); | |
| 144 | tilemap_set_transparent_pen(state->reel_3_tilemap, 0); | |
| 145 | tilemap_set_transparent_pen(state->reel_4_tilemap, 0); | |
| 130 | 146 | |
| 131 | 147 | |
| 132 | tilemap_set_transparent_pen(tmap, 0); | |
| 148 | tilemap_set_transparent_pen(state->tmap, 0); | |
| 133 | 149 | } |
| 134 | 150 | |
| 135 | 151 | // are these hardcoded, or registers? |
| r10886 | r10887 | |
| 140 | 156 | |
| 141 | 157 | static SCREEN_UPDATE( skylncr ) |
| 142 | 158 | { |
| 159 | skylncr_state *state = screen->machine->driver_data<skylncr_state>(); | |
| 143 | 160 | int i; |
| 144 | 161 | |
| 145 | 162 | bitmap_fill(bitmap,cliprect,0); |
| 146 | tilemap_draw(bitmap,cliprect, reel_1_tilemap, 0, 0); | |
| 163 | tilemap_draw(bitmap,cliprect, state->reel_1_tilemap, 0, 0); | |
| 147 | 164 | |
| 148 | 165 | for (i= 0;i < 64;i++) |
| 149 | 166 | { |
| 150 | tilemap_set_scrolly(reel_2_tilemap, i, reelscroll2[i]); | |
| 151 | tilemap_set_scrolly(reel_3_tilemap, i, reelscroll3[i]); | |
| 152 | tilemap_set_scrolly(reel_4_tilemap, i, reelscroll4[i]); | |
| 167 | tilemap_set_scrolly(state->reel_2_tilemap, i, state->reelscroll2[i]); | |
| 168 | tilemap_set_scrolly(state->reel_3_tilemap, i, state->reelscroll3[i]); | |
| 169 | tilemap_set_scrolly(state->reel_4_tilemap, i, state->reelscroll4[i]); | |
| 153 | 170 | } |
| 154 | 171 | |
| 155 | tilemap_draw(bitmap,&visible1,reel_2_tilemap, 0, 0); | |
| 156 | tilemap_draw(bitmap,&visible2,reel_3_tilemap, 0, 0); | |
| 157 | tilemap_draw(bitmap,&visible3,reel_4_tilemap, 0, 0); | |
| 172 | tilemap_draw(bitmap,&visible1,state->reel_2_tilemap, 0, 0); | |
| 173 | tilemap_draw(bitmap,&visible2,state->reel_3_tilemap, 0, 0); | |
| 174 | tilemap_draw(bitmap,&visible3,state->reel_4_tilemap, 0, 0); | |
| 158 | 175 | |
| 159 | 176 | |
| 160 | tilemap_draw(bitmap,cliprect, tmap, 0, 0); | |
| 177 | tilemap_draw(bitmap,cliprect, state->tmap, 0, 0); | |
| 161 | 178 | return 0; |
| 162 | 179 | } |
| 163 | 180 | |
| 164 | 181 | static WRITE8_HANDLER( reeltiles_1_w ) |
| 165 | 182 | { |
| 166 | reeltiles_1_ram[offset] = data; | |
| 167 | tilemap_mark_tile_dirty(reel_1_tilemap, offset); | |
| 183 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 184 | state->reeltiles_1_ram[offset] = data; | |
| 185 | tilemap_mark_tile_dirty(state->reel_1_tilemap, offset); | |
| 168 | 186 | } |
| 169 | 187 | |
| 170 | 188 | static WRITE8_HANDLER( reeltiles_2_w ) |
| 171 | 189 | { |
| 172 | reeltiles_2_ram[offset] = data; | |
| 173 | tilemap_mark_tile_dirty(reel_2_tilemap, offset); | |
| 190 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 191 | state->reeltiles_2_ram[offset] = data; | |
| 192 | tilemap_mark_tile_dirty(state->reel_2_tilemap, offset); | |
| 174 | 193 | } |
| 175 | 194 | |
| 176 | 195 | static WRITE8_HANDLER( reeltiles_3_w ) |
| 177 | 196 | { |
| 178 | reeltiles_3_ram[offset] = data; | |
| 179 | tilemap_mark_tile_dirty(reel_3_tilemap, offset); | |
| 197 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 198 | state->reeltiles_3_ram[offset] = data; | |
| 199 | tilemap_mark_tile_dirty(state->reel_3_tilemap, offset); | |
| 180 | 200 | } |
| 181 | 201 | |
| 182 | 202 | static WRITE8_HANDLER( reeltiles_4_w ) |
| 183 | 203 | { |
| 184 | reeltiles_4_ram[offset] = data; | |
| 185 | tilemap_mark_tile_dirty(reel_4_tilemap, offset); | |
| 204 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 205 | state->reeltiles_4_ram[offset] = data; | |
| 206 | tilemap_mark_tile_dirty(state->reel_4_tilemap, offset); | |
| 186 | 207 | } |
| 187 | 208 | |
| 188 | 209 | static WRITE8_HANDLER( reeltileshigh_1_w ) |
| 189 | 210 | { |
| 190 | reeltileshigh_1_ram[offset] = data; | |
| 191 | tilemap_mark_tile_dirty(reel_1_tilemap, offset); | |
| 211 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 212 | state->reeltileshigh_1_ram[offset] = data; | |
| 213 | tilemap_mark_tile_dirty(state->reel_1_tilemap, offset); | |
| 192 | 214 | } |
| 193 | 215 | |
| 194 | 216 | static WRITE8_HANDLER( reeltileshigh_2_w ) |
| 195 | 217 | { |
| 196 | reeltileshigh_2_ram[offset] = data; | |
| 197 | tilemap_mark_tile_dirty(reel_2_tilemap, offset); | |
| 218 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 219 | state->reeltileshigh_2_ram[offset] = data; | |
| 220 | tilemap_mark_tile_dirty(state->reel_2_tilemap, offset); | |
| 198 | 221 | } |
| 199 | 222 | |
| 200 | 223 | static WRITE8_HANDLER( reeltileshigh_3_w ) |
| 201 | 224 | { |
| 202 | reeltileshigh_3_ram[offset] = data; | |
| 203 | tilemap_mark_tile_dirty(reel_3_tilemap, offset); | |
| 225 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 226 | state->reeltileshigh_3_ram[offset] = data; | |
| 227 | tilemap_mark_tile_dirty(state->reel_3_tilemap, offset); | |
| 204 | 228 | } |
| 205 | 229 | |
| 206 | 230 | static WRITE8_HANDLER( reeltileshigh_4_w ) |
| 207 | 231 | { |
| 208 | reeltileshigh_4_ram[offset] = data; | |
| 209 | tilemap_mark_tile_dirty(reel_4_tilemap, offset); | |
| 232 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 233 | state->reeltileshigh_4_ram[offset] = data; | |
| 234 | tilemap_mark_tile_dirty(state->reel_4_tilemap, offset); | |
| 210 | 235 | } |
| 211 | 236 | |
| 212 | 237 | |
| 213 | 238 | static WRITE8_HANDLER( skylncr_paletteram_w ) |
| 214 | 239 | { |
| 215 | stat | |
| 240 | skylncr_state | |
| 216 | 241 | |
| 217 | 242 | if (offset == 0) |
| 218 | 243 | { |
| 219 | color = data; | |
| 244 | state->color = data; | |
| 220 | 245 | } |
| 221 | 246 | else |
| 222 | 247 | { |
| 223 | 248 | int r,g,b; |
| 224 | space->machine->generic.paletteram.u8[color] = data; | |
| 249 | space->machine->generic.paletteram.u8[state->color] = data; | |
| 225 | 250 | |
| 226 | r = space->machine->generic.paletteram.u8[(color/3 * 3) + 0]; | |
| 227 | g = space->machine->generic.paletteram.u8[(color/3 * 3) + 1]; | |
| 228 | b = space->machine->generic.paletteram.u8[(color/3 * 3) + 2]; | |
| 251 | r = space->machine->generic.paletteram.u8[(state->color/3 * 3) + 0]; | |
| 252 | g = space->machine->generic.paletteram.u8[(state->color/3 * 3) + 1]; | |
| 253 | b = space->machine->generic.paletteram.u8[(state->color/3 * 3) + 2]; | |
| 229 | 254 | r = (r << 2) | (r >> 4); |
| 230 | 255 | g = (g << 2) | (g >> 4); |
| 231 | 256 | b = (b << 2) | (b >> 4); |
| 232 | 257 | |
| 233 | palette_set_color(space->machine, color / 3, MAKE_RGB(r, g, b)); | |
| 234 | color = (color + 1) % (0x100 * 3); | |
| 258 | palette_set_color(space->machine, state->color / 3, MAKE_RGB(r, g, b)); | |
| 259 | state->color = (state->color + 1) % (0x100 * 3); | |
| 235 | 260 | } |
| 236 | 261 | } |
| 237 | 262 | |
| 238 | 263 | static WRITE8_HANDLER( skylncr_paletteram2_w ) |
| 239 | 264 | { |
| 240 | stat | |
| 265 | skylncr_state | |
| 241 | 266 | |
| 242 | 267 | if (offset == 0) |
| 243 | 268 | { |
| 244 | color = data; | |
| 269 | state->color2 = data; | |
| 245 | 270 | } |
| 246 | 271 | else |
| 247 | 272 | { |
| 248 | 273 | int r,g,b; |
| 249 | space->machine->generic.paletteram2.u8[color] = data; | |
| 274 | space->machine->generic.paletteram2.u8[state->color2] = data; | |
| 250 | 275 | |
| 251 | r = space->machine->generic.paletteram2.u8[(color/3 * 3) + 0]; | |
| 252 | g = space->machine->generic.paletteram2.u8[(color/3 * 3) + 1]; | |
| 253 | b = space->machine->generic.paletteram2.u8[(color/3 * 3) + 2]; | |
| 276 | r = space->machine->generic.paletteram2.u8[(state->color2/3 * 3) + 0]; | |
| 277 | g = space->machine->generic.paletteram2.u8[(state->color2/3 * 3) + 1]; | |
| 278 | b = space->machine->generic.paletteram2.u8[(state->color2/3 * 3) + 2]; | |
| 254 | 279 | r = (r << 2) | (r >> 4); |
| 255 | 280 | g = (g << 2) | (g >> 4); |
| 256 | 281 | b = (b << 2) | (b >> 4); |
| 257 | 282 | |
| 258 | palette_set_color(space->machine, 0x100 + color / 3, MAKE_RGB(r, g, b)); | |
| 259 | color = (color + 1) % (0x100 * 3); | |
| 283 | palette_set_color(space->machine, 0x100 + state->color2 / 3, MAKE_RGB(r, g, b)); | |
| 284 | state->color2 = (state->color2 + 1) % (0x100 * 3); | |
| 260 | 285 | } |
| 261 | 286 | } |
| 262 | 287 | |
| 263 | 288 | static WRITE8_HANDLER( reelscroll1_w ) |
| 264 | 289 | { |
| 265 | reelscroll1[offset] = data; | |
| 290 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 291 | state->reelscroll1[offset] = data; | |
| 266 | 292 | } |
| 267 | 293 | |
| 268 | 294 | static WRITE8_HANDLER( reelscroll2_w ) |
| 269 | 295 | { |
| 270 | reelscroll2[offset] = data; | |
| 296 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 297 | state->reelscroll2[offset] = data; | |
| 271 | 298 | } |
| 272 | 299 | |
| 273 | 300 | static WRITE8_HANDLER( reelscroll3_w ) |
| 274 | 301 | { |
| 275 | reelscroll3[offset] = data; | |
| 302 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 303 | state->reelscroll3[offset] = data; | |
| 276 | 304 | } |
| 277 | 305 | |
| 278 | 306 | static WRITE8_HANDLER( reelscroll4_w ) |
| 279 | 307 | { |
| 280 | reelscroll4[offset] = data; | |
| 308 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 309 | state->reelscroll4[offset] = data; | |
| 281 | 310 | } |
| 282 | 311 | |
| 283 | 312 | |
| r10886 | r10887 | |
| 304 | 333 | |
| 305 | 334 | static WRITE8_HANDLER( skylncr_nmi_enable_w ) |
| 306 | 335 | { |
| 307 | skylncr_nmi_enable = data & 0x10; | |
| 336 | skylncr_state *state = space->machine->driver_data<skylncr_state>(); | |
| 337 | state->nmi_enable = data & 0x10; | |
| 308 | 338 | } |
| 309 | 339 | |
| 310 | 340 | |
| r10886 | r10887 | |
| 316 | 346 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 317 | 347 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram") |
| 318 | 348 | |
| 319 | AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE( skylncr_videoram_w ) AM_BASE( &skylncr_videoram ) | |
| 320 | AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE( skylncr_colorram_w ) AM_BASE( &skylncr_colorram ) | |
| 349 | AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE( skylncr_videoram_w ) AM_BASE_MEMBER(skylncr_state, videoram ) | |
| 350 | AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE( skylncr_colorram_w ) AM_BASE_MEMBER(skylncr_state, colorram ) | |
| 321 | 351 | |
| 322 | AM_RANGE(0x9800, 0x99ff) AM_RAM_WRITE( reeltiles_1_w ) AM_BASE( &reeltiles_1_ram ) | |
| 323 | AM_RANGE(0x9a00, 0x9bff) AM_RAM_WRITE( reeltiles_2_w ) AM_BASE( &reeltiles_2_ram ) | |
| 324 | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE( reeltiles_3_w ) AM_BASE( &reeltiles_3_ram ) | |
| 325 | AM_RANGE(0x9e00, 0x9fff) AM_RAM_WRITE( reeltiles_4_w ) AM_BASE( &reeltiles_4_ram ) | |
| 326 | AM_RANGE(0xa000, 0xa1ff) AM_RAM_WRITE( reeltileshigh_1_w ) AM_BASE( &reeltileshigh_1_ram ) | |
| 327 | AM_RANGE(0xa200, 0xa3ff) AM_RAM_WRITE( reeltileshigh_2_w ) AM_BASE( &reeltileshigh_2_ram ) | |
| 328 | AM_RANGE(0xa400, 0xa5ff) AM_RAM_WRITE( reeltileshigh_3_w ) AM_BASE( &reeltileshigh_3_ram ) | |
| 329 | AM_RANGE(0xa600, 0xa7ff) AM_RAM_WRITE( reeltileshigh_4_w ) AM_BASE( &reeltileshigh_4_ram ) | |
| 352 | AM_RANGE(0x9800, 0x99ff) AM_RAM_WRITE( reeltiles_1_w ) AM_BASE_MEMBER(skylncr_state, reeltiles_1_ram ) | |
| 353 | AM_RANGE(0x9a00, 0x9bff) AM_RAM_WRITE( reeltiles_2_w ) AM_BASE_MEMBER(skylncr_state, reeltiles_2_ram ) | |
| 354 | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE( reeltiles_3_w ) AM_BASE_MEMBER(skylncr_state, reeltiles_3_ram ) | |
| 355 | AM_RANGE(0x9e00, 0x9fff) AM_RAM_WRITE( reeltiles_4_w ) AM_BASE_MEMBER(skylncr_state, reeltiles_4_ram ) | |
| 356 | AM_RANGE(0xa000, 0xa1ff) AM_RAM_WRITE( reeltileshigh_1_w ) AM_BASE_MEMBER(skylncr_state, reeltileshigh_1_ram ) | |
| 357 | AM_RANGE(0xa200, 0xa3ff) AM_RAM_WRITE( reeltileshigh_2_w ) AM_BASE_MEMBER(skylncr_state, reeltileshigh_2_ram ) | |
| 358 | AM_RANGE(0xa400, 0xa5ff) AM_RAM_WRITE( reeltileshigh_3_w ) AM_BASE_MEMBER(skylncr_state, reeltileshigh_3_ram ) | |
| 359 | AM_RANGE(0xa600, 0xa7ff) AM_RAM_WRITE( reeltileshigh_4_w ) AM_BASE_MEMBER(skylncr_state, reeltileshigh_4_ram ) | |
| 330 | 360 | |
| 331 | 361 | AM_RANGE(0xaa55, 0xaa55) AM_READ( ret_ff ) |
| 332 | 362 | |
| 333 | AM_RANGE(0xb000, 0xb03f) AM_RAM_WRITE(reelscroll1_w) AM_BASE( | |
| 363 | AM_RANGE(0xb000, 0xb03f) AM_RAM_WRITE(reelscroll1_w) AM_BASE_MEMBER(skylncr_state, reelscroll1) | |
| 334 | 364 | AM_RANGE(0xb040, 0xb07f) AM_RAM_WRITE(reelscroll1_w) |
| 335 | 365 | AM_RANGE(0xb080, 0xb0bf) AM_RAM_WRITE(reelscroll1_w) |
| 336 | 366 | AM_RANGE(0xb0c0, 0xb0ff) AM_RAM_WRITE(reelscroll1_w) |
| r10886 | r10887 | |
| 339 | 369 | AM_RANGE(0xb180, 0xb1bf) AM_RAM_WRITE(reelscroll1_w) |
| 340 | 370 | AM_RANGE(0xb1c0, 0xb1ff) AM_RAM_WRITE(reelscroll1_w) |
| 341 | 371 | |
| 342 | AM_RANGE(0xb200, 0xb23f) AM_RAM_WRITE(reelscroll2_w) AM_BASE( | |
| 372 | AM_RANGE(0xb200, 0xb23f) AM_RAM_WRITE(reelscroll2_w) AM_BASE_MEMBER(skylncr_state, reelscroll2) | |
| 343 | 373 | AM_RANGE(0xb240, 0xb27f) AM_RAM_WRITE(reelscroll2_w) |
| 344 | 374 | AM_RANGE(0xb280, 0xb2bf) AM_RAM_WRITE(reelscroll2_w) |
| 345 | 375 | AM_RANGE(0xb2c0, 0xb2ff) AM_RAM_WRITE(reelscroll2_w) |
| r10886 | r10887 | |
| 348 | 378 | AM_RANGE(0xb380, 0xb3bf) AM_RAM_WRITE(reelscroll2_w) |
| 349 | 379 | AM_RANGE(0xb3c0, 0xb3ff) AM_RAM_WRITE(reelscroll2_w) |
| 350 | 380 | |
| 351 | AM_RANGE(0xb400, 0xb43f) AM_RAM_WRITE(reelscroll3_w) AM_BASE( | |
| 381 | AM_RANGE(0xb400, 0xb43f) AM_RAM_WRITE(reelscroll3_w) AM_BASE_MEMBER(skylncr_state, reelscroll3) | |
| 352 | 382 | AM_RANGE(0xb440, 0xb47f) AM_RAM_WRITE(reelscroll3_w) |
| 353 | 383 | AM_RANGE(0xb480, 0xb4bf) AM_RAM_WRITE(reelscroll3_w) |
| 354 | 384 | AM_RANGE(0xb4c0, 0xb4ff) AM_RAM_WRITE(reelscroll3_w) |
| r10886 | r10887 | |
| 357 | 387 | AM_RANGE(0xb580, 0xb5bf) AM_RAM_WRITE(reelscroll3_w) |
| 358 | 388 | AM_RANGE(0xb5c0, 0xb5ff) AM_RAM_WRITE(reelscroll3_w) |
| 359 | 389 | |
| 360 | AM_RANGE(0xb600, 0xb63f) AM_RAM_WRITE(reelscroll4_w) AM_BASE( | |
| 390 | AM_RANGE(0xb600, 0xb63f) AM_RAM_WRITE(reelscroll4_w) AM_BASE_MEMBER(skylncr_state, reelscroll4) | |
| 361 | 391 | AM_RANGE(0xb640, 0xb67f) AM_RAM_WRITE(reelscroll4_w) |
| 362 | 392 | AM_RANGE(0xb680, 0xb6bf) AM_RAM_WRITE(reelscroll4_w) |
| 363 | 393 | AM_RANGE(0xb6c0, 0xb6ff) AM_RAM_WRITE(reelscroll4_w) |
| r10886 | r10887 | |
| 649 | 679 | // It runs in IM 0, thus needs an opcode on the data bus |
| 650 | 680 | static INTERRUPT_GEN( skylncr_vblank_interrupt ) |
| 651 | 681 | { |
| 652 | if (skylncr_nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 682 | skylncr_state *state = device->machine->driver_data<skylncr_state>(); | |
| 683 | if (state->nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 653 | 684 | } |
| 654 | 685 | |
| 655 | 686 | |
| r10886 | r10887 | |
| 657 | 688 | * Machine Driver * |
| 658 | 689 | *************************************/ |
| 659 | 690 | |
| 660 | static MACHINE_CONFIG_START( skylncr, | |
| 691 | static MACHINE_CONFIG_START( skylncr, skylncr | |
| 661 | 692 | |
| 662 | 693 | /* basic machine hardware */ |
| 663 | 694 | MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/4) |
| r10886 | r10887 | |
|---|---|---|
| 39 | 39 | UINT32 *spriteram; |
| 40 | 40 | UINT32 *spriteram2; |
| 41 | 41 | size_t spriteram_size; |
| 42 | tilemap_t *bg_tilemap; | |
| 43 | tilemap_t *md_tilemap; | |
| 44 | tilemap_t *fg_tilemap; | |
| 45 | UINT32 *bg_videoram; | |
| 46 | UINT32 *md_videoram; | |
| 47 | UINT32 *fg_videoram; | |
| 48 | UINT32 *videoreg; | |
| 49 | UINT32 *mainram; | |
| 50 | int spriteram_bit; | |
| 51 | bitmap_t *sprites_bitmap; | |
| 52 | bitmap_t *sprites_bitmap_pri; | |
| 53 | int prev_sprites_count; | |
| 54 | UINT8 spotty_sound_cmd; | |
| 42 | 55 | }; |
| 43 | 56 | |
| 44 | 57 | |
| 45 | static tilemap_t *bg_tilemap, *md_tilemap, *fg_tilemap; | |
| 46 | static UINT32 *bg_videoram, *md_videoram, *fg_videoram, *limenko_videoreg; | |
| 47 | ||
| 48 | static UINT32 *mainram; | |
| 49 | static int spriteram_bit; | |
| 50 | ||
| 51 | static bitmap_t *sprites_bitmap; | |
| 52 | static bitmap_t *sprites_bitmap_pri; | |
| 53 | ||
| 54 | static int prev_sprites_count = 0; | |
| 55 | ||
| 56 | 58 | static void draw_sprites(running_machine *machine, UINT32 *sprites, const rectangle *cliprect, int count); |
| 57 | 59 | |
| 58 | 60 | /***************************************************************************************************** |
| r10886 | r10887 | |
| 84 | 86 | |
| 85 | 87 | static WRITE32_HANDLER( bg_videoram_w ) |
| 86 | 88 | { |
| 87 | COMBINE_DATA(&bg_videoram[offset]); | |
| 88 | tilemap_mark_tile_dirty(bg_tilemap,offset); | |
| 89 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 90 | COMBINE_DATA(&state->bg_videoram[offset]); | |
| 91 | tilemap_mark_tile_dirty(state->bg_tilemap,offset); | |
| 89 | 92 | } |
| 90 | 93 | |
| 91 | 94 | static WRITE32_HANDLER( md_videoram_w ) |
| 92 | 95 | { |
| 93 | COMBINE_DATA(&md_videoram[offset]); | |
| 94 | tilemap_mark_tile_dirty(md_tilemap,offset); | |
| 96 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 97 | COMBINE_DATA(&state->md_videoram[offset]); | |
| 98 | tilemap_mark_tile_dirty(state->md_tilemap,offset); | |
| 95 | 99 | } |
| 96 | 100 | |
| 97 | 101 | static WRITE32_HANDLER( fg_videoram_w ) |
| 98 | 102 | { |
| 99 | COMBINE_DATA(&fg_videoram[offset]); | |
| 100 | tilemap_mark_tile_dirty(fg_tilemap,offset); | |
| 103 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 104 | COMBINE_DATA(&state->fg_videoram[offset]); | |
| 105 | tilemap_mark_tile_dirty(state->fg_tilemap,offset); | |
| 101 | 106 | } |
| 102 | 107 | |
| 103 | 108 | static WRITE32_HANDLER( spotty_soundlatch_w ) |
| r10886 | r10887 | |
| 107 | 112 | |
| 108 | 113 | static CUSTOM_INPUT( spriteram_bit_r ) |
| 109 | 114 | { |
| 110 | return spriteram_bit; | |
| 115 | limenko_state *state = field->port->machine->driver_data<limenko_state>(); | |
| 116 | return state->spriteram_bit; | |
| 111 | 117 | } |
| 112 | 118 | |
| 113 | 119 | static WRITE32_HANDLER( spriteram_buffer_w ) |
| r10886 | r10887 | |
| 119 | 125 | clip.min_y = 0; |
| 120 | 126 | clip.max_y = 239; |
| 121 | 127 | |
| 122 | bitmap_fill(sprites_bitmap_pri,&clip,0); | |
| 123 | bitmap_fill(sprites_bitmap,&clip,0); | |
| 128 | bitmap_fill(state->sprites_bitmap_pri,&clip,0); | |
| 129 | bitmap_fill(state->sprites_bitmap,&clip,0); | |
| 124 | 130 | |
| 125 | 131 | // toggle spriterams location in the memory map |
| 126 | spriteram_bit ^= 1; | |
| 132 | state->spriteram_bit ^= 1; | |
| 127 | 133 | |
| 128 | if(spriteram_bit) | |
| 134 | if(state->spriteram_bit) | |
| 129 | 135 | { |
| 130 | 136 | // draw the sprites to the frame buffer |
| 131 | draw_sprites(space->machine,state->spriteram2,&clip,prev_sprites_count); | |
| 137 | draw_sprites(space->machine,state->spriteram2,&clip,state->prev_sprites_count); | |
| 132 | 138 | } |
| 133 | 139 | else |
| 134 | 140 | { |
| 135 | 141 | // draw the sprites to the frame buffer |
| 136 | draw_sprites(space->machine,state->spriteram,&clip,prev_sprites_count); | |
| 142 | draw_sprites(space->machine,state->spriteram,&clip,state->prev_sprites_count); | |
| 137 | 143 | } |
| 138 | 144 | |
| 139 | 145 | // buffer the next number of sprites to draw |
| 140 | prev_sprites_count = ( | |
| 146 | state->prev_sprites_count = (state-> | |
| 141 | 147 | } |
| 142 | 148 | |
| 143 | 149 | /***************************************************************************************************** |
| r10886 | r10887 | |
| 145 | 151 | *****************************************************************************************************/ |
| 146 | 152 | |
| 147 | 153 | static ADDRESS_MAP_START( limenko_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 148 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE( | |
| 154 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE_MEMBER(limenko_state, mainram) | |
| 149 | 155 | AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("user2",0) |
| 150 | AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram) | |
| 151 | AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE(&md_videoram) | |
| 152 | AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram) | |
| 156 | AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(limenko_state, fg_videoram) | |
| 157 | AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE_MEMBER(limenko_state, md_videoram) | |
| 158 | AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(limenko_state, bg_videoram) | |
| 153 | 159 | AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_BASE_SIZE_MEMBER(limenko_state, spriteram, spriteram_size) |
| 154 | 160 | AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_BASE_MEMBER(limenko_state, spriteram2) |
| 155 | 161 | AM_RANGE(0x8001c000, 0x8001dfff) AM_RAM_WRITE(limenko_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 156 | 162 | AM_RANGE(0x8001e000, 0x8001ebff) AM_RAM // ? not used |
| 157 | AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE( | |
| 163 | AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE_MEMBER( | |
| 158 | 164 | AM_RANGE(0x8003e000, 0x8003e003) AM_WRITE(spriteram_buffer_w) |
| 159 | 165 | AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1",0) |
| 160 | 166 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 172 | 178 | /* Spotty memory map */ |
| 173 | 179 | |
| 174 | 180 | static ADDRESS_MAP_START( spotty_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 175 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE( | |
| 181 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE_MEMBER(limenko_state, mainram) | |
| 176 | 182 | AM_RANGE(0x40002000, 0x400024d3) AM_RAM //? |
| 177 | AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram) | |
| 178 | AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE(&md_videoram) | |
| 179 | AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram) | |
| 183 | AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(limenko_state, fg_videoram) | |
| 184 | AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE_MEMBER(limenko_state, md_videoram) | |
| 185 | AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(limenko_state, bg_videoram) | |
| 180 | 186 | AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_BASE_SIZE_MEMBER(limenko_state, spriteram, spriteram_size) |
| 181 | 187 | AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_BASE_MEMBER(limenko_state, spriteram2) |
| 182 | 188 | AM_RANGE(0x8001c000, 0x8001dfff) AM_RAM_WRITE(limenko_paletteram_w) AM_BASE_GENERIC(paletteram) |
| 183 | 189 | AM_RANGE(0x8001e000, 0x8001ebff) AM_RAM // ? not used |
| 184 | AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE( | |
| 190 | AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE_MEMBER( | |
| 185 | 191 | AM_RANGE(0x8003e000, 0x8003e003) AM_WRITE(spriteram_buffer_w) |
| 186 | 192 | AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0) |
| 187 | 193 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 195 | 201 | AM_RANGE(0x5000, 0x5003) AM_WRITE(spotty_soundlatch_w) |
| 196 | 202 | ADDRESS_MAP_END |
| 197 | 203 | |
| 198 | static UINT8 spotty_sound_cmd=0; | |
| 199 | 204 | static WRITE8_HANDLER( spotty_sound_cmd_w ) |
| 200 | 205 | { |
| 201 | spotty_sound_cmd = data; | |
| 206 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 207 | state->spotty_sound_cmd = data; | |
| 202 | 208 | } |
| 203 | 209 | |
| 204 | 210 | static READ8_HANDLER( spotty_sound_cmd_r ) |
| r10886 | r10887 | |
| 208 | 214 | |
| 209 | 215 | static READ8_HANDLER( spotty_sound_r ) |
| 210 | 216 | { |
| 211 | // check spotty_sound_cmd bits... | |
| 217 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 218 | // check state->spotty_sound_cmd bits... | |
| 212 | 219 | |
| 213 | if(spotty_sound_cmd == 0xf7) | |
| 220 | if(state->spotty_sound_cmd == 0xf7) | |
| 214 | 221 | return soundlatch_r(space,0); |
| 215 | 222 | else |
| 216 | 223 | return space->machine->device<okim6295_device>("oki")->read(*space,0); |
| r10886 | r10887 | |
| 227 | 234 | |
| 228 | 235 | static TILE_GET_INFO( get_bg_tile_info ) |
| 229 | 236 | { |
| 230 | int tile = bg_videoram[tile_index] & 0x7ffff; | |
| 231 | int color = (bg_videoram[tile_index]>>28) & 0xf; | |
| 237 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 238 | int tile = state->bg_videoram[tile_index] & 0x7ffff; | |
| 239 | int color = (state->bg_videoram[tile_index]>>28) & 0xf; | |
| 232 | 240 | SET_TILE_INFO(0,tile,color,0); |
| 233 | 241 | } |
| 234 | 242 | |
| 235 | 243 | static TILE_GET_INFO( get_md_tile_info ) |
| 236 | 244 | { |
| 237 | int tile = md_videoram[tile_index] & 0x7ffff; | |
| 238 | int color = (md_videoram[tile_index]>>28) & 0xf; | |
| 245 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 246 | int tile = state->md_videoram[tile_index] & 0x7ffff; | |
| 247 | int color = (state->md_videoram[tile_index]>>28) & 0xf; | |
| 239 | 248 | SET_TILE_INFO(0,tile,color,0); |
| 240 | 249 | } |
| 241 | 250 | |
| 242 | 251 | static TILE_GET_INFO( get_fg_tile_info ) |
| 243 | 252 | { |
| 244 | int tile = fg_videoram[tile_index] & 0x7ffff; | |
| 245 | int color = (fg_videoram[tile_index]>>28) & 0xf; | |
| 253 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 254 | int tile = state->fg_videoram[tile_index] & 0x7ffff; | |
| 255 | int color = (state->fg_videoram[tile_index]>>28) & 0xf; | |
| 246 | 256 | SET_TILE_INFO(0,tile,color,0); |
| 247 | 257 | } |
| 248 | 258 | |
| r10886 | r10887 | |
| 250 | 260 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 251 | 261 | int priority) |
| 252 | 262 | { |
| 263 | limenko_state *state = gfx->machine->driver_data<limenko_state>(); | |
| 253 | 264 | int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 254 | 265 | const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements); |
| 255 | 266 | |
| r10886 | r10887 | |
| 323 | 334 | { |
| 324 | 335 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; |
| 325 | 336 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 326 | UINT8 *pri = BITMAP_ADDR8(sprites_bitmap_pri, y, 0); | |
| 337 | UINT8 *pri = BITMAP_ADDR8(state->sprites_bitmap_pri, y, 0); | |
| 327 | 338 | |
| 328 | 339 | int x, x_index = x_index_base; |
| 329 | 340 | for( x=sx; x<ex; x++ ) |
| r10886 | r10887 | |
| 350 | 361 | // sprites aren't tile based (except for 8x8 ones) |
| 351 | 362 | static void draw_sprites(running_machine *machine, UINT32 *sprites, const rectangle *cliprect, int count) |
| 352 | 363 | { |
| 364 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 353 | 365 | int i; |
| 354 | 366 | |
| 355 | 367 | UINT8 *base_gfx = machine->region("gfx1")->base(); |
| r10886 | r10887 | |
| 393 | 405 | /* prepare GfxElement on the fly */ |
| 394 | 406 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width, 0, 256, 0); |
| 395 | 407 | |
| 396 | draw_single_sprite(sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x,y,pri); | |
| 408 | draw_single_sprite(state->sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x,y,pri); | |
| 397 | 409 | |
| 398 | 410 | // wrap around x |
| 399 | draw_single_sprite(sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x-512,y,pri); | |
| 411 | draw_single_sprite(state->sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x-512,y,pri); | |
| 400 | 412 | |
| 401 | 413 | // wrap around y |
| 402 | draw_single_sprite(sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x,y-512,pri); | |
| 414 | draw_single_sprite(state->sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x,y-512,pri); | |
| 403 | 415 | |
| 404 | 416 | // wrap around x and y |
| 405 | draw_single_sprite(sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x-512,y-512,pri); | |
| 417 | draw_single_sprite(state->sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x-512,y-512,pri); | |
| 406 | 418 | } |
| 407 | 419 | } |
| 408 | 420 | |
| 409 | static void copy_sprites(bitmap_t *bitmap, bitmap_t *sprites_bitmap, bitmap_t *priority_bitmap, const rectangle *cliprect) | |
| 421 | static void copy_sprites(running_machine *machine, bitmap_t *bitmap, bitmap_t *sprites_bitmap, bitmap_t *priority_bitmap, const rectangle *cliprect) | |
| 410 | 422 | { |
| 423 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 411 | 424 | int y; |
| 412 | 425 | for( y=cliprect->min_y; y<=cliprect->max_y; y++ ) |
| 413 | 426 | { |
| 414 | 427 | UINT16 *source = BITMAP_ADDR16(sprites_bitmap, y, 0); |
| 415 | 428 | UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0); |
| 416 | 429 | UINT8 *dest_pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 417 | UINT8 *source_pri = BITMAP_ADDR8(sprites_bitmap_pri, y, 0); | |
| 430 | UINT8 *source_pri = BITMAP_ADDR8(state->sprites_bitmap_pri, y, 0); | |
| 418 | 431 | |
| 419 | 432 | int x; |
| 420 | 433 | for( x=cliprect->min_x; x<=cliprect->max_x; x++ ) |
| r10886 | r10887 | |
| 430 | 443 | |
| 431 | 444 | static VIDEO_START( limenko ) |
| 432 | 445 | { |
| 433 | bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 434 | md_tilemap = tilemap_create(machine, get_md_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 435 | fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 446 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 447 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 448 | state->md_tilemap = tilemap_create(machine, get_md_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 449 | state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 436 | 450 | |
| 437 | tilemap_set_transparent_pen(md_tilemap,0); | |
| 438 | tilemap_set_transparent_pen(fg_tilemap,0); | |
| 451 | tilemap_set_transparent_pen(state->md_tilemap,0); | |
| 452 | tilemap_set_transparent_pen(state->fg_tilemap,0); | |
| 439 | 453 | |
| 440 | sprites_bitmap = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED16); | |
| 441 | sprites_bitmap_pri = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED8); | |
| 454 | state->sprites_bitmap = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED16); | |
| 455 | state->sprites_bitmap_pri = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED8); | |
| 442 | 456 | } |
| 443 | 457 | |
| 444 | 458 | static SCREEN_UPDATE( limenko ) |
| 445 | 459 | { |
| 446 | // limenko_videoreg[4] ???? It always has this value: 0xffeffff8 (2 signed bytes? values: -17 and -8 ?) | |
| 460 | limenko_state *state = screen->machine->driver_data<limenko_state>(); | |
| 461 | // state->videoreg[4] ???? It always has this value: 0xffeffff8 (2 signed bytes? values: -17 and -8 ?) | |
| 447 | 462 | |
| 448 | 463 | bitmap_fill(screen->machine->priority_bitmap,cliprect,0); |
| 449 | 464 | |
| 450 | tilemap_set_enable(bg_tilemap, limenko_videoreg[0] & 4); | |
| 451 | tilemap_set_enable(md_tilemap, limenko_videoreg[0] & 2); | |
| 452 | tilemap_set_enable(fg_tilemap, limenko_videoreg[0] & 1); | |
| 465 | tilemap_set_enable(state->bg_tilemap, state->videoreg[0] & 4); | |
| 466 | tilemap_set_enable(state->md_tilemap, state->videoreg[0] & 2); | |
| 467 | tilemap_set_enable(state->fg_tilemap, state->videoreg[0] & 1); | |
| 453 | 468 | |
| 454 | tilemap_set_scrolly(bg_tilemap, 0, limenko_videoreg[3] & 0xffff); | |
| 455 | tilemap_set_scrolly(md_tilemap, 0, limenko_videoreg[2] & 0xffff); | |
| 456 | tilemap_set_scrolly(fg_tilemap, 0, limenko_videoreg[1] & 0xffff); | |
| 469 | tilemap_set_scrolly(state->bg_tilemap, 0, state->videoreg[3] & 0xffff); | |
| 470 | tilemap_set_scrolly(state->md_tilemap, 0, state->videoreg[2] & 0xffff); | |
| 471 | tilemap_set_scrolly(state->fg_tilemap, 0, state->videoreg[1] & 0xffff); | |
| 457 | 472 | |
| 458 | tilemap_set_scrollx(bg_tilemap, 0, (limenko_videoreg[3] & 0xffff0000) >> 16); | |
| 459 | tilemap_set_scrollx(md_tilemap, 0, (limenko_videoreg[2] & 0xffff0000) >> 16); | |
| 460 | tilemap_set_scrollx(fg_tilemap, 0, (limenko_videoreg[1] & 0xffff0000) >> 16); | |
| 473 | tilemap_set_scrollx(state->bg_tilemap, 0, (state->videoreg[3] & 0xffff0000) >> 16); | |
| 474 | tilemap_set_scrollx(state->md_tilemap, 0, (state->videoreg[2] & 0xffff0000) >> 16); | |
| 475 | tilemap_set_scrollx(state->fg_tilemap, 0, (state->videoreg[1] & 0xffff0000) >> 16); | |
| 461 | 476 | |
| 462 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); | |
| 463 | tilemap_draw(bitmap,cliprect,md_tilemap,0,0); | |
| 464 | tilemap_draw(bitmap,cliprect,fg_tilemap,0,1); | |
| 477 | tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0); | |
| 478 | tilemap_draw(bitmap,cliprect,state->md_tilemap,0,0); | |
| 479 | tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,1); | |
| 465 | 480 | |
| 466 | if(limenko_videoreg[0] & 8) | |
| 467 | copy_sprites(bitmap, sprites_bitmap, screen->machine->priority_bitmap, cliprect); | |
| 481 | if(state->videoreg[0] & 8) | |
| 482 | copy_sprites(screen->machine, bitmap, state->sprites_bitmap, screen->machine->priority_bitmap, cliprect); | |
| 468 | 483 | |
| 469 | 484 | return 0; |
| 470 | 485 | } |
| r10886 | r10887 | |
| 981 | 996 | |
| 982 | 997 | static READ32_HANDLER( dynabomb_speedup_r ) |
| 983 | 998 | { |
| 999 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 984 | 1000 | if(space->machine->firstcpu->pc() == 0xc25b8) |
| 985 | 1001 | { |
| 986 | 1002 | space->machine->firstcpu->eat_cycles(50); |
| 987 | 1003 | } |
| 988 | 1004 | |
| 989 | return mainram[0xe2784/4]; | |
| 1005 | return state->mainram[0xe2784/4]; | |
| 990 | 1006 | } |
| 991 | 1007 | |
| 992 | 1008 | static READ32_HANDLER( legendoh_speedup_r ) |
| 993 | 1009 | { |
| 1010 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 994 | 1011 | if(space->machine->firstcpu->pc() == 0x23e32) |
| 995 | 1012 | { |
| 996 | 1013 | space->machine->firstcpu->eat_cycles(50); |
| 997 | 1014 | } |
| 998 | 1015 | |
| 999 | return mainram[0x32ab0/4]; | |
| 1016 | return state->mainram[0x32ab0/4]; | |
| 1000 | 1017 | } |
| 1001 | 1018 | |
| 1002 | 1019 | static READ32_HANDLER( sb2003_speedup_r ) |
| 1003 | 1020 | { |
| 1021 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 1004 | 1022 | if(space->machine->firstcpu->pc() == 0x26da4) |
| 1005 | 1023 | { |
| 1006 | 1024 | space->machine->firstcpu->eat_cycles(50); |
| 1007 | 1025 | } |
| 1008 | 1026 | |
| 1009 | return mainram[0x135800/4]; | |
| 1027 | return state->mainram[0x135800/4]; | |
| 1010 | 1028 | } |
| 1011 | 1029 | |
| 1012 | 1030 | static READ32_HANDLER( spotty_speedup_r ) |
| 1013 | 1031 | { |
| 1032 | limenko_state *state = space->machine->driver_data<limenko_state>(); | |
| 1014 | 1033 | if(space->machine->firstcpu->pc() == 0x8560) |
| 1015 | 1034 | { |
| 1016 | 1035 | space->machine->firstcpu->eat_cycles(50); |
| 1017 | 1036 | } |
| 1018 | 1037 | |
| 1019 | return mainram[0x6626c/4]; | |
| 1038 | return state->mainram[0x6626c/4]; | |
| 1020 | 1039 | } |
| 1021 | 1040 | |
| 1022 | 1041 | static DRIVER_INIT( dynabomb ) |
| 1023 | 1042 | { |
| 1043 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 1024 | 1044 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe2784, 0xe2787, 0, 0, dynabomb_speedup_r ); |
| 1025 | 1045 | |
| 1026 | spriteram_bit = 1; | |
| 1046 | state->spriteram_bit = 1; | |
| 1027 | 1047 | } |
| 1028 | 1048 | |
| 1029 | 1049 | static DRIVER_INIT( legendoh ) |
| 1030 | 1050 | { |
| 1051 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 1031 | 1052 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x32ab0, 0x32ab3, 0, 0, legendoh_speedup_r ); |
| 1032 | 1053 | |
| 1033 | spriteram_bit = 1; | |
| 1054 | state->spriteram_bit = 1; | |
| 1034 | 1055 | } |
| 1035 | 1056 | |
| 1036 | 1057 | static DRIVER_INIT( sb2003 ) |
| 1037 | 1058 | { |
| 1059 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 1038 | 1060 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x135800, 0x135803, 0, 0, sb2003_speedup_r ); |
| 1039 | 1061 | |
| 1040 | spriteram_bit = 1; | |
| 1062 | state->spriteram_bit = 1; | |
| 1041 | 1063 | } |
| 1042 | 1064 | |
| 1043 | 1065 | static DRIVER_INIT( spotty ) |
| 1044 | 1066 | { |
| 1067 | limenko_state *state = machine->driver_data<limenko_state>(); | |
| 1045 | 1068 | UINT8 *dst = machine->region("gfx1")->base(); |
| 1046 | 1069 | UINT8 *src = machine->region("user2")->base(); |
| 1047 | 1070 | int x; |
| r10886 | r10887 | |
| 1057 | 1080 | |
| 1058 | 1081 | memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6626c, 0x6626f, 0, 0, spotty_speedup_r ); |
| 1059 | 1082 | |
| 1060 | spriteram_bit = 1; | |
| 1083 | state->spriteram_bit = 1; | |
| 1061 | 1084 | } |
| 1062 | 1085 | |
| 1063 | 1086 | GAME( 2000, dynabomb, 0, limenko, sb2003, dynabomb, ROT0, "Limenko", "Dynamite Bomber (Korea, Rev 1.5)", GAME_NO_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 45 | 45 | #include "cpu/z80/z80.h" |
| 46 | 46 | #include "sound/ay8910.h" |
| 47 | 47 | |
| 48 | static UINT8 *poo_vram, *poo_scrolly, *poo_sprites; | |
| 49 | static UINT8 vram_colbank; | |
| 50 | 48 | |
| 49 | class poo_state : public driver_device | |
| 50 | { | |
| 51 | public: | |
| 52 | poo_state(running_machine &machine, const driver_device_config_base &config) | |
| 53 | : driver_device(machine, config) { } | |
| 54 | ||
| 55 | UINT8 *vram; | |
| 56 | UINT8 *scrolly; | |
| 57 | UINT8 *sprites; | |
| 58 | UINT8 vram_colbank; | |
| 59 | }; | |
| 60 | ||
| 61 | ||
| 51 | 62 | static VIDEO_START(unclepoo) |
| 52 | 63 | { |
| 53 | ||
| 54 | 64 | } |
| 55 | 65 | |
| 56 | 66 | static SCREEN_UPDATE(unclepoo) |
| 57 | 67 | { |
| 68 | poo_state *state = screen->machine->driver_data<poo_state>(); | |
| 58 | 69 | int y,x; |
| 59 | 70 | int count; |
| 60 | 71 | const gfx_element *gfx = screen->machine->gfx[0]; |
| r10886 | r10887 | |
| 65 | 76 | { |
| 66 | 77 | for (y=0;y<32;y++) |
| 67 | 78 | { |
| 68 | int tile = poo_vram[count+0x000] | ((poo_vram[count+0x400] & 3) <<8); | |
| 69 | int color = (poo_vram[count+0x400] & 0x38) >> 3; | |
| 70 | int scrolly = (poo_scrolly[x*4]); | |
| 79 | int tile = state->vram[count+0x000] | ((state->vram[count+0x400] & 3) <<8); | |
| 80 | int color = (state->vram[count+0x400] & 0x38) >> 3; | |
| 81 | int scrolly = (state->scrolly[x*4]); | |
| 71 | 82 | |
| 72 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color+vram_colbank,0,0,x*8,256-(y*8)+scrolly); | |
| 73 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color+vram_colbank,0,0,x*8,0-(y*8)+scrolly); | |
| 83 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color+state->vram_colbank,0,0,x*8,256-(y*8)+scrolly); | |
| 84 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color+state->vram_colbank,0,0,x*8,0-(y*8)+scrolly); | |
| 74 | 85 | |
| 75 | 86 | count++; |
| 76 | 87 | } |
| r10886 | r10887 | |
| 81 | 92 | |
| 82 | 93 | for(i=0;i<0x80;i+=4) |
| 83 | 94 | { |
| 84 | spr_offs = poo_sprites[i+2] | (poo_sprites[i+3] & 3) << 8; | |
| 85 | y = poo_sprites[i+0]+8; | |
| 86 | x = poo_sprites[i+1]; | |
| 87 | col = (poo_sprites[i+3] & 0xf8) >> 3; | |
| 95 | spr_offs = state->sprites[i+2] | (state->sprites[i+3] & 3) << 8; | |
| 96 | y = state->sprites[i+0]+8; | |
| 97 | x = state->sprites[i+1]; | |
| 98 | col = (state->sprites[i+3] & 0xf8) >> 3; | |
| 88 | 99 | fx = 0; |
| 89 | 100 | fy = 0; |
| 90 | 101 | |
| r10886 | r10887 | |
| 130 | 141 | |
| 131 | 142 | static WRITE8_HANDLER( poo_vregs_w ) |
| 132 | 143 | { |
| 144 | poo_state *state = space->machine->driver_data<poo_state>(); | |
| 133 | 145 | // bit 2 used, unknown purpose |
| 134 | vram_colbank = data & 0x18; | |
| 146 | state->vram_colbank = data & 0x18; | |
| 135 | 147 | } |
| 136 | 148 | |
| 137 | 149 | static ADDRESS_MAP_START( unclepoo_main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 140 | 152 | AM_RANGE(0x9000, 0x97ff) AM_RAM |
| 141 | 153 | AM_RANGE(0x9800, 0x9801) AM_READ(unk_inp_r) //AM_WRITE( unk_w ) |
| 142 | 154 | |
| 143 | AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE(&poo_sprites) | |
| 144 | AM_RANGE(0xb080, 0xb0ff) AM_RAM AM_BASE(&poo_scrolly) | |
| 155 | AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE_MEMBER(poo_state, sprites) | |
| 156 | AM_RANGE(0xb080, 0xb0ff) AM_RAM AM_BASE_MEMBER(poo_state, scrolly) | |
| 145 | 157 | |
| 146 | 158 | AM_RANGE(0xb400, 0xb400) AM_WRITE(sound_cmd_w) |
| 147 | 159 | |
| r10886 | r10887 | |
| 153 | 165 | |
| 154 | 166 | AM_RANGE(0xb700, 0xb700) AM_WRITE(poo_vregs_w) |
| 155 | 167 | |
| 156 | AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE( | |
| 168 | AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE_MEMBER( | |
| 157 | 169 | |
| 158 | 170 | ADDRESS_MAP_END |
| 159 | 171 | |
| r10886 | r10887 | |
| 310 | 322 | DEVCB_NULL |
| 311 | 323 | }; |
| 312 | 324 | |
| 313 | static MACHINE_CONFIG_START( unclepoo, | |
| 325 | static MACHINE_CONFIG_START( unclepoo, poo | |
| 314 | 326 | /* basic machine hardware */ |
| 315 | 327 | MCFG_CPU_ADD("maincpu", Z80,18000000/6) /* ? MHz */ |
| 316 | 328 | MCFG_CPU_PROGRAM_MAP(unclepoo_main_map) |
| r10886 | r10887 | |
|---|---|---|
| 2619 | 2619 | irq_line = INPUT_LINE_NMI; |
| 2620 | 2620 | galaxian_frogger_adjust = FALSE; |
| 2621 | 2621 | galaxian_sfx_tilemap = FALSE; |
| 2622 | galaxian_sprite_clip_start = 16; | |
| 2623 | galaxian_sprite_clip_end = 255; | |
| 2624 | 2622 | galaxian_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet; |
| 2625 | 2623 | galaxian_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background; |
| 2626 | 2624 | galaxian_extend_tile_info_ptr = extend_tile_info; |
| r10886 | r10887 | |
| 2791 | 2789 | |
| 2792 | 2790 | /* ...but coin lockout disabled/disconnected */ |
| 2793 | 2791 | memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, (write8_space_func)artic_gfxbank_w); |
| 2794 | ||
| 2795 | /* also shift the sprite clip offset */ | |
| 2796 | galaxian_sprite_clip_start = 7; | |
| 2797 | galaxian_sprite_clip_end = 246; | |
| 2798 | 2792 | } |
| 2799 | 2793 | |
| 2800 | 2794 | static READ8_HANDLER( tenspot_dsw_read ) |
| r10886 | r10887 | |
|---|---|---|
| 52 | 52 | #include "emu.h" |
| 53 | 53 | #include "cpu/e132xs/e132xs.h" |
| 54 | 54 | |
| 55 | static UINT32 *vram; | |
| 56 | static int vbuffer = 0; | |
| 57 | 55 | |
| 58 | static int flash_roms; | |
| 59 | static int old_vbuf; | |
| 60 | static UINT32 flash_cmd = 0; | |
| 61 | static INT32 first_offset; | |
| 56 | class dgpix_state : public driver_device | |
| 57 | { | |
| 58 | public: | |
| 59 | dgpix_state(running_machine &machine, const driver_device_config_base &config) | |
| 60 | : driver_device(machine, config) { } | |
| 62 | 61 | |
| 62 | UINT32 *vram; | |
| 63 | int vbuffer; | |
| 64 | int flash_roms; | |
| 65 | int old_vbuf; | |
| 66 | UINT32 flash_cmd; | |
| 67 | INT32 first_offset; | |
| 68 | }; | |
| 69 | ||
| 70 | ||
| 63 | 71 | static READ32_HANDLER( flash_r ) |
| 64 | 72 | { |
| 73 | dgpix_state *state = space->machine->driver_data<dgpix_state>(); | |
| 65 | 74 | UINT32 *ROM = (UINT32 *)space->machine->region("user1")->base(); |
| 66 | 75 | |
| 67 | if(offset >= (0x2000000 - flash_roms * 0x400000) / 4) | |
| 76 | if(offset >= (0x2000000 - state->flash_roms * 0x400000) / 4) | |
| 68 | 77 | { |
| 69 | if(flash_cmd == 0x90900000) | |
| 78 | if(state->flash_cmd == 0x90900000) | |
| 70 | 79 | { |
| 71 | 80 | //read maker ID and chip ID |
| 72 | 81 | return 0x00890014; |
| 73 | 82 | } |
| 74 | else if(flash_cmd == 0x00700000) | |
| 83 | else if(state->flash_cmd == 0x00700000) | |
| 75 | 84 | { |
| 76 | 85 | //read status |
| 77 | 86 | return 0x80<<16; |
| 78 | 87 | } |
| 79 | else if(flash_cmd == 0x70700000) | |
| 88 | else if(state->flash_cmd == 0x70700000) | |
| 80 | 89 | { |
| 81 | 90 | //read status and ? |
| 82 | 91 | return 0x82<<16; |
| 83 | 92 | } |
| 84 | else if(flash_cmd == 0xe8e80000) | |
| 93 | else if(state->flash_cmd == 0xe8e80000) | |
| 85 | 94 | { |
| 86 | 95 | //read status ? |
| 87 | 96 | return 0x80<<16; |
| r10886 | r10887 | |
| 93 | 102 | |
| 94 | 103 | static WRITE32_HANDLER( flash_w ) |
| 95 | 104 | { |
| 96 | if(flash_cmd == 0x20200000) | |
| 105 | dgpix_state *state = space->machine->driver_data<dgpix_state>(); | |
| 106 | if(state->flash_cmd == 0x20200000) | |
| 97 | 107 | { |
| 98 | 108 | // erase game settings |
| 99 | 109 | if(data == 0xd0d00000) |
| r10886 | r10887 | |
| 104 | 114 | // erase one block |
| 105 | 115 | memset(rom, 0xff, 0x10000); |
| 106 | 116 | |
| 107 | flash_cmd = 0; | |
| 117 | state->flash_cmd = 0; | |
| 108 | 118 | } |
| 109 | 119 | } |
| 110 | else if(flash_cmd == 0x0f0f0000) | |
| 120 | else if(state->flash_cmd == 0x0f0f0000) | |
| 111 | 121 | { |
| 112 | if(data == 0xd0d00000 && offset == first_offset) | |
| 122 | if(data == 0xd0d00000 && offset == state->first_offset) | |
| 113 | 123 | { |
| 114 | 124 | // finished |
| 115 | flash_cmd = 0; | |
| 116 | first_offset = -1; | |
| 125 | state->flash_cmd = 0; | |
| 126 | state->first_offset = -1; | |
| 117 | 127 | } |
| 118 | 128 | else |
| 119 | 129 | { |
| r10886 | r10887 | |
| 129 | 139 | } |
| 130 | 140 | else |
| 131 | 141 | { |
| 132 | flash_cmd = data; | |
| 142 | state->flash_cmd = data; | |
| 133 | 143 | |
| 134 | if(flash_cmd == 0x0f0f0000 && first_offset == -1) | |
| 144 | if(state->flash_cmd == 0x0f0f0000 && state->first_offset == -1) | |
| 135 | 145 | { |
| 136 | first_offset = offset; | |
| 146 | state->first_offset = offset; | |
| 137 | 147 | } |
| 138 | 148 | } |
| 139 | 149 | } |
| 140 | 150 | |
| 141 | 151 | static WRITE32_HANDLER( vram_w ) |
| 142 | 152 | { |
| 143 | UINT32 *dest = &vram[offset+(0x40000/4)*vbuffer]; | |
| 153 | dgpix_state *state = space->machine->driver_data<dgpix_state>(); | |
| 154 | UINT32 *dest = &state->vram[offset+(0x40000/4)*state->vbuffer]; | |
| 144 | 155 | |
| 145 | 156 | if (mem_mask == 0xffffffff) |
| 146 | 157 | { |
| r10886 | r10887 | |
| 157 | 168 | |
| 158 | 169 | static READ32_HANDLER( vram_r ) |
| 159 | 170 | { |
| 160 | return vram[offset+(0x40000/4)*vbuffer]; | |
| 171 | dgpix_state *state = space->machine->driver_data<dgpix_state>(); | |
| 172 | return state->vram[offset+(0x40000/4)*state->vbuffer]; | |
| 161 | 173 | } |
| 162 | 174 | |
| 163 | 175 | static WRITE32_HANDLER( vbuffer_w ) |
| 164 | 176 | { |
| 165 | if(old_vbuf == 3 && (data & 3) == 2) | |
| 177 | dgpix_state *state = space->machine->driver_data<dgpix_state>(); | |
| 178 | if(state->old_vbuf == 3 && (data & 3) == 2) | |
| 166 | 179 | { |
| 167 | vbuffer ^= 1; | |
| 180 | state->vbuffer ^= 1; | |
| 168 | 181 | } |
| 169 | 182 | |
| 170 | old_vbuf = data & 3; | |
| 183 | state->old_vbuf = data & 3; | |
| 171 | 184 | } |
| 172 | 185 | |
| 173 | 186 | static WRITE32_HANDLER( coin_w ) |
| r10886 | r10887 | |
| 268 | 281 | |
| 269 | 282 | static VIDEO_START( dgpix ) |
| 270 | 283 | { |
| 271 | vram = auto_alloc_array(machine, UINT32, 0x40000*2/4); | |
| 284 | dgpix_state *state = machine->driver_data<dgpix_state>(); | |
| 285 | state->vram = auto_alloc_array(machine, UINT32, 0x40000*2/4); | |
| 272 | 286 | } |
| 273 | 287 | |
| 274 | 288 | static SCREEN_UPDATE( dgpix ) |
| 275 | 289 | { |
| 290 | dgpix_state *state = screen->machine->driver_data<dgpix_state>(); | |
| 276 | 291 | int y; |
| 277 | 292 | |
| 278 | 293 | for (y = 0; y < 240; y++) |
| 279 | 294 | { |
| 280 | 295 | int x; |
| 281 | UINT32 *src = &vram[(vbuffer ? 0 : 0x10000) | (y << 8)]; | |
| 296 | UINT32 *src = &state->vram[(state->vbuffer ? 0 : 0x10000) | (y << 8)]; | |
| 282 | 297 | UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0); |
| 283 | 298 | |
| 284 | 299 | for (x = 0; x < 320; x += 2) |
| r10886 | r10887 | |
| 296 | 311 | |
| 297 | 312 | static MACHINE_RESET( dgpix ) |
| 298 | 313 | { |
| 299 | vbuffer = 0; | |
| 300 | flash_cmd = 0; | |
| 301 | first_offset = -1; | |
| 302 | old_vbuf = 3; | |
| 314 | dgpix_state *state = machine->driver_data<dgpix_state>(); | |
| 315 | state->vbuffer = 0; | |
| 316 | state->flash_cmd = 0; | |
| 317 | state->first_offset = -1; | |
| 318 | state->old_vbuf = 3; | |
| 303 | 319 | } |
| 304 | 320 | |
| 305 | 321 | |
| 306 | static MACHINE_CONFIG_START( dgpix, d | |
| 322 | static MACHINE_CONFIG_START( dgpix, dgpix | |
| 307 | 323 | MCFG_CPU_ADD("maincpu", E132XT, 20000000*4) /* 4x internal multiplier */ |
| 308 | 324 | MCFG_CPU_PROGRAM_MAP(cpu_map) |
| 309 | 325 | MCFG_CPU_IO_MAP(io_map) |
| r10886 | r10887 | |
| 556 | 572 | |
| 557 | 573 | static DRIVER_INIT( xfiles ) |
| 558 | 574 | { |
| 575 | dgpix_state *state = machine->driver_data<dgpix_state>(); | |
| 559 | 576 | UINT8 *rom = (UINT8 *)machine->region("user1")->base() + 0x1c00000; |
| 560 | 577 | |
| 561 | 578 | rom[BYTE4_XOR_BE(0x3aa92e)] = 3; |
| r10886 | r10887 | |
| 568 | 585 | // protection related ? |
| 569 | 586 | // memory_nop_read(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0); |
| 570 | 587 | |
| 571 | flash_roms = 2; | |
| 588 | state->flash_roms = 2; | |
| 572 | 589 | } |
| 573 | 590 | |
| 574 | 591 | static DRIVER_INIT( kdynastg ) |
| 575 | 592 | { |
| 593 | dgpix_state *state = machine->driver_data<dgpix_state>(); | |
| 576 | 594 | UINT8 *rom = (UINT8 *)machine->region("user1")->base() + 0x1c00000; |
| 577 | 595 | |
| 578 | 596 | rom[BYTE4_XOR_BE(0x3aaa10)] = 3; // 129f0 - nopped call |
| r10886 | r10887 | |
| 588 | 606 | // protection related ? |
| 589 | 607 | // memory_nop_read(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0); |
| 590 | 608 | |
| 591 | flash_roms = 4; | |
| 609 | state->flash_roms = 4; | |
| 592 | 610 | } |
| 593 | 611 | |
| 594 | 612 | static DRIVER_INIT( fmaniac3 ) |
| 595 | 613 | { |
| 596 | flash_roms = 2; | |
| 614 | dgpix_state *state = machine->driver_data<dgpix_state>(); | |
| 615 | state->flash_roms = 2; | |
| 597 | 616 | } |
| 598 | 617 | |
| 599 | 618 | GAME( 1999, xfiles, 0, dgpix, dgpix, xfiles, ROT0, "dgPIX Entertainment Inc.", "X-Files", GAME_NO_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 89 | 89 | class pachifev_state : public driver_device |
| 90 | 90 | { |
| 91 | 91 | public: |
| 92 | ||
| 92 | | |
| 93 | 93 | : driver_device(machine, config) { } |
| 94 | 94 | |
| 95 | /* controls related */ | |
| 95 | /* controls related */ | |
| 96 | int power; | |
| 97 | int max_power; | |
| 98 | int input_power; | |
| 99 | int previous_power; | |
| 100 | int cnt; | |
| 96 | 101 | |
| 97 | int power; | |
| 98 | int max_power; | |
| 99 | int input_power; | |
| 100 | int previous_power; | |
| 101 | int cnt; | |
| 102 | ||
| 102 | UINT32 adpcm_pos; | |
| 103 | UINT8 adpcm_idle; | |
| 104 | UINT8 trigger; | |
| 105 | UINT8 adpcm_data; | |
| 103 | 106 | }; |
| 104 | 107 | |
| 105 | 108 | static WRITE8_HANDLER(controls_w) |
| r10886 | r10887 | |
| 244 | 247 | |
| 245 | 248 | #if USE_MSM |
| 246 | 249 | |
| 247 | static UINT32 adpcm_pos; | |
| 248 | static UINT8 adpcm_idle=0; | |
| 249 | 250 | |
| 250 | 251 | static void pf_adpcm_int(device_t *device) |
| 251 | 252 | { |
| 252 | | |
| 253 | pachifev_state * | |
| 253 | 254 | |
| 254 | if (adpcm_pos >= 0x4000 || adpcm_idle) | |
| 255 | if (state->adpcm_pos >= 0x4000 || state->adpcm_idle) | |
| 255 | 256 | { |
| 256 | adpcm_idle = 1; | |
| 257 | state->adpcm_idle = 1; | |
| 257 | 258 | msm5205_reset_w(device,1); |
| 258 | trigger = 0; | |
| 259 | state->trigger = 0; | |
| 259 | 260 | } |
| 260 | 261 | else |
| 261 | 262 | { |
| 262 | 263 | UINT8 *ROM = device->machine->region("adpcm")->base(); |
| 263 | 264 | |
| 264 | adpcm_data = ((trigger ? (ROM[adpcm_pos] & 0x0f) : (ROM[adpcm_pos] & 0xf0)>>4) ); | |
| 265 | msm5205_data_w(device,adpcm_data & 0xf); | |
| 266 | trigger^=1; | |
| 267 | if(trigger == 0) | |
| 265 | state->adpcm_data = ((state->trigger ? (ROM[state->adpcm_pos] & 0x0f) : (ROM[state->adpcm_pos] & 0xf0)>>4) ); | |
| 266 | msm5205_data_w(device,state->adpcm_data & 0xf); | |
| 267 | state->trigger^=1; | |
| 268 | if(state->trigger == 0) | |
| 268 | 269 | { |
| 269 | adpcm_pos++; | |
| 270 | if((ROM[adpcm_pos] & 0xff) == 0xff) | |
| 271 | adpcm_idle = 1; | |
| 270 | state->adpcm_pos++; | |
| 271 | if((ROM[state->adpcm_pos] & 0xff) == 0xff) | |
| 272 | state->adpcm_idle = 1; | |
| 272 | 273 | } |
| 273 | 274 | } |
| 274 | 275 | } |
| r10886 | r10887 | |
| 292 | 293 | state->cnt=0; |
| 293 | 294 | |
| 294 | 295 | #if USE_MSM |
| 295 | adpcm_pos = 0; | |
| 296 | state->adpcm_pos = 0; | |
| 296 | 297 | #endif |
| 297 | 298 | } |
| 298 | 299 |
| r10886 | r10887 | |
|---|---|---|
| 91 | 91 | #include "video/pc_vga.h" |
| 92 | 92 | #include "video/pc_video.h" |
| 93 | 93 | |
| 94 | static UINT8 *banked_nvram; | |
| 95 | 94 | |
| 95 | class pcat_nit_state : public driver_device | |
| 96 | { | |
| 97 | public: | |
| 98 | pcat_nit_state(running_machine &machine, const driver_device_config_base &config) | |
| 99 | : driver_device(machine, config) { } | |
| 100 | ||
| 101 | UINT8 *banked_nvram; | |
| 102 | }; | |
| 103 | ||
| 104 | ||
| 96 | 105 | static void pcat_nit_microtouch_tx_callback(running_machine *machine, UINT8 data) |
| 97 | 106 | { |
| 98 | 107 | ins8250_receive(machine->device("ns16450_0"), data); |
| r10886 | r10887 | |
| 126 | 135 | |
| 127 | 136 | static WRITE8_HANDLER(pcat_nit_rombank_w) |
| 128 | 137 | { |
| 138 | pcat_nit_state *state = space->machine->driver_data<pcat_nit_state>(); | |
| 129 | 139 | logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(space->cpu) ); |
| 130 | 140 | if ( data & 0x40 ) |
| 131 | 141 | { |
| r10886 | r10887 | |
| 149 | 159 | |
| 150 | 160 | memory_install_readwrite_bank(space, 0x000d8000, 0x000d9fff, 0, 0, "nvrambank" ); |
| 151 | 161 | |
| 152 | memory_set_bankptr(space->machine, "nvrambank", banked_nvram); | |
| 162 | memory_set_bankptr(space->machine, "nvrambank", state->banked_nvram); | |
| 153 | 163 | |
| 154 | 164 | } |
| 155 | 165 | } |
| r10886 | r10887 | |
| 223 | 233 | microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL); |
| 224 | 234 | } |
| 225 | 235 | |
| 226 | static MACHINE_CONFIG_START( pcat_nit, | |
| 236 | static MACHINE_CONFIG_START( pcat_nit, pcat | |
| 227 | 237 | /* basic machine hardware */ |
| 228 | 238 | MCFG_CPU_ADD("maincpu", I386, 14318180*2) /* I386 ?? Mhz */ |
| 229 | 239 | MCFG_CPU_PROGRAM_MAP(pcat_map) |
| r10886 | r10887 | |
| 379 | 389 | |
| 380 | 390 | static DRIVER_INIT(pcat_nit) |
| 381 | 391 | { |
| 382 | banked_nvram = auto_alloc_array(machine, UINT8, 0x2000); | |
| 392 | pcat_nit_state *state = machine->driver_data<pcat_nit_state>(); | |
| 393 | state->banked_nvram = auto_alloc_array(machine, UINT8, 0x2000); | |
| 383 | 394 | |
| 384 | 395 | pc_vga_init(machine, &vga_interface, NULL); |
| 385 | 396 | } |
| r10886 | r10887 | |
|---|---|---|
| 84 | 84 | #include "sgsafari.lh" |
| 85 | 85 | #include "musicsrt.lh" |
| 86 | 86 | |
| 87 | static tilemap_t *layer0_tilemap, *layer1_tilemap, *layer2_tilemap; | |
| 88 | static UINT16 *layer0_videoram, *layer1_videoram, *layer2_videoram; | |
| 89 | static int layer2_offset[2]; | |
| 90 | static UINT16 *magic10_vregs; | |
| 91 | 87 | |
| 88 | class magic10_state : public driver_device | |
| 89 | { | |
| 90 | public: | |
| 91 | magic10_state(running_machine &machine, const driver_device_config_base &config) | |
| 92 | : driver_device(machine, config) { } | |
| 92 | 93 | |
| 94 | tilemap_t *layer0_tilemap; | |
| 95 | tilemap_t *layer1_tilemap; | |
| 96 | tilemap_t *layer2_tilemap; | |
| 97 | UINT16 *layer0_videoram; | |
| 98 | UINT16 *layer1_videoram; | |
| 99 | UINT16 *layer2_videoram; | |
| 100 | int layer2_offset[2]; | |
| 101 | UINT16 *vregs; | |
| 102 | UINT16 magic102_ret; | |
| 103 | }; | |
| 104 | ||
| 105 | ||
| 93 | 106 | /*************************** |
| 94 | 107 | * Video Hardware * |
| 95 | 108 | ***************************/ |
| 96 | 109 | |
| 97 | 110 | static WRITE16_HANDLER( layer0_videoram_w ) |
| 98 | 111 | { |
| 99 | COMBINE_DATA(&layer0_videoram[offset]); | |
| 100 | tilemap_mark_tile_dirty( layer0_tilemap, offset >> 1); | |
| 112 | magic10_state *state = space->machine->driver_data<magic10_state>(); | |
| 113 | COMBINE_DATA(&state->layer0_videoram[offset]); | |
| 114 | tilemap_mark_tile_dirty( state->layer0_tilemap, offset >> 1); | |
| 101 | 115 | } |
| 102 | 116 | |
| 103 | 117 | static WRITE16_HANDLER( layer1_videoram_w ) |
| 104 | 118 | { |
| 105 | COMBINE_DATA(&layer1_videoram[offset]); | |
| 106 | tilemap_mark_tile_dirty( layer1_tilemap, offset >> 1); | |
| 119 | magic10_state *state = space->machine->driver_data<magic10_state>(); | |
| 120 | COMBINE_DATA(&state->layer1_videoram[offset]); | |
| 121 | tilemap_mark_tile_dirty( state->layer1_tilemap, offset >> 1); | |
| 107 | 122 | } |
| 108 | 123 | |
| 109 | 124 | static WRITE16_HANDLER( layer2_videoram_w ) |
| 110 | 125 | { |
| 111 | COMBINE_DATA(&layer2_videoram[offset]); | |
| 112 | tilemap_mark_tile_dirty( layer2_tilemap, offset >> 1); | |
| 126 | magic10_state *state = space->machine->driver_data<magic10_state>(); | |
| 127 | COMBINE_DATA(&state->layer2_videoram[offset]); | |
| 128 | tilemap_mark_tile_dirty( state->layer2_tilemap, offset >> 1); | |
| 113 | 129 | } |
| 114 | 130 | |
| 115 | 131 | static WRITE16_HANDLER( paletteram_w ) |
| r10886 | r10887 | |
| 121 | 137 | |
| 122 | 138 | static TILE_GET_INFO( get_layer0_tile_info ) |
| 123 | 139 | { |
| 140 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 124 | 141 | SET_TILE_INFO |
| 125 | 142 | ( |
| 126 | 143 | 1, |
| 127 | layer0_videoram[tile_index * 2], | |
| 128 | layer0_videoram[tile_index * 2 + 1] & 0x0f, | |
| 129 | TILE_FLIPYX((layer0_videoram[tile_index * 2 + 1] & 0xc0) >> 6) | |
| 144 | state->layer0_videoram[tile_index * 2], | |
| 145 | state->layer0_videoram[tile_index * 2 + 1] & 0x0f, | |
| 146 | TILE_FLIPYX((state->layer0_videoram[tile_index * 2 + 1] & 0xc0) >> 6) | |
| 130 | 147 | ); |
| 131 | 148 | } |
| 132 | 149 | |
| 133 | 150 | static TILE_GET_INFO( get_layer1_tile_info ) |
| 134 | 151 | { |
| 152 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 135 | 153 | SET_TILE_INFO |
| 136 | 154 | ( |
| 137 | 155 | 1, |
| 138 | layer1_videoram[tile_index * 2], | |
| 139 | layer1_videoram[tile_index * 2 + 1] & 0x0f, | |
| 140 | TILE_FLIPYX((layer1_videoram[tile_index * 2 + 1] & 0xc0) >> 6) | |
| 156 | state->layer1_videoram[tile_index * 2], | |
| 157 | state->layer1_videoram[tile_index * 2 + 1] & 0x0f, | |
| 158 | TILE_FLIPYX((state->layer1_videoram[tile_index * 2 + 1] & 0xc0) >> 6) | |
| 141 | 159 | ); |
| 142 | 160 | } |
| 143 | 161 | |
| 144 | 162 | static TILE_GET_INFO( get_layer2_tile_info ) |
| 145 | 163 | { |
| 164 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 146 | 165 | SET_TILE_INFO |
| 147 | 166 | ( |
| 148 | 167 | 0, |
| 149 | layer2_videoram[tile_index * 2], | |
| 150 | layer2_videoram[tile_index * 2 + 1] & 0x0f, | |
| 168 | state->layer2_videoram[tile_index * 2], | |
| 169 | state->layer2_videoram[tile_index * 2 + 1] & 0x0f, | |
| 151 | 170 | 0 |
| 152 | 171 | ); |
| 153 | 172 | } |
| r10886 | r10887 | |
| 155 | 174 | |
| 156 | 175 | static VIDEO_START( magic10 ) |
| 157 | 176 | { |
| 158 | layer0_tilemap = tilemap_create(machine, get_layer0_tile_info, tilemap_scan_rows, 16, 16, 32, 32); | |
| 159 | layer1_tilemap = tilemap_create(machine, get_layer1_tile_info, tilemap_scan_rows, 16, 16, 32, 32); | |
| 160 | layer2_tilemap = tilemap_create(machine, get_layer2_tile_info, tilemap_scan_rows, 8, 8, 64, 64); | |
| 177 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 178 | state->layer0_tilemap = tilemap_create(machine, get_layer0_tile_info, tilemap_scan_rows, 16, 16, 32, 32); | |
| 179 | state->layer1_tilemap = tilemap_create(machine, get_layer1_tile_info, tilemap_scan_rows, 16, 16, 32, 32); | |
| 180 | state->layer2_tilemap = tilemap_create(machine, get_layer2_tile_info, tilemap_scan_rows, 8, 8, 64, 64); | |
| 161 | 181 | |
| 162 | tilemap_set_transparent_pen(layer1_tilemap, 0); | |
| 163 | tilemap_set_transparent_pen(layer2_tilemap, 0); | |
| 182 | tilemap_set_transparent_pen(state->layer1_tilemap, 0); | |
| 183 | tilemap_set_transparent_pen(state->layer2_tilemap, 0); | |
| 164 | 184 | } |
| 165 | 185 | |
| 166 | 186 | static SCREEN_UPDATE( magic10 ) |
| 167 | 187 | { |
| 188 | magic10_state *state = screen->machine->driver_data<magic10_state>(); | |
| 168 | 189 | /*TODO: understand where this comes from. */ |
| 169 | tilemap_set_scrollx(layer2_tilemap, 0, layer2_offset[0]); | |
| 170 | tilemap_set_scrolly(layer2_tilemap, 0, layer2_offset[1]); | |
| 190 | tilemap_set_scrollx(state->layer2_tilemap, 0, state->layer2_offset[0]); | |
| 191 | tilemap_set_scrolly(state->layer2_tilemap, 0, state->layer2_offset[1]); | |
| 171 | 192 | |
| 172 | 193 | /* |
| 173 | 194 | 4 and 6 are y/x global register writes. |
| 174 | 195 | 0 and 2 are y/x writes for the scrolling layer. |
| 175 | 196 | */ |
| 176 | tilemap_set_scrolly(layer1_tilemap, 0, (magic10_vregs[0/2] - magic10_vregs[4/2])+0); | |
| 177 | tilemap_set_scrollx(layer1_tilemap, 0, (magic10_vregs[2/2] - magic10_vregs[6/2])+4); | |
| 197 | tilemap_set_scrolly(state->layer1_tilemap, 0, (state->vregs[0/2] - state->vregs[4/2])+0); | |
| 198 | tilemap_set_scrollx(state->layer1_tilemap, 0, (state->vregs[2/2] - state->vregs[6/2])+4); | |
| 178 | 199 | |
| 179 | tilemap_draw(bitmap, cliprect, layer0_tilemap, 0, 0); | |
| 180 | tilemap_draw(bitmap, cliprect, layer1_tilemap, 0, 0); | |
| 181 | tilemap_draw(bitmap, cliprect, layer2_tilemap, 0, 0); | |
| 200 | tilemap_draw(bitmap, cliprect, state->layer0_tilemap, 0, 0); | |
| 201 | tilemap_draw(bitmap, cliprect, state->layer1_tilemap, 0, 0); | |
| 202 | tilemap_draw(bitmap, cliprect, state->layer2_tilemap, 0, 0); | |
| 182 | 203 | |
| 183 | 204 | return 0; |
| 184 | 205 | } |
| r10886 | r10887 | |
| 190 | 211 | |
| 191 | 212 | static READ16_HANDLER( magic102_r ) |
| 192 | 213 | { |
| 193 | static UINT16 ret = 0; | |
| 194 | ret ^= 0x20; | |
| 195 | return ret; | |
| 214 | magic10_state *state = space->machine->driver_data<magic10_state>(); | |
| 215 | state->magic102_ret ^= 0x20; | |
| 216 | return state->magic102_ret; | |
| 196 | 217 | } |
| 197 | 218 | |
| 198 | 219 | static READ16_HANDLER( hotslot_copro_r ) |
| 199 | 220 | { |
| 200 | static UINT16 ret = 0x0080; | |
| 201 | return ret; | |
| 221 | return 0x80; | |
| 202 | 222 | } |
| 203 | 223 | |
| 204 | 224 | static WRITE16_HANDLER( hotslot_copro_w ) |
| r10886 | r10887 | |
| 264 | 284 | |
| 265 | 285 | static ADDRESS_MAP_START( magic10_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 266 | 286 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 267 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(&layer1_videoram) | |
| 268 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(&layer0_videoram) | |
| 269 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(&layer2_videoram) | |
| 287 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE_MEMBER(magic10_state, layer1_videoram) | |
| 288 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE_MEMBER(magic10_state, layer0_videoram) | |
| 289 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE_MEMBER(magic10_state, layer2_videoram) | |
| 270 | 290 | AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") |
| 271 | 291 | AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_BASE_GENERIC(paletteram) |
| 272 | 292 | AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS") |
| r10886 | r10887 | |
| 274 | 294 | AM_RANGE(0x400008, 0x400009) AM_WRITE(magic10_out_w) |
| 275 | 295 | AM_RANGE(0x40000a, 0x40000b) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 276 | 296 | AM_RANGE(0x40000e, 0x40000f) AM_WRITENOP |
| 277 | AM_RANGE(0x400080, 0x400087) AM_RAM AM_BASE( | |
| 297 | AM_RANGE(0x400080, 0x400087) AM_RAM AM_BASE_MEMBER( | |
| 278 | 298 | AM_RANGE(0x600000, 0x603fff) AM_RAM |
| 279 | 299 | ADDRESS_MAP_END |
| 280 | 300 | |
| 281 | 301 | static ADDRESS_MAP_START( magic10a_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 282 | 302 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 283 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(&layer1_videoram) | |
| 284 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(&layer0_videoram) | |
| 285 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(&layer2_videoram) | |
| 303 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE_MEMBER(magic10_state, layer1_videoram) | |
| 304 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE_MEMBER(magic10_state, layer0_videoram) | |
| 305 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE_MEMBER(magic10_state, layer2_videoram) | |
| 286 | 306 | AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") |
| 287 | 307 | AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_BASE_GENERIC(paletteram) |
| 288 | 308 | AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS") |
| r10886 | r10887 | |
| 290 | 310 | AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w) |
| 291 | 311 | AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 292 | 312 | AM_RANGE(0x50000e, 0x50000f) AM_WRITENOP |
| 293 | AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE( | |
| 313 | AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE_MEMBER( | |
| 294 | 314 | AM_RANGE(0x600000, 0x603fff) AM_RAM |
| 295 | 315 | ADDRESS_MAP_END |
| 296 | 316 | |
| 297 | 317 | static ADDRESS_MAP_START( magic102_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 298 | 318 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 299 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(&layer1_videoram) | |
| 300 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(&layer0_videoram) | |
| 301 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(&layer2_videoram) | |
| 319 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE_MEMBER(magic10_state, layer1_videoram) | |
| 320 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE_MEMBER(magic10_state, layer0_videoram) | |
| 321 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE_MEMBER(magic10_state, layer2_videoram) | |
| 302 | 322 | AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") |
| 303 | 323 | AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_BASE_GENERIC(paletteram) |
| 304 | 324 | AM_RANGE(0x500000, 0x500001) AM_READ(magic102_r) |
| r10886 | r10887 | |
| 310 | 330 | AM_RANGE(0x500002, 0x50001f) AM_WRITENOP |
| 311 | 331 | AM_RANGE(0x600000, 0x603fff) AM_RAM |
| 312 | 332 | AM_RANGE(0x700000, 0x700001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 313 | AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE( | |
| 333 | AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE_MEMBER( | |
| 314 | 334 | ADDRESS_MAP_END |
| 315 | 335 | |
| 316 | 336 | static ADDRESS_MAP_START( hotslot_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 317 | 337 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 318 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(&layer1_videoram) | |
| 319 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(&layer0_videoram) | |
| 320 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(&layer2_videoram) | |
| 338 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE_MEMBER(magic10_state, layer1_videoram) | |
| 339 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE_MEMBER(magic10_state, layer0_videoram) | |
| 340 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE_MEMBER(magic10_state, layer2_videoram) | |
| 321 | 341 | AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") |
| 322 | 342 | AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_BASE_GENERIC(paletteram) |
| 323 | 343 | AM_RANGE(0x500004, 0x500005) AM_READWRITE(hotslot_copro_r, hotslot_copro_w) // copro comm |
| r10886 | r10887 | |
| 329 | 349 | AM_RANGE(0x50001a, 0x50001d) AM_WRITENOP |
| 330 | 350 | AM_RANGE(0x600000, 0x603fff) AM_RAM |
| 331 | 351 | AM_RANGE(0x70000a, 0x70000b) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 332 | AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE( | |
| 352 | AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE_MEMBER( | |
| 333 | 353 | ADDRESS_MAP_END |
| 334 | 354 | |
| 335 | 355 | static ADDRESS_MAP_START( sgsafari_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 336 | 356 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 337 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(&layer1_videoram) | |
| 338 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(&layer0_videoram) | |
| 339 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(&layer2_videoram) | |
| 357 | AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE_MEMBER(magic10_state, layer1_videoram) | |
| 358 | AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE_MEMBER(magic10_state, layer0_videoram) | |
| 359 | AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE_MEMBER(magic10_state, layer2_videoram) | |
| 340 | 360 | AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("nvram") |
| 341 | 361 | AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_BASE_GENERIC(paletteram) |
| 342 | 362 | AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW1") |
| 343 | 363 | AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w) |
| 344 | 364 | AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| 345 | 365 | AM_RANGE(0x50000e, 0x50000f) AM_READ_PORT("IN0") |
| 346 | AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE( | |
| 366 | AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE_MEMBER( | |
| 347 | 367 | AM_RANGE(0x600000, 0x603fff) AM_RAM |
| 348 | 368 | ADDRESS_MAP_END |
| 349 | 369 | /* |
| r10886 | r10887 | |
| 693 | 713 | * Machine Drivers * |
| 694 | 714 | ****************************/ |
| 695 | 715 | |
| 696 | static MACHINE_CONFIG_START( magic10, | |
| 716 | static MACHINE_CONFIG_START( magic10, magi | |
| 697 | 717 | /* basic machine hardware */ |
| 698 | 718 | MCFG_CPU_ADD("maincpu", M68000, 10000000) // ? |
| 699 | 719 | MCFG_CPU_PROGRAM_MAP(magic10_map) |
| r10886 | r10887 | |
| 1184 | 1204 | |
| 1185 | 1205 | static DRIVER_INIT( magic10 ) |
| 1186 | 1206 | { |
| 1187 | layer2_offset[0] = 32; | |
| 1188 | layer2_offset[1] = 2; | |
| 1207 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 1208 | state->layer2_offset[0] = 32; | |
| 1209 | state->layer2_offset[1] = 2; | |
| 1189 | 1210 | } |
| 1190 | 1211 | |
| 1191 | 1212 | static DRIVER_INIT( magic102 ) |
| 1192 | 1213 | { |
| 1193 | layer2_offset[0] = 8; | |
| 1194 | layer2_offset[1] = 20; | |
| 1214 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 1215 | state->layer2_offset[0] = 8; | |
| 1216 | state->layer2_offset[1] = 20; | |
| 1195 | 1217 | } |
| 1196 | 1218 | |
| 1197 | 1219 | static DRIVER_INIT( suprpool ) |
| 1198 | 1220 | { |
| 1199 | layer2_offset[0] = 8; | |
| 1200 | layer2_offset[1] = 16; | |
| 1221 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 1222 | state->layer2_offset[0] = 8; | |
| 1223 | state->layer2_offset[1] = 16; | |
| 1201 | 1224 | } |
| 1202 | 1225 | |
| 1203 | 1226 | static DRIVER_INIT( hotslot ) |
| 1204 | 1227 | { |
| 1228 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 1205 | 1229 | /* a value of -56 center the playfield, but displace the intro and initial screen. |
| 1206 | 1230 | a value of -64 center the intro and initial screen, but displace the playfield. |
| 1207 | 1231 | */ |
| 1208 | layer2_offset[0] = -56; // X offset. | |
| 1209 | layer2_offset[1] = 0; // Y offset. | |
| 1232 | state->layer2_offset[0] = -56; // X offset. | |
| 1233 | state->layer2_offset[1] = 0; // Y offset. | |
| 1210 | 1234 | } |
| 1211 | 1235 | |
| 1212 | 1236 | static DRIVER_INIT( sgsafari ) |
| 1213 | 1237 | { |
| 1214 | layer2_offset[0] = 16; | |
| 1215 | layer2_offset[1] = 20; | |
| 1238 | magic10_state *state = machine->driver_data<magic10_state>(); | |
| 1239 | state->layer2_offset[0] = 16; | |
| 1240 | state->layer2_offset[1] = 20; | |
| 1216 | 1241 | } |
| 1217 | 1242 | |
| 1218 | 1243 |
| r10886 | r10887 | |
|---|---|---|
| 119 | 119 | : driver_device(machine, config) { } |
| 120 | 120 | |
| 121 | 121 | UINT8 *videoram; |
| 122 | UINT8 blit_ram[8]; | |
| 122 | 123 | }; |
| 123 | 124 | |
| 124 | 125 | |
| r10886 | r10887 | |
| 164 | 165 | { |
| 165 | 166 | vpoker_state *state = space->machine->driver_data<vpoker_state>(); |
| 166 | 167 | UINT8 *videoram = state->videoram; |
| 167 | static UINT8 blit_ram[8]; | |
| 168 | 168 | |
| 169 | blit_ram[offset] = data; | |
| 169 | state->blit_ram[offset] = data; | |
| 170 | 170 | |
| 171 | 171 | if(offset == 2) |
| 172 | 172 | { |
| 173 | 173 | int blit_offs; |
| 174 | 174 | |
| 175 | blit_offs = (blit_ram[1] & 0x01)<<8|(blit_ram[2] & 0xff); | |
| 175 | blit_offs = (state->blit_ram[1] & 0x01)<<8|(state->blit_ram[2] & 0xff); | |
| 176 | 176 | |
| 177 | videoram[blit_offs] = blit_ram[0]; | |
| 178 | // printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",blit_ram[0],blit_ram[1],blit_ram[2],blit_ram[3],blit_ram[4],blit_ram[5],blit_ram[6],blit_ram[7]); | |
| 177 | videoram[blit_offs] = state->blit_ram[0]; | |
| 178 | // printf("%02x %02x %02x %02x %02x %02x %02x %02x\n",state->blit_ram[0],state->blit_ram[1],state->blit_ram[2],state->blit_ram[3],state->blit_ram[4],state->blit_ram[5],state->blit_ram[6],state->blit_ram[7]); | |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 |
| r10886 | r10887 | |
|---|---|---|
| 43 | 43 | : driver_device(machine, config), |
| 44 | 44 | m_nvram(*this, "nvram") { } |
| 45 | 45 | |
| 46 | required_shared_ptr<UINT16> m_nvram; | |
| 46 | optional_shared_ptr<UINT16> m_nvram; | |
| 47 | UINT8 *blit_buffer; | |
| 48 | UINT16 *frame_buffer; | |
| 49 | struct { int r,g,b,offs,offs_internal; } pal; | |
| 50 | struct { UINT8 r, g, b, offs, offs_internal, ram[256*3]; } btpal; | |
| 51 | UINT16 *blit_romaddr; | |
| 52 | UINT16 *blit_attr1_ram; | |
| 53 | UINT16 *blit_dst_ram_loword; | |
| 54 | UINT16 *blit_attr2_ram; | |
| 55 | UINT16 *blit_dst_ram_hiword; | |
| 56 | UINT16 *blit_vregs; | |
| 57 | UINT16 *blit_transpen; | |
| 47 | 58 | }; |
| 48 | 59 | |
| 49 | 60 | /************************************************************************************************************* |
| r10886 | r10887 | |
| 52 | 63 | |
| 53 | 64 | *************************************************************************************************************/ |
| 54 | 65 | |
| 55 | static UINT8 *blit_buffer; | |
| 56 | ||
| 57 | 66 | struct blit_t |
| 58 | 67 | { |
| 59 | 68 | UINT8 x, y; |
| r10886 | r10887 | |
| 69 | 78 | |
| 70 | 79 | static VIDEO_START(blitz68k) |
| 71 | 80 | { |
| 72 | blit_buffer = auto_alloc_array(machine, UINT8, 512*256); | |
| 81 | blitz68k_state *state = machine->driver_data<blitz68k_state>(); | |
| 82 | state->blit_buffer = auto_alloc_array(machine, UINT8, 512*256); | |
| 73 | 83 | blit.addr_factor = 2; |
| 74 | 84 | } |
| 75 | 85 | |
| r10886 | r10887 | |
| 81 | 91 | |
| 82 | 92 | static SCREEN_UPDATE(blitz68k) |
| 83 | 93 | { |
| 94 | blitz68k_state *state = screen->machine->driver_data<blitz68k_state>(); | |
| 84 | 95 | int x,y; |
| 85 | 96 | |
| 86 | UINT8 *src = blit_buffer; | |
| 97 | UINT8 *src = state->blit_buffer; | |
| 87 | 98 | |
| 88 | 99 | for(y = 0; y < 256; y++) |
| 89 | 100 | { |
| r10886 | r10887 | |
| 98 | 109 | |
| 99 | 110 | // Blitter-less board (SPI-68K) |
| 100 | 111 | |
| 101 | static UINT16 *frame_buffer; | |
| 102 | 112 | |
| 103 | 113 | static SCREEN_UPDATE(blitz68k_noblit) |
| 104 | 114 | { |
| 115 | blitz68k_state *state = screen->machine->driver_data<blitz68k_state>(); | |
| 105 | 116 | int x,y; |
| 106 | 117 | |
| 107 | UINT16 *src = frame_buffer; | |
| 118 | UINT16 *src = state->frame_buffer; | |
| 108 | 119 | |
| 109 | 120 | for(y = 0; y < 256; y++) |
| 110 | 121 | { |
| r10886 | r10887 | |
| 129 | 140 | |
| 130 | 141 | static WRITE16_HANDLER( paletteram_io_w ) |
| 131 | 142 | { |
| 132 | static int pal_offs,r,g,b,internal_pal_offs,pal_data; | |
| 143 | blitz68k_state *state = space->machine->driver_data<blitz68k_state>(); | |
| 144 | int pal_data; | |
| 133 | 145 | |
| 134 | 146 | switch(offset*2) |
| 135 | 147 | { |
| 136 | 148 | case 0: |
| 137 | pal | |
| 149 | state->pal.offs = (data & 0xff00) >> 8; | |
| 138 | 150 | break; |
| 139 | 151 | case 4: |
| 140 | | |
| 152 | s | |
| 141 | 153 | break; |
| 142 | 154 | case 2: |
| 143 | switch( | |
| 155 | switch(s | |
| 144 | 156 | { |
| 145 | 157 | case 0: |
| 146 | 158 | pal_data = (data & 0xff00) >> 8; |
| 147 | r = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 148 | internal_pal_offs++; | |
| 159 | state->pal.r = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 160 | state->pal.offs_internal++; | |
| 149 | 161 | break; |
| 150 | 162 | case 1: |
| 151 | 163 | pal_data = (data & 0xff00) >> 8; |
| 152 | g = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 153 | internal_pal_offs++; | |
| 164 | state->pal.g = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 165 | state->pal.offs_internal++; | |
| 154 | 166 | break; |
| 155 | 167 | case 2: |
| 156 | 168 | pal_data = (data & 0xff00) >> 8; |
| 157 | b = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 158 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 159 | internal_pal_offs = 0; | |
| 160 | pal_offs++; | |
| 169 | state->pal.b = ((pal_data & 0x3f) << 2) | ((pal_data & 0x30) >> 4); | |
| 170 | palette_set_color(space->machine, state->pal.offs, MAKE_RGB(state->pal.r, state->pal.g, state->pal.b)); | |
| 171 | state->pal.offs_internal = 0; | |
| 172 | state->pal.offs++; | |
| 161 | 173 | break; |
| 162 | 174 | } |
| 163 | 175 | |
| r10886 | r10887 | |
| 172 | 184 | |
| 173 | 185 | *************************************************************************************************************/ |
| 174 | 186 | |
| 175 | static UINT8 pal_ram[256*3]; | |
| 176 | static UINT8 pal_offs, internal_pal_offs, r, g, b; | |
| 177 | 187 | |
| 178 | 188 | static WRITE8_HANDLER( paletteram_bt476_w ) |
| 179 | 189 | { |
| 190 | blitz68k_state *state = space->machine->driver_data<blitz68k_state>(); | |
| 180 | 191 | switch(offset) |
| 181 | 192 | { |
| 182 | 193 | case 0: |
| 183 | pal_offs = data; | |
| 184 | internal_pal_offs = 0; | |
| 194 | state->btpal.offs = data; | |
| 195 | state->btpal.offs_internal = 0; | |
| 185 | 196 | break; |
| 186 | 197 | case 2: |
| 187 | pal_offs = data; | |
| 188 | internal_pal_offs = 0; | |
| 198 | state->btpal.offs = data; | |
| 199 | state->btpal.offs_internal = 0; | |
| 189 | 200 | break; |
| 190 | 201 | case 1: |
| 191 | 202 | data &= 0x3f; |
| 192 | pal_ram[pal_offs * 3 + internal_pal_offs] = data; | |
| 193 | switch(internal_pal_offs) | |
| 203 | state->btpal.ram[state->btpal.offs * 3 + state->btpal.offs_internal] = data; | |
| 204 | switch(state->btpal.offs_internal) | |
| 194 | 205 | { |
| 195 | 206 | case 0: |
| 196 | r = data << 2; | |
| 197 | internal_pal_offs++; | |
| 207 | state->btpal.r = data << 2; | |
| 208 | state->btpal.offs_internal++; | |
| 198 | 209 | break; |
| 199 | 210 | case 1: |
| 200 | g = data << 2; | |
| 201 | internal_pal_offs++; | |
| 211 | state->btpal.g = data << 2; | |
| 212 | state->btpal.offs_internal++; | |
| 202 | 213 | break; |
| 203 | 214 | case 2: |
| 204 | b = data << 2; | |
| 205 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 206 | internal_pal_offs = 0; | |
| 207 | pal_offs++; | |
| 215 | state->btpal.b = data << 2; | |
| 216 | palette_set_color(space->machine, state->btpal.offs, MAKE_RGB(state->btpal.r, state->btpal.g, state->btpal.b)); | |
| 217 | state->btpal.offs_internal = 0; | |
| 218 | state->btpal.offs++; | |
| 208 | 219 | break; |
| 209 | 220 | } |
| 210 | 221 | break; |
| r10886 | r10887 | |
| 213 | 224 | |
| 214 | 225 | static READ8_HANDLER( paletteram_bt476_r ) |
| 215 | 226 | { |
| 227 | blitz68k_state *state = space->machine->driver_data<blitz68k_state>(); | |
| 216 | 228 | UINT8 ret = 0xff; |
| 217 | 229 | |
| 218 | 230 | switch(offset) |
| 219 | 231 | { |
| 220 | 232 | case 0: |
| 221 | ret = pal | |
| 233 | ret = state->btpal.offs; | |
| 222 | 234 | break; |
| 223 | 235 | |
| 224 | 236 | case 1: |
| 225 | ret = pal_ram[pal_offs * 3 + internal_pal_offs]; | |
| 226 | internal_pal_offs++; | |
| 227 | if (internal_pal_offs >= 3) | |
| 237 | ret = state->btpal.ram[state->btpal.offs * 3 + state->btpal.offs_internal]; | |
| 238 | state->btpal.offs_internal++; | |
| 239 | if (state->btpal.offs_internal >= 3) | |
| 228 | 240 | { |
| 229 | internal_pal_offs = 0; | |
| 230 | pal_offs++; | |
| 241 | state->btpal.offs_internal = 0; | |
| 242 | state->btpal.offs++; | |
| 231 | 243 | } |
| 232 | 244 | break; |
| 233 | 245 | } |
| r10886 | r10887 | |
| 252 | 264 | |
| 253 | 265 | *************************************************************************************************************/ |
| 254 | 266 | |
| 255 | static UINT16 *blit_romaddr,*blit_attr1_ram,*blit_dst_ram_loword,*blit_attr2_ram,*blit_dst_ram_hiword,*blit_vregs,*blit_transpen; | |
| 256 | 267 | |
| 257 | 268 | static WRITE16_HANDLER( blit_copy_w ) |
| 258 | 269 | { |
| 270 | blitz68k_state *state = space->machine->driver_data<blitz68k_state>(); | |
| 259 | 271 | UINT8 *blit_rom = space->machine->region("blitter")->base(); |
| 260 | 272 | UINT32 blit_dst_xpos; |
| 261 | 273 | UINT32 blit_dst_ypos; |
| 262 | 274 | int x,y,x_size,y_size; |
| 263 | 275 | UINT32 src; |
| 264 | 276 | |
| 265 | logerror("blit copy %04x %04x %04x %04x %04x\n", blit_romaddr[0], blit_attr1_ram[0], blit_dst_ram_loword[0], blit_attr2_ram[0], blit_dst_ram_hiword[0] ); | |
| 266 | logerror("blit vregs %04x %04x %04x %04x\n",blit_vregs[0/2],blit_vregs[2/2],blit_vregs[4/2],blit_vregs[6/2]); | |
| 267 | logerror("blit transpen %04x %04x %04x %04x %04x %04x %04x %04x\n",blit_transpen[0/2],blit_transpen[2/2],blit_transpen[4/2],blit_transpen[6/2], | |
| 268 | blit_transpen[8/2],blit_transpen[10/2],blit_transpen[12/2],blit_transpen[14/2]); | |
| 277 | logerror("blit copy %04x %04x %04x %04x %04x\n", state->blit_romaddr[0], state->blit_attr1_ram[0], state->blit_dst_ram_loword[0], state->blit_attr2_ram[0], state->blit_dst_ram_hiword[0] ); | |
| 278 | logerror("blit vregs %04x %04x %04x %04x\n",state->blit_vregs[0/2],state->blit_vregs[2/2],state->blit_vregs[4/2],state->blit_vregs[6/2]); | |
| 279 | logerror("blit transpen %04x %04x %04x %04x %04x %04x %04x %04x\n",state->blit_transpen[0/2],state->blit_transpen[2/2],state->blit_transpen[4/2],state->blit_transpen[6/2], | |
| 280 | state->blit_transpen[8/2],state->blit_transpen[10/2],state->blit_transpen[12/2],state->blit_transpen[14/2]); | |
| 269 | 281 | |
| 270 | blit_dst_xpos = (blit_dst_ram_loword[0] & 0x00ff)*2; | |
| 271 | blit_dst_ypos = ((blit_dst_ram_loword[0] & 0xff00)>>8); | |
| 282 | blit_dst_xpos = (state->blit_dst_ram_loword[0] & 0x00ff)*2; | |
| 283 | blit_dst_ypos = ((state->blit_dst_ram_loword[0] & 0xff00)>>8); | |
| 272 | 284 | |
| 273 | y_size = (0x100-((blit_attr2_ram[0] & 0xff00)>>8)); | |
| 274 | x_size = (blit_attr2_ram[0] & 0x00ff)*2; | |
| 285 | y_size = (0x100-((state->blit_attr2_ram[0] & 0xff00)>>8)); | |
| 286 | x_size = (state->blit_attr2_ram[0] & 0x00ff)*2; | |
| 275 | 287 | |
| 276 | 288 | /* rounding around for 0 size */ |
| 277 | 289 | if(x_size == 0) { x_size = 0x200; } |
| r10886 | r10887 | |
| 279 | 291 | /* TODO: used by steaser "Game Over" msg on attract mode*/ |
| 280 | 292 | // if(y_size == 1) { y_size = 32; } |
| 281 | 293 | |
| 282 | src = blit_romaddr[0] | (blit_attr1_ram[0] & 0x1f00)<<8; | |
| 283 | // src|= (blit_transpen[0xc/2] & 0x0100)<<12; | |
| 294 | src = state->blit_romaddr[0] | (state->blit_attr1_ram[0] & 0x1f00)<<8; | |
| 295 | // src|= (state->blit_transpen[0xc/2] & 0x0100)<<12; | |
| 284 | 296 | |
| 285 | 297 | for(y=0;y<y_size;y++) |
| 286 | 298 | { |
| r10886 | r10887 | |
| 288 | 300 | { |
| 289 | 301 | int drawx = (blit_dst_xpos+x)&0x1ff; |
| 290 | 302 | int drawy = (blit_dst_ypos+y)&0x0ff; |
| 291 | if(blit_transpen[0x8/2] & 0x100) | |
| 292 | blit_buffer[drawy*512+drawx] = ((blit_vregs[0] & 0xf00)>>8); | |
| 303 | if(state->blit_transpen[0x8/2] & 0x100) | |
| 304 | state->blit_buffer[drawy*512+drawx] = ((state->blit_vregs[0] & 0xf00)>>8); | |
| 293 | 305 | else |
| 294 | 306 | { |
| 295 | 307 | UINT8 pen_helper; |
| 296 | 308 | |
| 297 | 309 | pen_helper = blit_rom[src] & 0xff; |
| 298 | if(blit_transpen[0xa/2] & 0x100) //pen is opaque register | |
| 310 | if(state->blit_transpen[0xa/2] & 0x100) //pen is opaque register | |
| 299 | 311 | { |
| 300 | 312 | if(pen_helper) |
| 301 | blit_buffer[drawy*512+drawx] = ((pen_helper & 0xff) <= 3) ? ((blit_vregs[pen_helper] & 0xf00)>>8) : blit_rom[src]; | |
| 313 | state->blit_buffer[drawy*512+drawx] = ((pen_helper & 0xff) <= 3) ? ((state->blit_vregs[pen_helper] & 0xf00)>>8) : blit_rom[src]; | |
| 302 | 314 | } |
| 303 | 315 | else |
| 304 | blit_buffer[drawy*512+drawx] = ((pen_helper & 0xff) <= 3) ? ((blit_vregs[pen_helper] & 0xf00)>>8) : blit_rom[src]; | |
| 316 | state->blit_buffer[drawy*512+drawx] = ((pen_helper & 0xff) <= 3) ? ((state->blit_vregs[pen_helper] & 0xf00)>>8) : blit_rom[src]; | |
| 305 | 317 | } |
| 306 | 318 | |
| 307 | 319 | src++; |
| r10886 | r10887 | |
| 444 | 456 | |
| 445 | 457 | static WRITE8_HANDLER( blit_draw_w ) |
| 446 | 458 | { |
| 459 | blitz68k_state *state = space->machine->driver_data<blitz68k_state>(); | |
| 447 | 460 | UINT8 *blit_rom = space->machine->region("blitter")->base(); |
| 448 | 461 | int blit_romsize = space->machine->region("blitter")->bytes(); |
| 449 | 462 | UINT32 blit_dst_xpos; |
| r10886 | r10887 | |
| 498 | 511 | if (pen <= 3) |
| 499 | 512 | pen = blit.pen[pen] & 0xf; |
| 500 | 513 | |
| 501 | blit_buffer[drawy * 512 + drawx] = pen; | |
| 514 | state->blit_buffer[drawy * 512 + drawx] = pen; | |
| 502 | 515 | } |
| 503 | 516 | } |
| 504 | 517 | } |
| r10886 | r10887 | |
| 590 | 603 | // AM_RANGE(0x880000, 0x880001) AM_READ(test_r) |
| 591 | 604 | |
| 592 | 605 | AM_RANGE(0x900000, 0x900005) AM_WRITE( paletteram_io_w ) //RAMDAC |
| 593 | AM_RANGE(0x980000, 0x98000f) AM_RAM AM_BASE(&blit_transpen) //video registers for the blitter write | |
| 594 | AM_RANGE(0x990000, 0x990007) AM_RAM AM_BASE(&blit_vregs) //pens | |
| 595 | AM_RANGE(0x998000, 0x998001) AM_RAM AM_BASE(&blit_romaddr) | |
| 596 | AM_RANGE(0x9a0000, 0x9a0001) AM_RAM AM_BASE(&blit_attr1_ram) | |
| 597 | AM_RANGE(0x9a8000, 0x9a8001) AM_RAM AM_BASE(&blit_dst_ram_loword) | |
| 598 | AM_RANGE(0x9b0000, 0x9b0001) AM_RAM AM_BASE(&blit_attr2_ram) | |
| 599 | AM_RANGE(0x9b8000, 0x9b8001) AM_RAM_WRITE( blit_copy_w ) AM_BASE(&blit_dst_ram_hiword) | |
| 606 | AM_RANGE(0x980000, 0x98000f) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_transpen) //video registers for the blitter write | |
| 607 | AM_RANGE(0x990000, 0x990007) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_vregs) //pens | |
| 608 | AM_RANGE(0x998000, 0x998001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_romaddr) | |
| 609 | AM_RANGE(0x9a0000, 0x9a0001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_attr1_ram) | |
| 610 | AM_RANGE(0x9a8000, 0x9a8001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_dst_ram_loword) | |
| 611 | AM_RANGE(0x9b0000, 0x9b0001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_attr2_ram) | |
| 612 | AM_RANGE(0x9b8000, 0x9b8001) AM_RAM_WRITE( blit_copy_w ) AM_BASE_MEMBER(blitz68k_state, blit_dst_ram_hiword) | |
| 600 | 613 | AM_RANGE(0x9e0000, 0x9e0001) AM_READ(blitter_status_r) |
| 601 | 614 | |
| 602 | 615 | AM_RANGE(0xc00000, 0xc00001) AM_WRITE(lamps_w) |
| r10886 | r10887 | |
| 618 | 631 | |
| 619 | 632 | AM_RANGE(0x900000, 0x900005) AM_WRITE( paletteram_io_w ) //RAMDAC |
| 620 | 633 | AM_RANGE(0x940000, 0x940001) AM_WRITENOP //? Seems a dword write for some read, written consecutively |
| 621 | AM_RANGE(0x980000, 0x98000f) AM_RAM AM_BASE(&blit_transpen)//probably transparency pens | |
| 622 | AM_RANGE(0x990000, 0x990005) AM_RAM AM_BASE(&blit_vregs) | |
| 623 | AM_RANGE(0x998000, 0x998001) AM_RAM AM_BASE(&blit_romaddr) | |
| 624 | AM_RANGE(0x9a0000, 0x9a0001) AM_RAM AM_BASE(&blit_attr1_ram) | |
| 625 | AM_RANGE(0x9a8000, 0x9a8001) AM_RAM AM_BASE(&blit_dst_ram_loword) | |
| 626 | AM_RANGE(0x9b0000, 0x9b0001) AM_RAM AM_BASE(&blit_attr2_ram) | |
| 627 | AM_RANGE(0x9b8000, 0x9b8001) AM_RAM_WRITE( blit_copy_w ) AM_BASE(&blit_dst_ram_hiword) | |
| 634 | AM_RANGE(0x980000, 0x98000f) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_transpen)//probably transparency pens | |
| 635 | AM_RANGE(0x990000, 0x990005) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_vregs) | |
| 636 | AM_RANGE(0x998000, 0x998001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_romaddr) | |
| 637 | AM_RANGE(0x9a0000, 0x9a0001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_attr1_ram) | |
| 638 | AM_RANGE(0x9a8000, 0x9a8001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_dst_ram_loword) | |
| 639 | AM_RANGE(0x9b0000, 0x9b0001) AM_RAM AM_BASE_MEMBER(blitz68k_state, blit_attr2_ram) | |
| 640 | AM_RANGE(0x9b8000, 0x9b8001) AM_RAM_WRITE( blit_copy_w ) AM_BASE_MEMBER(blitz68k_state, blit_dst_ram_hiword) | |
| 628 | 641 | AM_RANGE(0x9c0002, 0x9c0003) AM_READNOP //pen control? |
| 629 | 642 | AM_RANGE(0x9d0000, 0x9d0001) AM_READNOP //? |
| 630 | 643 | AM_RANGE(0x9e0000, 0x9e0001) AM_READ(blitter_status_r) |
| r10886 | r10887 | |
| 1231 | 1244 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 1232 | 1245 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 1233 | 1246 | |
| 1234 | AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_BASE( | |
| 1247 | AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_BASE_MEMBER(blitz68k_state, frame_buffer) | |
| 1235 | 1248 | |
| 1236 | 1249 | AM_RANGE(0x30000c, 0x30000d) AM_WRITENOP // 0->1 (IRQ3 ack.?) |
| 1237 | 1250 | AM_RANGE(0x30000e, 0x30000f) AM_WRITENOP // 1->0 (MCU related?) |
| r10886 | r10887 | |
| 1769 | 1782 | MACHINE_CONFIG_END |
| 1770 | 1783 | |
| 1771 | 1784 | |
| 1772 | static MACHINE_CONFIG_START( bankrob, | |
| 1785 | static MACHINE_CONFIG_START( bankrob, blitz68k_stat | |
| 1773 | 1786 | MCFG_CPU_ADD("maincpu", M68000, XTAL_11_0592MHz) |
| 1774 | 1787 | MCFG_CPU_PROGRAM_MAP(bankrob_map) |
| 1775 | 1788 | MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) // protection prevents correct irq frequency by crtc |
| r10886 | r10887 | |
| 1801 | 1814 | MACHINE_CONFIG_END |
| 1802 | 1815 | |
| 1803 | 1816 | |
| 1804 | static MACHINE_CONFIG_START( bankroba, | |
| 1817 | static MACHINE_CONFIG_START( bankroba, blitz68k_stat | |
| 1805 | 1818 | MCFG_CPU_ADD("maincpu", M68000, XTAL_11_0592MHz ) |
| 1806 | 1819 | MCFG_CPU_PROGRAM_MAP(bankroba_map) |
| 1807 | 1820 | MCFG_CPU_VBLANK_INT("screen", irq5_line_hold) // protection prevents correct irq frequency by crtc |
| r10886 | r10887 | |
| 1831 | 1844 | MACHINE_CONFIG_END |
| 1832 | 1845 | |
| 1833 | 1846 | |
| 1834 | static MACHINE_CONFIG_START( deucesw2, | |
| 1847 | static MACHINE_CONFIG_START( deucesw2, blitz68k_stat | |
| 1835 | 1848 | MCFG_CPU_ADD("maincpu", M68000, XTAL_22_1184MHz / 2) |
| 1836 | 1849 | MCFG_CPU_PROGRAM_MAP(deucesw2_map) |
| 1837 | 1850 | // irq 2 reads from MCUs |
| r10886 | r10887 | |
| 1860 | 1873 | MACHINE_CONFIG_END |
| 1861 | 1874 | |
| 1862 | 1875 | |
| 1863 | static MACHINE_CONFIG_START( dualgame, | |
| 1876 | static MACHINE_CONFIG_START( dualgame, blitz68k_stat | |
| 1864 | 1877 | MCFG_CPU_ADD("maincpu", M68000, XTAL_11_0592MHz ) |
| 1865 | 1878 | MCFG_CPU_PROGRAM_MAP(dualgame_map) |
| 1866 | 1879 | MCFG_CPU_VBLANK_INT("screen", irq2_line_hold) // lev 2 = MCUs, lev 3 = vblank |
| r10886 | r10887 | |
| 1891 | 1904 | MACHINE_CONFIG_END |
| 1892 | 1905 | |
| 1893 | 1906 | |
| 1894 | static MACHINE_CONFIG_START( hermit, | |
| 1907 | static MACHINE_CONFIG_START( hermit, blitz68k_stat | |
| 1895 | 1908 | MCFG_CPU_ADD("maincpu", M68000, XTAL_22_1184MHz/2 ) |
| 1896 | 1909 | MCFG_CPU_PROGRAM_MAP(hermit_map) |
| 1897 | 1910 | MCFG_CPU_VBLANK_INT("screen", irq1_line_hold) // protection prevents correct irq frequency by crtc |
| r10886 | r10887 | |
| 1920 | 1933 | MACHINE_CONFIG_END |
| 1921 | 1934 | |
| 1922 | 1935 | |
| 1923 | static MACHINE_CONFIG_START( maxidbl, | |
| 1936 | static MACHINE_CONFIG_START( maxidbl, blitz68k_stat | |
| 1924 | 1937 | MCFG_CPU_ADD("maincpu", M68000, XTAL_11_0592MHz) |
| 1925 | 1938 | MCFG_CPU_PROGRAM_MAP(maxidbl_map) |
| 1926 | 1939 | MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) // protection prevents correct irq frequency by crtc |
| r10886 | r10887 | |
|---|---|---|
| 46 | 46 | #include "machine/8255ppi.h" |
| 47 | 47 | #include "deprecat.h" |
| 48 | 48 | |
| 49 | ||
| 50 | class cb2001_state : public driver_device | |
| 51 | { | |
| 52 | public: | |
| 53 | cb2001_state(running_machine &machine, const driver_device_config_base &config) | |
| 54 | : driver_device(machine, config) { } | |
| 55 | ||
| 56 | UINT16 *vram_fg; | |
| 57 | UINT16* vram_bg; | |
| 58 | int videobank; | |
| 59 | int videomode; | |
| 60 | tilemap_t *reel1_tilemap; | |
| 61 | tilemap_t *reel2_tilemap; | |
| 62 | tilemap_t *reel3_tilemap; | |
| 63 | int other1; | |
| 64 | int other2; | |
| 65 | }; | |
| 66 | ||
| 67 | ||
| 49 | 68 | #define xxxx 0x90 /* Unknown */ |
| 50 | 69 | |
| 51 | 70 | static const UINT8 cb2001_decryption_table[256] = { |
| r10886 | r10887 | |
| 302 | 321 | |
| 303 | 322 | */ |
| 304 | 323 | |
| 305 | static UINT16 *cb2001_vram_fg; | |
| 306 | static UINT16* cb2001_vram_bg; | |
| 307 | static int cb2001_videobank; | |
| 308 | static int cb2001_videomode; | |
| 309 | 324 | |
| 310 | static tilemap_t *reel1_tilemap, *reel2_tilemap, *reel3_tilemap; | |
| 311 | ||
| 312 | ||
| 313 | 325 | // these areas are wrong |
| 314 | 326 | static const rectangle visible1 = { 0*8, (14+48)*8-1, 3*8, (3+7)*8-1 }; |
| 315 | 327 | static const rectangle visible2 = { 0*8, (14+48)*8-1, 10*8, (10+7)*8-1 }; |
| 316 | 328 | static const rectangle visible3 = { 0*8, (14+48)*8-1, 17*8, (17+7)*8-1 }; |
| 317 | static int other1,other2; | |
| 318 | 329 | |
| 319 | 330 | static SCREEN_UPDATE(cb2001) |
| 320 | 331 | { |
| 332 | cb2001_state *state = screen->machine->driver_data<cb2001_state>(); | |
| 321 | 333 | int count,x,y; |
| 322 | 334 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 323 | 335 | |
| 324 | 336 | count = 0x0000; |
| 325 | 337 | |
| 326 | 338 | // render bg as 8x8 tilemaps |
| 327 | if (other1 & 0x02) | |
| 339 | if (state->other1 & 0x02) | |
| 328 | 340 | { |
| 329 | if (!(other1 & 0x04)) | |
| 341 | if (!(state->other1 & 0x04)) | |
| 330 | 342 | { |
| 331 | 343 | for (y=0;y<32;y++) |
| 332 | 344 | { |
| r10886 | r10887 | |
| 335 | 347 | int tile; |
| 336 | 348 | int colour; |
| 337 | 349 | |
| 338 | tile = (cb2001_vram_bg[count] & 0x0fff); | |
| 339 | colour = (cb2001_vram_bg[count] & 0xf000)>>12; | |
| 340 | tile += cb2001_videobank*0x2000; | |
| 350 | tile = (state->vram_bg[count] & 0x0fff); | |
| 351 | colour = (state->vram_bg[count] & 0xf000)>>12; | |
| 352 | tile += state->videobank*0x2000; | |
| 341 | 353 | |
| 342 | 354 | |
| 343 | 355 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,colour,0,0,x*8,y*8); |
| r10886 | r10887 | |
| 354 | 366 | { |
| 355 | 367 | UINT16 scroll; |
| 356 | 368 | |
| 357 | scroll = | |
| 369 | scroll = state->vram_bg[0xa00/2 + i/2]; | |
| 358 | 370 | if (i&1) |
| 359 | 371 | scroll >>=8; |
| 360 | 372 | scroll &=0xff; |
| 361 | 373 | |
| 362 | tilemap_set_scrolly(reel2_tilemap, i, scroll); | |
| 374 | tilemap_set_scrolly(state->reel2_tilemap, i, scroll); | |
| 363 | 375 | |
| 364 | scroll = | |
| 376 | scroll = state->vram_bg[0x800/2 + i/2]; | |
| 365 | 377 | if (i&1) |
| 366 | 378 | scroll >>=8; |
| 367 | 379 | scroll &=0xff; |
| 368 | 380 | |
| 369 | tilemap_set_scrolly(reel1_tilemap, i, scroll); | |
| 381 | tilemap_set_scrolly(state->reel1_tilemap, i, scroll); | |
| 370 | 382 | |
| 371 | scroll = | |
| 383 | scroll = state->vram_bg[0xc00/2 + i/2]; | |
| 372 | 384 | if (i&1) |
| 373 | 385 | scroll >>=8; |
| 374 | 386 | scroll &=0xff; |
| 375 | 387 | |
| 376 | tilemap_set_scrolly(reel3_tilemap, i, scroll); | |
| 388 | tilemap_set_scrolly(state->reel3_tilemap, i, scroll); | |
| 377 | 389 | |
| 378 | 390 | } |
| 379 | 391 | |
| 380 | tilemap_draw(bitmap, &visible1, reel1_tilemap, 0, 0); | |
| 381 | tilemap_draw(bitmap, &visible2, reel2_tilemap, 0, 0); | |
| 382 | tilemap_draw(bitmap, &visible3, reel3_tilemap, 0, 0); | |
| 392 | tilemap_draw(bitmap, &visible1, state->reel1_tilemap, 0, 0); | |
| 393 | tilemap_draw(bitmap, &visible2, state->reel2_tilemap, 0, 0); | |
| 394 | tilemap_draw(bitmap, &visible3, state->reel3_tilemap, 0, 0); | |
| 383 | 395 | } |
| 384 | 396 | } |
| 385 | 397 | |
| r10886 | r10887 | |
| 392 | 404 | int tile; |
| 393 | 405 | int colour; |
| 394 | 406 | |
| 395 | tile = (cb2001_vram_fg[count] & 0x0fff); | |
| 396 | colour = (cb2001_vram_fg[count] & 0xf000)>>12; | |
| 397 | tile += cb2001_videobank*0x2000; | |
| 407 | tile = (state->vram_fg[count] & 0x0fff); | |
| 408 | colour = (state->vram_fg[count] & 0xf000)>>12; | |
| 409 | tile += state->videobank*0x2000; | |
| 398 | 410 | |
| 399 | if (other2 & 0x4) | |
| 411 | if (state->other2 & 0x4) | |
| 400 | 412 | { |
| 401 | 413 | tile += 0x1000; |
| 402 | 414 | } |
| r10886 | r10887 | |
| 406 | 418 | } |
| 407 | 419 | } |
| 408 | 420 | |
| 409 | popmessage("%02x %02x %02x %02x\n", | |
| 421 | popmessage("%02x %02x %02x %02x\n",state->videobank,state->videomode, state->other1, state->other2); | |
| 410 | 422 | |
| 411 | 423 | return 0; |
| 412 | 424 | } |
| r10886 | r10887 | |
| 417 | 429 | is being executed incorrectly */ |
| 418 | 430 | WRITE16_HANDLER( cb2001_vidctrl_w ) |
| 419 | 431 | { |
| 432 | cb2001_state *state = space->machine->driver_data<cb2001_state>(); | |
| 420 | 433 | if (mem_mask&0xff00) // video control? |
| 421 | 434 | { |
| 422 | 435 | printf("cb2001_vidctrl_w %04x %04x\n", data, mem_mask); |
| 423 | | |
| 436 | state->videobank = (data & 0x0800)>>11; | |
| 424 | 437 | } |
| 425 | 438 | else // something else |
| 426 | other1 = data & 0x00ff; | |
| 439 | state->other1 = data & 0x00ff; | |
| 427 | 440 | } |
| 428 | 441 | |
| 429 | 442 | WRITE16_HANDLER( cb2001_vidctrl2_w ) |
| 430 | 443 | { |
| 444 | cb2001_state *state = space->machine->driver_data<cb2001_state>(); | |
| 431 | 445 | if (mem_mask&0xff00) // video control? |
| 432 | 446 | { |
| 433 | 447 | printf("cb2001_vidctrl2_w %04x %04x\n", data, mem_mask); // i think this switches to 'reels' mode |
| 434 | | |
| 448 | state->videomode = (data>>8) & 0x03; // which bit?? | |
| 435 | 449 | } |
| 436 | 450 | else // something else |
| 437 | other2 = data & 0x00ff; | |
| 451 | state->other2 = data & 0x00ff; | |
| 438 | 452 | |
| 439 | 453 | // printf("cb2001_vidctrl2_w %04x %04x\n", data, mem_mask); // bank could be here instead |
| 440 | 454 | } |
| r10886 | r10887 | |
| 442 | 456 | |
| 443 | 457 | static TILE_GET_INFO( get_cb2001_reel1_tile_info ) |
| 444 | 458 | { |
| 445 | int code = cb2001_vram_bg[(0x0000/2) + tile_index/2]; | |
| 459 | cb2001_state *state = machine->driver_data<cb2001_state>(); | |
| 460 | int code = state->vram_bg[(0x0000/2) + tile_index/2]; | |
| 446 | 461 | |
| 447 | 462 | if (tile_index&1) |
| 448 | 463 | code >>=8; |
| r10886 | r10887 | |
| 460 | 475 | |
| 461 | 476 | static TILE_GET_INFO( get_cb2001_reel2_tile_info ) |
| 462 | 477 | { |
| 463 | int code = cb2001_vram_bg[(0x0200/2) + tile_index/2]; | |
| 478 | cb2001_state *state = machine->driver_data<cb2001_state>(); | |
| 479 | int code = state->vram_bg[(0x0200/2) + tile_index/2]; | |
| 464 | 480 | |
| 465 | 481 | if (tile_index&1) |
| 466 | 482 | code >>=8; |
| r10886 | r10887 | |
| 479 | 495 | |
| 480 | 496 | static TILE_GET_INFO( get_cb2001_reel3_tile_info ) |
| 481 | 497 | { |
| 482 | int code = cb2001_vram_bg[(0x0400/2) + tile_index/2]; | |
| 498 | cb2001_state *state = machine->driver_data<cb2001_state>(); | |
| 499 | int code = state->vram_bg[(0x0400/2) + tile_index/2]; | |
| 483 | 500 | int colour = 0;//(cb2001_out_c&0x7) + 8; |
| 484 | 501 | |
| 485 | 502 | if (tile_index&1) |
| r10886 | r10887 | |
| 497 | 514 | |
| 498 | 515 | static VIDEO_START(cb2001) |
| 499 | 516 | { |
| 500 | reel1_tilemap = tilemap_create(machine,get_cb2001_reel1_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 501 | reel2_tilemap = tilemap_create(machine,get_cb2001_reel2_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 502 | reel3_tilemap = tilemap_create(machine,get_cb2001_reel3_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 517 | cb2001_state *state = machine->driver_data<cb2001_state>(); | |
| 518 | state->reel1_tilemap = tilemap_create(machine,get_cb2001_reel1_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 519 | state->reel2_tilemap = tilemap_create(machine,get_cb2001_reel2_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 520 | state->reel3_tilemap = tilemap_create(machine,get_cb2001_reel3_tile_info,tilemap_scan_rows, 8, 32, 64, 8); | |
| 503 | 521 | |
| 504 | tilemap_set_scroll_cols(reel1_tilemap, 64); | |
| 505 | tilemap_set_scroll_cols(reel2_tilemap, 64); | |
| 506 | tilemap_set_scroll_cols(reel3_tilemap, 64); | |
| 522 | tilemap_set_scroll_cols(state->reel1_tilemap, 64); | |
| 523 | tilemap_set_scroll_cols(state->reel2_tilemap, 64); | |
| 524 | tilemap_set_scroll_cols(state->reel3_tilemap, 64); | |
| 507 | 525 | } |
| 508 | 526 | |
| 509 | 527 | WRITE16_HANDLER( cb2001_bg_w ) |
| 510 | 528 | { |
| 511 | COMBINE_DATA(&cb2001_vram_bg[offset]); | |
| 529 | cb2001_state *state = space->machine->driver_data<cb2001_state>(); | |
| 530 | COMBINE_DATA(&state->vram_bg[offset]); | |
| 512 | 531 | |
| 513 | 532 | // also used for the reel tilemaps in a different mode |
| 514 | 533 | /* |
| 515 | 534 | if (offset<0x200/2) |
| 516 | 535 | { |
| 517 | tilemap_mark_tile_dirty(reel1_tilemap,(offset&0xff)/2); | |
| 536 | tilemap_mark_tile_dirty(state->reel1_tilemap,(offset&0xff)/2); | |
| 518 | 537 | } |
| 519 | 538 | else if (offset<0x400/2) |
| 520 | 539 | { |
| 521 | tilemap_mark_tile_dirty(reel2_tilemap,(offset&0xff)/2); | |
| 540 | tilemap_mark_tile_dirty(state->reel2_tilemap,(offset&0xff)/2); | |
| 522 | 541 | } |
| 523 | 542 | else if (offset<0x600/2) |
| 524 | 543 | { |
| 525 | tilemap_mark_tile_dirty(reel3_tilemap,(offset&0xff)/2); | |
| 544 | tilemap_mark_tile_dirty(state->reel3_tilemap,(offset&0xff)/2); | |
| 526 | 545 | } |
| 527 | 546 | else if (offset<0x800/2) |
| 528 | 547 | { |
| 529 | 548 | // tilemap_mark_tile_dirty(reel4_tilemap,(offset&0xff)/2); |
| 530 | 549 | } |
| 531 | 550 | */ |
| 532 | tilemap_mark_all_tiles_dirty (reel1_tilemap); | |
| 533 | tilemap_mark_all_tiles_dirty (reel2_tilemap); | |
| 534 | tilemap_mark_all_tiles_dirty (reel3_tilemap); | |
| 551 | tilemap_mark_all_tiles_dirty (state->reel1_tilemap); | |
| 552 | tilemap_mark_all_tiles_dirty (state->reel2_tilemap); | |
| 553 | tilemap_mark_all_tiles_dirty (state->reel3_tilemap); | |
| 535 | 554 | |
| 536 | 555 | |
| 537 | 556 | } |
| 538 | 557 | |
| 539 | 558 | static ADDRESS_MAP_START( cb2001_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 540 | 559 | AM_RANGE(0x00000, 0x1ffff) AM_RAM |
| 541 | AM_RANGE(0x20000, 0x20fff) AM_RAM AM_BASE(&cb2001_vram_fg) | |
| 542 | AM_RANGE(0x21000, 0x21fff) AM_RAM_WRITE(&cb2001_bg_w) AM_BASE(&cb2001_vram_bg) | |
| 560 | AM_RANGE(0x20000, 0x20fff) AM_RAM AM_BASE_MEMBER(cb2001_state, vram_fg) | |
| 561 | AM_RANGE(0x21000, 0x21fff) AM_RAM_WRITE(&cb2001_bg_w) AM_BASE_MEMBER(cb2001_state, vram_bg) | |
| 543 | 562 | AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0) |
| 544 | 563 | ADDRESS_MAP_END |
| 545 | 564 | |
| r10886 | r10887 | |
| 812 | 831 | }; |
| 813 | 832 | |
| 814 | 833 | static const nec_config cb2001_config = { cb2001_decryption_table, }; |
| 815 | static MACHINE_CONFIG_START( cb2001, | |
| 834 | static MACHINE_CONFIG_START( cb2001, | |
| 816 | 835 | MCFG_CPU_ADD("maincpu", V35, 20000000) // CPU91A-011-0016JK004; encrypted cpu like nec v25/35 used in some irem game |
| 817 | 836 | MCFG_CPU_CONFIG(cb2001_config) |
| 818 | 837 | MCFG_CPU_PROGRAM_MAP(cb2001_map) |
| r10886 | r10887 | |
| 872 | 891 | |
| 873 | 892 | GAME( 2001, cb2001, 0, cb2001, cb2001, 0, ROT0, "Dyna", "Cherry Bonus 2001", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 874 | 893 | GAME( 2001, scherrym, 0, cb2001, cb2001, 0, ROT0, "Dyna", "Super Cherry Master", GAME_NOT_WORKING|GAME_NO_SOUND ) // 2001 version? (we have bootlegs running on z80 hw of a 1996 version) |
| 875 | ||
| 876 | ||
| 877 | ||
| 878 | ||
| 879 | ||
| 880 | ||
| 881 | ||
| 882 |
| r10886 | r10887 | |
|---|---|---|
| 25 | 25 | #include "sound/2610intf.h" |
| 26 | 26 | #include "machine/pd4990a.h" |
| 27 | 27 | |
| 28 | static UINT16* npvidram; | |
| 29 | static UINT16* npvidregs; | |
| 30 | static UINT8 audio_result; | |
| 31 | static UINT8 bank_val; | |
| 32 | 28 | |
| 29 | class neoprint_state : public driver_device | |
| 30 | { | |
| 31 | public: | |
| 32 | neoprint_state(running_machine &machine, const driver_device_config_base &config) | |
| 33 | : driver_device(machine, config) { } | |
| 34 | ||
| 35 | UINT16* npvidram; | |
| 36 | UINT16* npvidregs; | |
| 37 | UINT8 audio_result; | |
| 38 | UINT8 bank_val; | |
| 39 | UINT8 vblank; | |
| 40 | }; | |
| 41 | ||
| 42 | ||
| 33 | 43 | VIDEO_START(neoprint) |
| 34 | 44 | { |
| 35 | ||
| 36 | 45 | } |
| 37 | 46 | |
| 38 | 47 | /* |
| r10886 | r10887 | |
| 46 | 55 | |
| 47 | 56 | static void draw_layer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int layer,int data_shift) |
| 48 | 57 | { |
| 58 | neoprint_state *state = machine->driver_data<neoprint_state>(); | |
| 49 | 59 | int i, y, x; |
| 50 | 60 | const gfx_element *gfx = machine->gfx[0]; |
| 51 | 61 | INT16 scrollx, scrolly; |
| 52 | 62 | |
| 53 | i = (npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4; | |
| 54 | scrollx = ((npvidregs[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff); | |
| 55 | scrolly = ((npvidregs[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff); | |
| 63 | i = (state->npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4; | |
| 64 | scrollx = ((state->npvidregs[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff); | |
| 65 | scrolly = ((state->npvidregs[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff); | |
| 56 | 66 | |
| 57 | 67 | scrollx/=2; |
| 58 | 68 | scrolly/=2; |
| r10886 | r10887 | |
| 61 | 71 | { |
| 62 | 72 | for (x=0;x<32;x++) |
| 63 | 73 | { |
| 64 | UINT16 dat = npvidram[i*2] >> data_shift; // a video register? | |
| 74 | UINT16 dat = state->npvidram[i*2] >> data_shift; // a video register? | |
| 65 | 75 | UINT16 color; |
| 66 | if(npvidram[i*2+1] & 0x0020) // TODO: 8bpp switch? | |
| 67 | color = ((npvidram[i*2+1] & 0x8000) << 1) | 0x200 | ((npvidram[i*2+1] & 0xff00) >> 7); | |
| 76 | if(state->npvidram[i*2+1] & 0x0020) // TODO: 8bpp switch? | |
| 77 | color = ((state->npvidram[i*2+1] & 0x8000) << 1) | 0x200 | ((state->npvidram[i*2+1] & 0xff00) >> 7); | |
| 68 | 78 | else |
| 69 | color = ((npvidram[i*2+1] & 0xff00) >> 8) | ((npvidram[i*2+1] & 0x0010) << 4); | |
| 70 | UINT8 fx = (npvidram[i*2+1] & 0x0040); | |
| 71 | UINT8 fy = (npvidram[i*2+1] & 0x0080); | |
| 79 | color = ((state->npvidram[i*2+1] & 0xff00) >> 8) | ((state->npvidram[i*2+1] & 0x0010) << 4); | |
| 80 | UINT8 fx = (state->npvidram[i*2+1] & 0x0040); | |
| 81 | UINT8 fy = (state->npvidram[i*2+1] & 0x0080); | |
| 72 | 82 | |
| 73 | 83 | drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx,y*16-scrolly,0); |
| 74 | 84 | drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx-512,y*16-scrolly,0); |
| r10886 | r10887 | |
| 118 | 128 | |
| 119 | 129 | static READ8_HANDLER( neoprint_unk_r ) |
| 120 | 130 | { |
| 121 | stat | |
| 131 | neoprint_state | |
| 122 | 132 | |
| 123 | 133 | /* ---x ---- tested in irq routine, odd/even field number? */ |
| 124 | 134 | /* ---- xx-- one of these two must be high */ |
| 125 | 135 | /* ---- --xx checked right before entering into attract mode, presumably printer/camera related */ |
| 126 | 136 | |
| 127 | vblank = (space->machine->primary_screen->frame_number() & 0x1) ? 0x10 : 0x00; | |
| 137 | state->vblank = (space->machine->primary_screen->frame_number() & 0x1) ? 0x10 : 0x00; | |
| 128 | 138 | |
| 129 | 139 | //if(cpu_get_pc(space->cpu) != 0x1504 && cpu_get_pc(space->cpu) != 0x5f86 && cpu_get_pc(space->cpu) != 0x5f90) |
| 130 | 140 | // printf("%08x\n",cpu_get_pc(space->cpu)); |
| 131 | 141 | |
| 132 | return vblank| 4 | 3; | |
| 142 | return state->vblank| 4 | 3; | |
| 133 | 143 | } |
| 134 | 144 | |
| 135 | 145 | static READ16_HANDLER( neoprint_audio_result_r ) |
| 136 | 146 | { |
| 137 | return (audio_result << 8) | 0x00; | |
| 147 | neoprint_state *state = space->machine->driver_data<neoprint_state>(); | |
| 148 | return (state->audio_result << 8) | 0x00; | |
| 138 | 149 | } |
| 139 | 150 | |
| 140 | 151 | static void audio_cpu_assert_nmi(running_machine *machine) |
| r10886 | r10887 | |
| 181 | 192 | |
| 182 | 193 | static WRITE8_HANDLER( audio_result_w ) |
| 183 | 194 | { |
| 195 | neoprint_state *state = space->machine->driver_data<neoprint_state>(); | |
| 184 | 196 | //neogeo_state *state = space->machine->driver_data<neogeo_state>(); |
| 185 | 197 | |
| 186 | 198 | //if (LOG_CPU_COMM && (state->audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", cpu_get_pc(space->cpu), data); |
| 187 | 199 | |
| 188 | audio_result = data; | |
| 200 | state->audio_result = data; | |
| 189 | 201 | } |
| 190 | 202 | |
| 191 | 203 | static ADDRESS_MAP_START( neoprint_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| r10886 | r10887 | |
| 193 | 205 | /* AM_RANGE(0x100000, 0x17ffff) multi-cart or banking, some writes points here if anything lies there too */ |
| 194 | 206 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 195 | 207 | AM_RANGE(0x300000, 0x30ffff) AM_RAM AM_SHARE("nvram") |
| 196 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE( | |
| 208 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE_MEMBER(neoprint_state, npvidram) | |
| 197 | 209 | AM_RANGE(0x500000, 0x51ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 198 | 210 | AM_RANGE(0x600000, 0x600001) AM_READWRITE(neoprint_audio_result_r,audio_command_w) |
| 199 | 211 | AM_RANGE(0x600002, 0x600003) AM_READWRITE(neoprint_calendar_r,neoprint_calendar_w) |
| r10886 | r10887 | |
| 204 | 216 | AM_RANGE(0x60000c, 0x60000d) AM_READ_PORT("DSW2") |
| 205 | 217 | AM_RANGE(0x60000e, 0x60000f) AM_WRITENOP |
| 206 | 218 | |
| 207 | AM_RANGE(0x700000, 0x70001b) AM_RAM AM_BASE( | |
| 219 | AM_RANGE(0x700000, 0x70001b) AM_RAM AM_BASE_MEMBER(neoprint_state, npvidregs) | |
| 208 | 220 | |
| 209 | 221 | AM_RANGE(0x70001e, 0x70001f) AM_WRITENOP //watchdog |
| 210 | 222 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 238 | 250 | |
| 239 | 251 | static WRITE8_HANDLER( nprsp_bank_w ) |
| 240 | 252 | { |
| 253 | neoprint_state *state = space->machine->driver_data<neoprint_state>(); | |
| 241 | 254 | /* this register seems flip-flop based ... */ |
| 242 | 255 | |
| 243 | 256 | if((data & 0xf0) == 0x20) |
| 244 | 257 | { |
| 245 | 258 | if((data & 0xf) == 0x1) |
| 246 | bank_val = 1; | |
| 259 | state->bank_val = 1; | |
| 247 | 260 | if((data & 0xf) == 0x2) |
| 248 | bank_val = 0; | |
| 261 | state->bank_val = 0; | |
| 249 | 262 | } |
| 250 | 263 | } |
| 251 | 264 | |
| 252 | 265 | static READ16_HANDLER( rom_window_r ) |
| 253 | 266 | { |
| 267 | neoprint_state *state = space->machine->driver_data<neoprint_state>(); | |
| 254 | 268 | UINT16 *rom = (UINT16 *)space->machine->region("maincpu")->base(); |
| 255 | 269 | |
| 256 | return rom[offset | 0x80000/2 | bank_val*0x40000/2]; | |
| 270 | return rom[offset | 0x80000/2 | state->bank_val*0x40000/2]; | |
| 257 | 271 | } |
| 258 | 272 | |
| 259 | 273 | static ADDRESS_MAP_START( nprsp_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| r10886 | r10887 | |
| 268 | 282 | AM_RANGE(0x20000c, 0x20000d) AM_READ_PORT("DSW2") |
| 269 | 283 | AM_RANGE(0x20000e, 0x20000f) AM_WRITENOP |
| 270 | 284 | |
| 271 | AM_RANGE(0x240000, 0x24001b) AM_RAM AM_BASE( | |
| 285 | AM_RANGE(0x240000, 0x24001b) AM_RAM AM_BASE_MEMBER(neoprint_state, npvidregs) | |
| 272 | 286 | AM_RANGE(0x24001e, 0x24001f) AM_WRITENOP //watchdog |
| 273 | 287 | |
| 274 | 288 | AM_RANGE(0x300000, 0x33ffff) AM_RAM AM_SHARE("nvram") |
| 275 | 289 | AM_RANGE(0x380000, 0x38ffff) AM_RAM |
| 276 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE( | |
| 290 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE_MEMBER(neoprint_state, npvidram) | |
| 277 | 291 | AM_RANGE(0x500000, 0x57ffff) AM_RAM_WRITE(nprsp_palette_w) AM_BASE_GENERIC(paletteram) |
| 278 | 292 | ADDRESS_MAP_END |
| 279 | 293 | |
| r10886 | r10887 | |
| 421 | 435 | GFXDECODE_ENTRY( "gfx1", 0, neoprint_layout, 0x0, 0x1000 ) |
| 422 | 436 | GFXDECODE_END |
| 423 | 437 | |
| 424 | class neoprint_state : public driver_device | |
| 425 | { | |
| 426 | public: | |
| 427 | neoprint_state(running_machine &machine, const driver_device_config_base &config) | |
| 428 | : driver_device(machine, config) { } | |
| 429 | }; | |
| 430 | ||
| 431 | 438 | static void audio_cpu_irq(device_t *device, int assert) |
| 432 | 439 | { |
| 433 | 440 | cputag_set_input_line(device->machine, "audiocpu", 0, assert ? ASSERT_LINE : CLEAR_LINE); |
| r10886 | r10887 | |
| 478 | 485 | |
| 479 | 486 | static MACHINE_RESET( nprsp ) |
| 480 | 487 | { |
| 481 | bank_val = 0; | |
| 488 | neoprint_state *state = machine->driver_data<neoprint_state>(); | |
| 489 | state->bank_val = 0; | |
| 482 | 490 | } |
| 483 | 491 | |
| 484 | 492 | static MACHINE_CONFIG_START( nprsp, neoprint_state ) |
| r10886 | r10887 | |
|---|---|---|
| 90 | 90 | #include "video/mc6845.h" |
| 91 | 91 | |
| 92 | 92 | |
| 93 | class jubilee_state : public driver_device | |
| 94 | { | |
| 95 | public: | |
| 96 | jubilee_state(running_machine &machine, const driver_device_config_base &config) | |
| 97 | : driver_device(machine, config) { } | |
| 93 | 98 | |
| 99 | UINT8 *videoram; | |
| 100 | tilemap_t *bg_tilemap; | |
| 101 | }; | |
| 102 | ||
| 103 | ||
| 94 | 104 | /************************* |
| 95 | 105 | * Video Hardware * |
| 96 | 106 | *************************/ |
| 97 | 107 | |
| 98 | static UINT8 *videoram; | |
| 99 | static tilemap_t *bg_tilemap; | |
| 100 | 108 | |
| 101 | ||
| 102 | 109 | static WRITE8_HANDLER( jubileep_videoram_w ) |
| 103 | 110 | { |
| 104 | videoram[offset] = data; | |
| 105 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 111 | jubilee_state *state = space->machine->driver_data<jubilee_state>(); | |
| 112 | state->videoram[offset] = data; | |
| 113 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 106 | 114 | } |
| 107 | 115 | |
| 108 | 116 | |
| 109 | 117 | static TILE_GET_INFO( get_bg_tile_info ) |
| 110 | 118 | { |
| 111 | int code = videoram[tile_index]; | |
| 119 | jubilee_state *state = machine->driver_data<jubilee_state>(); | |
| 120 | int code = state->videoram[tile_index]; | |
| 112 | 121 | |
| 113 | 122 | SET_TILE_INFO( 0, code, 0, 0); |
| 114 | 123 | } |
| r10886 | r10887 | |
| 117 | 126 | |
| 118 | 127 | static VIDEO_START( jubileep ) |
| 119 | 128 | { |
| 120 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 129 | jubilee_state *state = machine->driver_data<jubilee_state>(); | |
| 130 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); | |
| 121 | 131 | } |
| 122 | 132 | |
| 123 | 133 | |
| 124 | 134 | static SCREEN_UPDATE( jubileep ) |
| 125 | 135 | { |
| 126 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 136 | jubilee_state *state = screen->machine->driver_data<jubilee_state>(); | |
| 137 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 127 | 138 | return 0; |
| 128 | 139 | } |
| 129 | 140 | |
| r10886 | r10887 | |
| 152 | 163 | static ADDRESS_MAP_START( jubileep_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 153 | 164 | ADDRESS_MAP_GLOBAL_MASK(0x3fff) |
| 154 | 165 | AM_RANGE(0x0000, 0x2fff) AM_ROM |
| 155 | AM_RANGE(0x3000, 0x30ff) AM_WRITE(jubileep_videoram_w) AM_BASE( | |
| 166 | AM_RANGE(0x3000, 0x30ff) AM_WRITE(jubileep_videoram_w) AM_BASE_MEMBER(jubilee_state, videoram) /* wrong... just placed somewhere */ | |
| 156 | 167 | AM_RANGE(0x3100, 0x3fff) AM_RAM |
| 157 | 168 | ADDRESS_MAP_END |
| 158 | 169 | |
| r10886 | r10887 | |
| 397 | 408 | * Machine Drivers * |
| 398 | 409 | *************************/ |
| 399 | 410 | |
| 400 | static MACHINE_CONFIG_START( jubileep, | |
| 411 | static MACHINE_CONFIG_START( jubileep, jubile | |
| 401 | 412 | |
| 402 | 413 | /* basic machine hardware */ |
| 403 | 414 | MCFG_CPU_ADD("maincpu", TMS9980, MASTER_CLOCK/2) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 237 | 237 | #include "sound/ay8910.h" |
| 238 | 238 | |
| 239 | 239 | |
| 240 | static UINT16 *videoram; | |
| 240 | class goldngam_state : public driver_device | |
| 241 | { | |
| 242 | public: | |
| 243 | goldngam_state(running_machine &machine, const driver_device_config_base &config) | |
| 244 | : driver_device(machine, config) { } | |
| 241 | 245 | |
| 246 | UINT16 *videoram; | |
| 247 | }; | |
| 248 | ||
| 249 | ||
| 242 | 250 | /************************* |
| 243 | 251 | * Video Hardware * |
| 244 | 252 | *************************/ |
| r10886 | r10887 | |
| 250 | 258 | |
| 251 | 259 | static SCREEN_UPDATE( goldngam ) |
| 252 | 260 | { |
| 261 | goldngam_state *state = screen->machine->driver_data<goldngam_state>(); | |
| 253 | 262 | |
| 254 | 263 | int x, y; |
| 255 | 264 | |
| 256 | UINT8 *tmp = (UINT8 *) videoram; | |
| 265 | UINT8 *tmp = (UINT8 *) state->videoram; | |
| 257 | 266 | int index = 0; |
| 258 | 267 | |
| 259 | 268 | for(y = 0; y < 512; ++y) |
| r10886 | r10887 | |
| 297 | 306 | AM_RANGE(0x402000, 0x402001) AM_DEVREAD8("aysnd", ay8910_r, 0x00ff) |
| 298 | 307 | AM_RANGE(0x402000, 0x402003) AM_DEVWRITE8("aysnd", ay8910_address_data_w, 0x00ff) //wrong |
| 299 | 308 | |
| 300 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE( | |
| 309 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_MEMBER(goldngam_state, videoram) | |
| 301 | 310 | AM_RANGE(0x500200, 0x50020f) AM_RAM //? |
| 302 | 311 | AM_RANGE(0x503000, 0x503001) AM_RAM //int ack ? |
| 303 | 312 | AM_RANGE(0x503002, 0x503003) AM_RAM //int ack ? |
| r10886 | r10887 | |
| 341 | 350 | static ADDRESS_MAP_START( moviecrd_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 342 | 351 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 343 | 352 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 344 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE( | |
| 353 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_MEMBER(goldngam_state, videoram) | |
| 345 | 354 | AM_RANGE(0x503000, 0x5031ff) AM_RAM //int ack ? |
| 346 | 355 | ADDRESS_MAP_END |
| 347 | 356 | |
| r10886 | r10887 | |
| 541 | 550 | DEVCB_NULL |
| 542 | 551 | }; |
| 543 | 552 | |
| 544 | static MACHINE_CONFIG_START( swisspkr, d | |
| 553 | static MACHINE_CONFIG_START( swisspkr, goldngam | |
| 545 | 554 | |
| 546 | 555 | /* basic machine hardware */ |
| 547 | 556 | MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK) |
| r10886 | r10887 | |
|---|---|---|
| 25 | 25 | #include "sound/ay8910.h" |
| 26 | 26 | #include "machine/nvram.h" |
| 27 | 27 | |
| 28 | ||
| 29 | class kingpin_state : public driver_device | |
| 30 | { | |
| 31 | public: | |
| 32 | kingpin_state(running_machine &machine, const driver_device_config_base &config) | |
| 33 | : driver_device(machine, config) { } | |
| 34 | ||
| 35 | UINT8 *code_base; | |
| 36 | }; | |
| 37 | ||
| 38 | ||
| 28 | 39 | static READ8_HANDLER( io_read_missing_dips ) |
| 29 | 40 | { |
| 30 | 41 | return 0x00; |
| r10886 | r10887 | |
| 139 | 150 | vdp_interrupt |
| 140 | 151 | }; |
| 141 | 152 | |
| 142 | static MACHINE_CONFIG_START( kingpin, | |
| 153 | static MACHINE_CONFIG_START( kingpin, k | |
| 143 | 154 | /* MAIN CPU */ |
| 144 | 155 | MCFG_CPU_ADD("maincpu", Z80, 3579545) |
| 145 | 156 | MCFG_CPU_PROGRAM_MAP(kingpin_program_map) |
| r10886 | r10887 | |
| 173 | 184 | |
| 174 | 185 | static DRIVER_INIT( kingpin ) |
| 175 | 186 | { |
| 176 | stat | |
| 187 | kingpin_state | |
| 177 | 188 | |
| 178 | 189 | TMS9928A_configure(&tms9928a_interface); |
| 179 | 190 | |
| 180 | 191 | /* Hacks to keep the emu a'runnin */ |
| 181 | code_base = machine->region("maincpu")->base(); | |
| 182 | code_base[0x17d4] = 0xc3; /* Maybe sound related? */ | |
| 192 | state->code_base = machine->region("maincpu")->base(); | |
| 193 | state->code_base[0x17d4] = 0xc3; /* Maybe sound related? */ | |
| 183 | 194 | } |
| 184 | 195 | |
| 185 | 196 | ROM_START( kingpin ) |
| r10886 | r10887 | |
|---|---|---|
| 22 | 22 | #include "cpu/z80/z80.h" |
| 23 | 23 | |
| 24 | 24 | |
| 25 | static UINT8 *videoram; | |
| 26 | static UINT8 *colorram; | |
| 27 | static tilemap_t *tmap; | |
| 25 | class tattack_state : public driver_device | |
| 26 | { | |
| 27 | public: | |
| 28 | tattack_state(running_machine &machine, const driver_device_config_base &config) | |
| 29 | : driver_device(machine, config) { } | |
| 28 | 30 | |
| 31 | UINT8 *videoram; | |
| 32 | UINT8 *colorram; | |
| 33 | tilemap_t *tmap; | |
| 34 | }; | |
| 35 | ||
| 36 | ||
| 37 | ||
| 29 | 38 | static TILE_GET_INFO( get_tile_info ) |
| 30 | 39 | { |
| 31 | int code = videoram[tile_index]; | |
| 32 | int color = colorram[tile_index]; | |
| 40 | tattack_state *state = machine->driver_data<tattack_state>(); | |
| 41 | int code = state->videoram[tile_index]; | |
| 42 | int color = state->colorram[tile_index]; | |
| 33 | 43 | |
| 34 | 44 | if((color&1 ) || (color>15) ) |
| 35 | 45 | logerror("COLOR %i\n",color); |
| r10886 | r10887 | |
| 45 | 55 | |
| 46 | 56 | static SCREEN_UPDATE( tattack ) |
| 47 | 57 | { |
| 48 | tilemap_mark_all_tiles_dirty(tmap); | |
| 49 | tilemap_draw(bitmap,cliprect,tmap, 0,0); | |
| 58 | tattack_state *state = screen->machine->driver_data<tattack_state>(); | |
| 59 | tilemap_mark_all_tiles_dirty(state->tmap); | |
| 60 | tilemap_draw(bitmap,cliprect,state->tmap, 0,0); | |
| 50 | 61 | return 0; |
| 51 | 62 | } |
| 52 | 63 | |
| 53 | 64 | static VIDEO_START( tattack ) |
| 54 | 65 | { |
| 55 | tmap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 ); | |
| 66 | tattack_state *state = machine->driver_data<tattack_state>(); | |
| 67 | state->tmap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 ); | |
| 56 | 68 | } |
| 57 | 69 | |
| 58 | 70 | static ADDRESS_MAP_START( mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 59 | 71 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 60 | 72 | // AM_RANGE(0x4000, 0x4000) AM_READNOP $315 |
| 61 | AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE(&videoram) | |
| 62 | AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(&colorram) // color map ? something else .. only bits 1-3 are used | |
| 73 | AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(tattack_state, videoram) | |
| 74 | AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE_MEMBER(tattack_state, colorram) // color map ? something else .. only bits 1-3 are used | |
| 63 | 75 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("DSW2") |
| 64 | 76 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1") // dsw ? something else ? |
| 65 | 77 | AM_RANGE(0xc000, 0xc000) AM_READ_PORT("INPUTS") AM_WRITENOP |
| r10886 | r10887 | |
| 180 | 192 | } |
| 181 | 193 | |
| 182 | 194 | |
| 183 | static MACHINE_CONFIG_START( tattack, | |
| 195 | static MACHINE_CONFIG_START( tattack, tatta | |
| 184 | 196 | |
| 185 | 197 | /* basic machine hardware */ |
| 186 | 198 | MCFG_CPU_ADD("maincpu", Z80, 8000000 / 2) /* 4 MHz ? */ |
| r10886 | r10887 | |
|---|---|---|
| 52 | 52 | #include "cpu/m68000/m68000.h" |
| 53 | 53 | #include "sound/okim6295.h" |
| 54 | 54 | |
| 55 | ||
| 56 | class blackt96_state : public driver_device | |
| 57 | { | |
| 58 | public: | |
| 59 | blackt96_state(running_machine &machine, const driver_device_config_base &config) | |
| 60 | : driver_device(machine, config) { } | |
| 61 | ||
| 62 | UINT16* tilemapram; | |
| 63 | UINT16* tilemapram2; | |
| 64 | }; | |
| 65 | ||
| 66 | ||
| 55 | 67 | static VIDEO_START( blackt96 ) |
| 56 | 68 | { |
| 57 | ||
| 58 | 69 | } |
| 59 | 70 | |
| 60 | static UINT16* blackt96_tilemapram; | |
| 61 | static UINT16* blackt96_tilemapram2; | |
| 62 | ||
| 63 | 71 | static void draw_strip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int stripnum, int xbase, int ybase, int bg) |
| 64 | 72 | { |
| 73 | blackt96_state *state = machine->driver_data<blackt96_state>(); | |
| 65 | 74 | const gfx_element *gfxspr = machine->gfx[1]; |
| 66 | 75 | const gfx_element *gfxbg = machine->gfx[0]; |
| 67 | 76 | |
| r10886 | r10887 | |
| 71 | 80 | |
| 72 | 81 | for (y=0;y<32;y++) |
| 73 | 82 | { |
| 74 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x3fff); | |
| 75 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 76 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x00ff); | |
| 83 | UINT16 tile = (state->tilemapram2[count*2 + (base/2)+1]&0x3fff); | |
| 84 | UINT16 flipx = (state->tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 85 | UINT16 colour = (state->tilemapram2[count*2 + (base/2)]&0x00ff); | |
| 77 | 86 | |
| 78 | 87 | if (tile&0x2000) |
| 79 | 88 | { |
| r10886 | r10887 | |
| 91 | 100 | |
| 92 | 101 | static void draw_main(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bg) |
| 93 | 102 | { |
| 103 | blackt96_state *state = machine->driver_data<blackt96_state>(); | |
| 94 | 104 | |
| 95 | 105 | int x; |
| 96 | 106 | |
| r10886 | r10887 | |
| 101 | 111 | int yy; |
| 102 | 112 | int s = 0; |
| 103 | 113 | |
| 104 | xx= ((blackt96_tilemapram2[x+0]&0x001f)<<4) | (blackt96_tilemapram2[x+1]&0xf000)>>12; | |
| 105 | yy = ((blackt96_tilemapram2[x+1]&0x1ff)); | |
| 114 | xx= ((state->tilemapram2[x+0]&0x001f)<<4) | (state->tilemapram2[x+1]&0xf000)>>12; | |
| 115 | yy = ((state->tilemapram2[x+1]&0x1ff)); | |
| 106 | 116 | |
| 107 | 117 | if (xx&0x100) xx-=0x200; |
| 108 | 118 | yy = 0x1ff-yy; |
| r10886 | r10887 | |
| 120 | 130 | |
| 121 | 131 | static SCREEN_UPDATE( blackt96 ) |
| 122 | 132 | { |
| 133 | blackt96_state *state = screen->machine->driver_data<blackt96_state>(); | |
| 123 | 134 | int count; |
| 124 | 135 | int x,y; |
| 125 | 136 | const gfx_element *gfx = screen->machine->gfx[2]; |
| r10886 | r10887 | |
| 135 | 146 | { |
| 136 | 147 | for (y=0;y<32;y++) |
| 137 | 148 | { |
| 138 | UINT16 tile = ( | |
| 149 | UINT16 tile = (sta | |
| 139 | 150 | drawgfx_transpen(bitmap,cliprect,gfx,tile,0,0,0,x*8,-16+y*8,0); |
| 140 | 151 | count++; |
| 141 | 152 | } |
| r10886 | r10887 | |
| 166 | 177 | AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1") |
| 167 | 178 | AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2") |
| 168 | 179 | |
| 169 | AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(&blackt96_tilemapram) // text tilemap | |
| 170 | AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE(&blackt96_tilemapram2)// sprite list + sprite tilemaps | |
| 180 | AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE_MEMBER(blackt96_state, tilemapram) // text tilemap | |
| 181 | AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE_MEMBER(blackt96_state, tilemapram2)// sprite list + sprite tilemaps | |
| 171 | 182 | AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram) |
| 172 | 183 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM // main ram |
| 173 | 184 | |
| r10886 | r10887 | |
| 471 | 482 | |
| 472 | 483 | |
| 473 | 484 | |
| 474 | static MACHINE_CONFIG_START( blackt96, | |
| 485 | static MACHINE_CONFIG_START( blackt96, bla | |
| 475 | 486 | MCFG_CPU_ADD("maincpu", M68000, 18000000 /2) |
| 476 | 487 | MCFG_CPU_PROGRAM_MAP(blackt96_map) |
| 477 | 488 | MCFG_CPU_VBLANK_INT("screen", irq1_line_hold) |
| r10886 | r10887 | |
|---|---|---|
| 104 | 104 | DIP locations verified for: |
| 105 | 105 | - seawolf2 (manual) |
| 106 | 106 | - wow (manual) |
| 107 | - spacezap (manual) | |
| 107 | 108 | - gorf (manual) |
| 108 | 109 | - robby (manual) |
| 109 | 110 | - profpac (manual) |
| r10886 | r10887 | |
| 119 | 120 | #include "sound/samples.h" |
| 120 | 121 | #include "sound/astrocde.h" |
| 121 | 122 | #include "sound/ay8910.h" |
| 123 | ||
| 122 | 124 | #include "tenpindx.lh" |
| 123 | 125 | #include "gorf.lh" |
| 124 | 126 | |
| r10886 | r10887 | |
| 833 | 835 | INPUT_PORTS_END |
| 834 | 836 | |
| 835 | 837 | |
| 838 | static INPUT_CHANGED( spacezap_monitor ) | |
| 839 | { | |
| 840 | if (newval) | |
| 841 | astrocade_video_config &= ~AC_MONITOR_BW; | |
| 842 | else | |
| 843 | astrocade_video_config |= AC_MONITOR_BW; | |
| 844 | } | |
| 845 | ||
| 836 | 846 | static INPUT_PORTS_START( spacezap ) |
| 837 | 847 | PORT_START("P1HANDLE") |
| 838 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 848 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) // manual says this dip is unused on cocktail cabs | |
| 839 | 849 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 840 | 850 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) |
| 841 | 851 | PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) |
| r10886 | r10887 | |
| 844 | 854 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 845 | 855 | |
| 846 | 856 | PORT_START("P2HANDLE") |
| 847 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL | |
| 848 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL | |
| 849 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL | |
| 850 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL | |
| 857 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Aim Up") | |
| 858 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Aim Down") | |
| 859 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL PORT_NAME("P2 Aim Left") | |
| 860 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_COCKTAIL PORT_NAME("P2 Aim Right") | |
| 851 | 861 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 852 | 862 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "JU:1" ) |
| 853 | 863 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 854 | 864 | |
| 855 | 865 | PORT_START("P3HANDLE") |
| 856 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 857 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 858 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY | |
| 859 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY | |
| 866 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Aim Up") PORT_CODE(KEYCODE_UP) | |
| 867 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Aim Down") PORT_CODE(KEYCODE_DOWN) | |
| 868 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Aim Left") PORT_CODE(KEYCODE_LEFT) | |
| 869 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Aim Right") PORT_CODE(KEYCODE_RIGHT) | |
| 860 | 870 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 861 | 871 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("JU:2") |
| 862 | 872 | PORT_DIPSETTING( 0x20, DEF_STR( Upright ) ) |
| r10886 | r10887 | |
| 877 | 887 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x00, "S1:6" ) |
| 878 | 888 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "S1:7" ) |
| 879 | 889 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "S1:8" ) |
| 890 | ||
| 891 | PORT_START("FAKE") | |
| 892 | /* Dedicated cabinets had a B/W monitor and color overlay, | |
| 893 | some (unofficial/repaired?) cabinets had a color monitor. */ | |
| 894 | PORT_CONFNAME( 0x01, 0x00, "Monitor" ) PORT_CHANGED(spacezap_monitor, 0) | |
| 895 | PORT_CONFSETTING( 0x00, "B/W" ) | |
| 896 | PORT_CONFSETTING( 0x01, "Color" ) | |
| 880 | 897 | INPUT_PORTS_END |
| 881 | 898 | |
| 882 | 899 | |
| r10886 | r10887 | |
| 1728 | 1745 | |
| 1729 | 1746 | static DRIVER_INIT( spacezap ) |
| 1730 | 1747 | { |
| 1731 | astrocade_video_config = AC_SOUND_PRESENT; | |
| 1748 | astrocade_video_config = AC_SOUND_PRESENT | AC_MONITOR_BW; | |
| 1732 | 1749 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x13, 0x13, 0x03ff, 0xff00, spacezap_io_r); |
| 1733 | 1750 | } |
| 1734 | 1751 |
| r10886 | r10887 | |
|---|---|---|
| 3272 | 3272 | GAME( 1981, galagamf, galaga, galaga, galaga, galaga, ROT90, "Namco (Midway license)", "Galaga (Midway set 1 with fast shoot hack)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| 3273 | 3273 | |
| 3274 | 3274 | GAME( 1982, xevious, 0, xevious, xevious, xevious, ROT90, "Namco", "Xevious (Namco)", GAME_SUPPORTS_SAVE ) |
| 3275 | GAME( 1982, xeviousa, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 1)", GAME_SUPPORTS_SAVE ) | |
| 3276 | GAME( 1982, xeviousb, xevious, xevious, xeviousb, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 2)", GAME_SUPPORTS_SAVE ) | |
| 3277 | GAME( 1982, xeviousc, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 3)", GAME_SUPPORTS_SAVE ) | |
| 3275 | GAME( 1982, xeviousa, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari, harder)", GAME_SUPPORTS_SAVE ) | |
| 3276 | GAME( 1982, xeviousb, xevious, xevious, xeviousb, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari)", GAME_SUPPORTS_SAVE ) | |
| 3277 | GAME( 1982, xeviousc, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari, Namco PCB)", GAME_SUPPORTS_SAVE ) | |
| 3278 | 3278 | GAME( 1984, sxevious, xevious, xevious, sxevious, xevious, ROT90, "Namco", "Super Xevious", GAME_SUPPORTS_SAVE ) |
| 3279 | 3279 | GAME( 1984, sxeviousj,xevious, xevious, sxevious, xevious, ROT90, "Namco", "Super Xevious (Japan)", GAME_SUPPORTS_SAVE ) |
| 3280 | 3280 |
| r10886 | r10887 | |
|---|---|---|
| 24 | 24 | #include "render.h" |
| 25 | 25 | #include "machine/laserdsc.h" |
| 26 | 26 | |
| 27 | /* There is only 1 crystal on the stack of 3 boards - speed is unknown, the following is Daphne's guess */ | |
| 28 | #define GUESSED_CLOCK (3072000) | |
| 29 | 27 | |
| 28 | class istellar_state : public driver_device | |
| 29 | { | |
| 30 | public: | |
| 31 | istellar_state(running_machine &machine, const driver_device_config_base &config) | |
| 32 | : driver_device(machine, config) { } | |
| 30 | 33 | |
| 31 | /* Misc variables */ | |
| 32 | static device_t *laserdisc; | |
| 34 | device_t *laserdisc; | |
| 35 | UINT8 *tile_ram; | |
| 36 | UINT8 *tile_control_ram; | |
| 37 | UINT8 *sprite_ram; | |
| 38 | UINT8 ldp_latch1; | |
| 39 | UINT8 ldp_latch2; | |
| 40 | UINT8 z80_2_nmi_enable; | |
| 41 | }; | |
| 33 | 42 | |
| 34 | static UINT8 *tile_ram; | |
| 35 | static UINT8 *tile_control_ram; | |
| 36 | static UINT8 *sprite_ram; | |
| 37 | 43 | |
| 38 | static UINT8 ldp_latch1; | |
| 39 | static UINT8 ldp_latch2; | |
| 44 | /* There is only 1 crystal on the stack of 3 boards - speed is unknown, the following is Daphne's guess */ | |
| 45 | #define GUESSED_CLOCK (3072000) | |
| 40 | 46 | |
| 41 | static UINT8 z80_2_nmi_enable; | |
| 42 | 47 | |
| 43 | 48 | /* VIDEO GOODS */ |
| 44 | 49 | static SCREEN_UPDATE( istellar ) |
| 45 | 50 | { |
| 51 | istellar_state *state = screen->machine->driver_data<istellar_state>(); | |
| 46 | 52 | int charx, chary; |
| 47 | 53 | |
| 48 | 54 | /* clear */ |
| r10886 | r10887 | |
| 52 | 58 | /* |
| 53 | 59 | for (charx = 0; charx < 0x400; charx ++) |
| 54 | 60 | { |
| 55 | printf ("%x ", sprite_ram[charx]) ; | |
| 61 | printf ("%x ", state->sprite_ram[charx]) ; | |
| 56 | 62 | } |
| 57 | 63 | printf("\n\n\n"); |
| 58 | 64 | */ |
| r10886 | r10887 | |
| 65 | 71 | int current_screen_character = (chary*32) + charx; |
| 66 | 72 | |
| 67 | 73 | drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], |
| 68 | tile_ram[current_screen_character], | |
| 69 | (tile_control_ram[current_screen_character] & 0x0f), | |
| 74 | state->tile_ram[current_screen_character], | |
| 75 | (state->tile_control_ram[current_screen_character] & 0x0f), | |
| 70 | 76 | 0, 0, charx*8, chary*8, 0); |
| 71 | 77 | } |
| 72 | 78 | } |
| r10886 | r10887 | |
| 80 | 86 | |
| 81 | 87 | static MACHINE_START( istellar ) |
| 82 | 88 | { |
| 83 | laserdisc = machine->device("laserdisc"); | |
| 89 | istellar_state *state = machine->driver_data<istellar_state>(); | |
| 90 | state->laserdisc = machine->device("laserdisc"); | |
| 84 | 91 | } |
| 85 | 92 | |
| 86 | 93 | |
| r10886 | r10887 | |
| 89 | 96 | /* Z80 0 R/W */ |
| 90 | 97 | static READ8_HANDLER(z80_0_latch1_read) |
| 91 | 98 | { |
| 92 | /*logerror("CPU0 : reading LDP status latch (%x)\n", ldp_latch1);*/ | |
| 93 | return ldp_latch1; | |
| 99 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 100 | /*logerror("CPU0 : reading LDP status latch (%x)\n", state->ldp_latch1);*/ | |
| 101 | return state->ldp_latch1; | |
| 94 | 102 | } |
| 95 | 103 | |
| 96 | 104 | static WRITE8_HANDLER(z80_0_latch2_write) |
| 97 | 105 | { |
| 106 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 98 | 107 | /*logerror("CPU0 : writing cpu_latch2 (%x). Potentially followed by an IRQ.\n", data);*/ |
| 99 | ldp_latch2 = data; | |
| 108 | state->ldp_latch2 = data; | |
| 100 | 109 | |
| 101 | 110 | /* A CPU2 NMI */ |
| 102 | if (z80_2_nmi_enable) | |
| 111 | if (state->z80_2_nmi_enable) | |
| 103 | 112 | { |
| 104 | 113 | logerror("Executing an NMI on CPU2\n"); |
| 105 | 114 | cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, PULSE_LINE); /* Maybe this is a ASSERT_LINE, CLEAR_LINE combo? */ |
| 106 | z80_2_nmi_enable = 0; | |
| 115 | state->z80_2_nmi_enable = 0; | |
| 107 | 116 | } |
| 108 | 117 | } |
| 109 | 118 | |
| r10886 | r10887 | |
| 114 | 123 | /* Z80 2 R/W */ |
| 115 | 124 | static READ8_HANDLER(z80_2_ldp_read) |
| 116 | 125 | { |
| 117 | UINT8 readResult = laserdisc_data_r(laserdisc); | |
| 126 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 127 | UINT8 readResult = laserdisc_data_r(state->laserdisc); | |
| 118 | 128 | logerror("CPU2 : reading LDP : %x\n", readResult); |
| 119 | 129 | return readResult; |
| 120 | 130 | } |
| 121 | 131 | |
| 122 | 132 | static READ8_HANDLER(z80_2_latch2_read) |
| 123 | 133 | { |
| 124 | logerror("CPU2 : reading latch2 (%x)\n", ldp_latch2); | |
| 125 | return ldp_latch2; | |
| 134 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 135 | logerror("CPU2 : reading latch2 (%x)\n", state->ldp_latch2); | |
| 136 | return state->ldp_latch2; | |
| 126 | 137 | } |
| 127 | 138 | |
| 128 | 139 | static READ8_HANDLER(z80_2_nmienable) |
| 129 | 140 | { |
| 141 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 130 | 142 | logerror("CPU2 : ENABLING NMI\n"); |
| 131 | z80_2_nmi_enable = 1; | |
| 143 | state->z80_2_nmi_enable = 1; | |
| 132 | 144 | return 0x00; |
| 133 | 145 | } |
| 134 | 146 | |
| r10886 | r10887 | |
| 140 | 152 | |
| 141 | 153 | static WRITE8_HANDLER(z80_2_latch1_write) |
| 142 | 154 | { |
| 155 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 143 | 156 | logerror("CPU2 : writing latch1 (%x)\n", data); |
| 144 | ldp_latch1 = data; | |
| 157 | state->ldp_latch1 = data; | |
| 145 | 158 | } |
| 146 | 159 | |
| 147 | 160 | static WRITE8_HANDLER(z80_2_ldp_write) |
| 148 | 161 | { |
| 162 | istellar_state *state = space->machine->driver_data<istellar_state>(); | |
| 149 | 163 | logerror("CPU2 : writing LDP : 0x%x\n", data); |
| 150 | laserdisc_data_w(laserdisc,data); | |
| 164 | laserdisc_data_w(state->laserdisc,data); | |
| 151 | 165 | } |
| 152 | 166 | |
| 153 | 167 | |
| r10886 | r10887 | |
| 156 | 170 | static ADDRESS_MAP_START( z80_0_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 157 | 171 | AM_RANGE(0x0000,0x9fff) AM_ROM |
| 158 | 172 | AM_RANGE(0xa000,0xa7ff) AM_RAM |
| 159 | AM_RANGE(0xa800,0xabff) AM_RAM AM_BASE(&tile_ram) | |
| 160 | AM_RANGE(0xac00,0xafff) AM_RAM AM_BASE(&tile_control_ram) | |
| 161 | AM_RANGE(0xb000,0xb3ff) AM_RAM AM_BASE(&sprite_ram) | |
| 173 | AM_RANGE(0xa800,0xabff) AM_RAM AM_BASE_MEMBER(istellar_state, tile_ram) | |
| 174 | AM_RANGE(0xac00,0xafff) AM_RAM AM_BASE_MEMBER(istellar_state, tile_control_ram) | |
| 175 | AM_RANGE(0xb000,0xb3ff) AM_RAM AM_BASE_MEMBER(istellar_state, sprite_ram) | |
| 162 | 176 | ADDRESS_MAP_END |
| 163 | 177 | |
| 164 | 178 | static ADDRESS_MAP_START( z80_1_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 321 | 335 | |
| 322 | 336 | |
| 323 | 337 | /* DRIVER */ |
| 324 | static MACHINE_CONFIG_START( istellar, | |
| 338 | static MACHINE_CONFIG_START( istellar, | |
| 325 | 339 | /* main cpu */ |
| 326 | 340 | MCFG_CPU_ADD("maincpu", Z80, GUESSED_CLOCK) |
| 327 | 341 | MCFG_CPU_PROGRAM_MAP(z80_0_mem) |
| r10886 | r10887 | |
| 397 | 411 | |
| 398 | 412 | static DRIVER_INIT( istellar ) |
| 399 | 413 | { |
| 400 | z80_2_nmi_enable = 0; | |
| 414 | istellar_state *state = machine->driver_data<istellar_state>(); | |
| 415 | state->z80_2_nmi_enable = 0; | |
| 401 | 416 | } |
| 402 | 417 | |
| 403 | 418 | /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS) */ |
| r10886 | r10887 | |
|---|---|---|
| 2761 | 2761 | ROM_LOAD( "univgw6.3", 0x0c00, 0x0400, CRC(7b7d22ff) SHA1(74364cf2b04dcfbbc8e0131fa12c0e574f693d34) ) |
| 2762 | 2762 | ROM_LOAD( "univgw1.4", 0x4000, 0x0400, CRC(0871156e) SHA1(3726d0bfe153a0afc62ea56737662074986064b0) ) |
| 2763 | 2763 | ROM_LOAD( "univgw2.5", 0x4400, 0x0400, CRC(6036d7bf) SHA1(36c2ad2ffdb47bbecc40fd67ced6ab51a5cd2f3e) ) |
| 2764 | ||
| 2765 | ROM_REGION( 0x0800, "proms", 0 ) /* color maps player 1/player 2 */ | |
| 2766 | /* !! not dumped yet, these were taken from sisv/intruder */ | |
| 2767 | ROM_LOAD( "01.bin", 0x0000, 0x0400, BAD_DUMP CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) | |
| 2768 | ROM_LOAD( "02.bin", 0x0400, 0x0400, BAD_DUMP CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) | |
| 2764 | 2769 | ROM_END |
| 2765 | 2770 | |
| 2766 | 2771 | ROM_START( galxwars2 ) |
| 2767 | 2772 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 2768 | 2773 | ROM_LOAD( "3192.h6", 0x0000, 0x1000, CRC(bde6860b) SHA1(e04b8add32d8f7ea588fae6d6a387f1d40495f1b) ) |
| 2769 | 2774 | ROM_LOAD( "3193.h7", 0x4000, 0x1000, CRC(a17cd507) SHA1(554ab0e8bdc0e7af4a30b0ddc8aa053c8e70255c) ) /* 2nd half unused */ |
| 2775 | ||
| 2776 | ROM_REGION( 0x0800, "proms", 0 ) /* color maps player 1/player 2 */ | |
| 2777 | /* !! not dumped yet, these were taken from sisv/intruder */ | |
| 2778 | ROM_LOAD( "01.bin", 0x0000, 0x0400, BAD_DUMP CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) | |
| 2779 | ROM_LOAD( "02.bin", 0x0400, 0x0400, BAD_DUMP CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) | |
| 2770 | 2780 | ROM_END |
| 2771 | 2781 | |
| 2772 | 2782 | ROM_START( galxwarst ) |
| r10886 | r10887 | |
| 2777 | 2787 | ROM_LOAD( "galxwars.3", 0x0c00, 0x0400, CRC(c88f886c) SHA1(4d705fbb97e3868c3f6c90c5e5753ad17cfbf5d6) ) |
| 2778 | 2788 | ROM_LOAD( "galxwars.4", 0x4000, 0x0400, CRC(ae4fe8fb) SHA1(494f44167dc84e4515b769c12f6e24419461dce4) ) |
| 2779 | 2789 | ROM_LOAD( "galxwars.5", 0x4400, 0x0400, CRC(37708a35) SHA1(df6fd521ddfa146ef93e390e47741bdbfda1e7ba) ) |
| 2790 | ||
| 2791 | ROM_REGION( 0x0800, "proms", 0 ) /* color maps player 1/player 2 */ | |
| 2792 | /* !! not dumped yet, these were taken from sisv/intruder */ | |
| 2793 | ROM_LOAD( "01.bin", 0x0000, 0x0400, BAD_DUMP CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) | |
| 2794 | ROM_LOAD( "02.bin", 0x0400, 0x0400, BAD_DUMP CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) | |
| 2780 | 2795 | ROM_END |
| 2781 | 2796 | |
| 2782 | 2797 | ROM_START( starw ) |
| r10886 | r10887 | |
| 3379 | 3394 | GAME( 1979, sicv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (CV Version)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 3380 | 3395 | GAME( 1978, sisv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 3381 | 3396 | GAME( 1978, sisv2, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 3382 | GAMEL(1979, galxwars, 0, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 1)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 3383 | GAMEL(1979, galxwars2,galxwars, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 2)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 3384 | GAMEL(1979, galxwarst,galxwars, invaders, galxwars, 0, ROT270, "Universal (Taito license?)", "Galaxy Wars (Taito?)" , GAME_SUPPORTS_SAVE, layout_invaders) /* Copyright Not Displayed */ | |
| 3385 | GAMEL(1979, starw, galxwars, invaders, galxwars, 0, ROT270, "bootleg", "Star Wars", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 3397 | GAME( 1979, galxwars, 0, invadpt2, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 1)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) | |
| 3398 | GAME( 1979, galxwars2,galxwars, invadpt2, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 2)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) | |
| 3399 | GAME( 1979, galxwarst,galxwars, invadpt2, galxwars, 0, ROT270, "Universal (Taito license?)", "Galaxy Wars (Taito?)" , GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) /* Copyright Not Displayed */ | |
| 3400 | GAME( 1979, starw, galxwars, invaders, galxwars, 0, ROT270, "bootleg", "Star Wars", GAME_SUPPORTS_SAVE ) | |
| 3386 | 3401 | GAME( 1979, lrescue, 0, lrescue, lrescue, 0, ROT270, "Taito", "Lunar Rescue", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) |
| 3387 | 3402 | GAME( 1980, mlander, lrescue, invaders, lrescue, 0, ROT270, "bootleg (Leisure Time Electronics)", "Moon Lander (bootleg of Lunar Rescue)", GAME_SUPPORTS_SAVE ) |
| 3388 | 3403 | GAME( 1978, lrescuem, lrescue, lrescue, lrescue, 0, ROT270, "bootleg (Model Racing)", "Lunar Rescue (Model Racing bootleg)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 31 | 31 | #include "includes/naughtyb.h" |
| 32 | 32 | |
| 33 | 33 | |
| 34 | static int palreg = 0; | |
| 35 | static int gfx_bank = 0; | |
| 36 | static int question_bank = 0; | |
| 34 | class ettrivia_state : public driver_device | |
| 35 | { | |
| 36 | public: | |
| 37 | ettrivia_state(running_machine &machine, const driver_device_config_base &config) | |
| 38 | : driver_device(machine, config) { } | |
| 37 | 39 | |
| 38 | static int b000_val = 0; | |
| 39 | static int b000_ret = 0; | |
| 40 | static int b800_prev = 0; | |
| 40 | int palreg; | |
| 41 | int gfx_bank; | |
| 42 | int question_bank; | |
| 43 | int b000_val; | |
| 44 | int b000_ret; | |
| 45 | int b800_prev; | |
| 46 | UINT8 *bg_videoram; | |
| 47 | UINT8 *fg_videoram; | |
| 48 | tilemap_t *bg_tilemap; | |
| 49 | tilemap_t *fg_tilemap; | |
| 50 | }; | |
| 41 | 51 | |
| 42 | static UINT8 *bg_videoram, *fg_videoram; | |
| 43 | static tilemap_t *bg_tilemap, *fg_tilemap; | |
| 44 | 52 | |
| 45 | 53 | static WRITE8_HANDLER( ettrivia_fg_w ) |
| 46 | 54 | { |
| 47 | fg_videoram[offset] = data; | |
| 48 | tilemap_mark_tile_dirty(fg_tilemap,offset); | |
| 55 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 56 | state->fg_videoram[offset] = data; | |
| 57 | tilemap_mark_tile_dirty(state->fg_tilemap,offset); | |
| 49 | 58 | } |
| 50 | 59 | |
| 51 | 60 | static WRITE8_HANDLER( ettrivia_bg_w ) |
| 52 | 61 | { |
| 53 | bg_videoram[offset] = data; | |
| 54 | tilemap_mark_tile_dirty(bg_tilemap,offset); | |
| 62 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 63 | state->bg_videoram[offset] = data; | |
| 64 | tilemap_mark_tile_dirty(state->bg_tilemap,offset); | |
| 55 | 65 | } |
| 56 | 66 | |
| 57 | 67 | static WRITE8_HANDLER( ettrivia_control_w ) |
| 58 | 68 | { |
| 69 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 59 | 70 | tilemap_mark_all_tiles_dirty_all(space->machine); |
| 60 | 71 | |
| 61 | palreg = (data >> 1) & 3; | |
| 62 | gfx_bank = (data >> 2) & 1; | |
| 72 | state->palreg = (data >> 1) & 3; | |
| 73 | state->gfx_bank = (data >> 2) & 1; | |
| 63 | 74 | |
| 64 | question_bank = (data >> 3) & 3; | |
| 75 | state->question_bank = (data >> 3) & 3; | |
| 65 | 76 | |
| 66 | 77 | coin_counter_w(space->machine, 0, data & 0x80); |
| 67 | 78 | |
| r10886 | r10887 | |
| 70 | 81 | |
| 71 | 82 | static READ8_HANDLER( ettrivia_question_r ) |
| 72 | 83 | { |
| 84 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 73 | 85 | UINT8 *QUESTIONS = space->machine->region("user1")->base(); |
| 74 | return QUESTIONS[offset + 0x10000 * question_bank]; | |
| 86 | return QUESTIONS[offset + 0x10000 * state->question_bank]; | |
| 75 | 87 | } |
| 76 | 88 | |
| 77 | 89 | static WRITE8_HANDLER( b000_w ) |
| 78 | 90 | { |
| 79 | b000_val = data; | |
| 91 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 92 | state->b000_val = data; | |
| 80 | 93 | } |
| 81 | 94 | |
| 82 | 95 | static READ8_HANDLER( b000_r ) |
| 83 | 96 | { |
| 84 | if(b800_prev) | |
| 85 | return b000_ret; | |
| 97 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 98 | if(state->b800_prev) | |
| 99 | return state->b000_ret; | |
| 86 | 100 | else |
| 87 | return b000_val; | |
| 101 | return state->b000_val; | |
| 88 | 102 | } |
| 89 | 103 | |
| 90 | 104 | static WRITE8_HANDLER( b800_w ) |
| 91 | 105 | { |
| 106 | ettrivia_state *state = space->machine->driver_data<ettrivia_state>(); | |
| 92 | 107 | switch(data) |
| 93 | 108 | { |
| 94 | 109 | /* special case to return the value written to 0xb000 */ |
| 95 | 110 | /* does it reset the chips too ? */ |
| 96 | 111 | case 0: break; |
| 97 | case 0xc4: b000_ret = ay8910_r(space->machine->device("ay1"), 0); break; | |
| 98 | case 0x94: b000_ret = ay8910_r(space->machine->device("ay2"), 0); break; | |
| 99 | case 0x86: b000_ret = ay8910_r(space->machine->device("ay3"), 0); break; | |
| 112 | case 0xc4: state->b000_ret = ay8910_r(space->machine->device("ay1"), 0); break; | |
| 113 | case 0x94: state->b000_ret = ay8910_r(space->machine->device("ay2"), 0); break; | |
| 114 | case 0x86: state->b000_ret = ay8910_r(space->machine->device("ay3"), 0); break; | |
| 100 | 115 | |
| 101 | 116 | case 0x80: |
| 102 | switch(b800_prev) | |
| 117 | switch(state->b800_prev) | |
| 103 | 118 | { |
| 104 | case 0xe0: ay8910_address_w(space->machine->device("ay1"),0,b000_val); break; | |
| 105 | case 0x98: ay8910_address_w(space->machine->device("ay2"),0,b000_val); break; | |
| 106 | case 0x83: ay8910_address_w(space->machine->device("ay3"),0,b000_val); break; | |
| 119 | case 0xe0: ay8910_address_w(space->machine->device("ay1"),0,state->b000_val); break; | |
| 120 | case 0x98: ay8910_address_w(space->machine->device("ay2"),0,state->b000_val); break; | |
| 121 | case 0x83: ay8910_address_w(space->machine->device("ay3"),0,state->b000_val); break; | |
| 107 | 122 | |
| 108 | case 0xa0: ay8910_data_w(space->machine->device("ay1"),0,b000_val); break; | |
| 109 | case 0x88: ay8910_data_w(space->machine->device("ay2"),0,b000_val); break; | |
| 110 | case 0x81: ay8910_data_w(space->machine->device("ay3"),0,b000_val); break; | |
| 123 | case 0xa0: ay8910_data_w(space->machine->device("ay1"),0,state->b000_val); break; | |
| 124 | case 0x88: ay8910_data_w(space->machine->device("ay2"),0,state->b000_val); break; | |
| 125 | case 0x81: ay8910_data_w(space->machine->device("ay3"),0,state->b000_val); break; | |
| 111 | 126 | |
| 112 | 127 | } |
| 113 | 128 | break; |
| 114 | 129 | } |
| 115 | 130 | |
| 116 | b800_prev = data; | |
| 131 | state->b800_prev = data; | |
| 117 | 132 | } |
| 118 | 133 | |
| 119 | 134 | static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r10886 | r10887 | |
| 124 | 139 | AM_RANGE(0xa000, 0xa000) AM_WRITENOP |
| 125 | 140 | AM_RANGE(0xb000, 0xb000) AM_READ(b000_r) AM_WRITE(b000_w) |
| 126 | 141 | AM_RANGE(0xb800, 0xb800) AM_WRITE(b800_w) |
| 127 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(ettrivia_fg_w) AM_BASE(&fg_videoram) | |
| 128 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ettrivia_bg_w) AM_BASE(&bg_videoram) | |
| 142 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(ettrivia_fg_w) AM_BASE_MEMBER(ettrivia_state, fg_videoram) | |
| 143 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ettrivia_bg_w) AM_BASE_MEMBER(ettrivia_state, bg_videoram) | |
| 129 | 144 | ADDRESS_MAP_END |
| 130 | 145 | |
| 131 | 146 | static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 175 | 190 | |
| 176 | 191 | INLINE void get_tile_info(running_machine *machine, tile_data *tileinfo, int tile_index, UINT8 *vidram, int gfx_code) |
| 177 | 192 | { |
| 193 | ettrivia_state *state = machine->driver_data<ettrivia_state>(); | |
| 178 | 194 | int code = vidram[tile_index]; |
| 179 | int color = (code >> 5) + 8 * palreg; | |
| 195 | int color = (code >> 5) + 8 * state->palreg; | |
| 180 | 196 | |
| 181 | code += gfx_bank * 0x100; | |
| 197 | code += state->gfx_bank * 0x100; | |
| 182 | 198 | |
| 183 | 199 | SET_TILE_INFO(gfx_code,code,color,0); |
| 184 | 200 | } |
| 185 | 201 | |
| 186 | 202 | static TILE_GET_INFO( get_tile_info_bg ) |
| 187 | 203 | { |
| 188 | get_tile_info(machine, tileinfo, tile_index, bg_videoram, 0); | |
| 204 | ettrivia_state *state = machine->driver_data<ettrivia_state>(); | |
| 205 | get_tile_info(machine, tileinfo, tile_index, state->bg_videoram, 0); | |
| 189 | 206 | } |
| 190 | 207 | |
| 191 | 208 | static TILE_GET_INFO( get_tile_info_fg ) |
| 192 | 209 | { |
| 193 | get_tile_info(machine, tileinfo, tile_index, fg_videoram, 1); | |
| 210 | ettrivia_state *state = machine->driver_data<ettrivia_state>(); | |
| 211 | get_tile_info(machine, tileinfo, tile_index, state->fg_videoram, 1); | |
| 194 | 212 | } |
| 195 | 213 | |
| 196 | 214 | static VIDEO_START( ettrivia ) |
| 197 | 215 | { |
| 198 | bg_tilemap = tilemap_create( machine, get_tile_info_bg,tilemap_scan_rows,8,8,64,32 ); | |
| 199 | fg_tilemap = tilemap_create( machine, get_tile_info_fg,tilemap_scan_rows,8,8,64,32 ); | |
| 216 | ettrivia_state *state = machine->driver_data<ettrivia_state>(); | |
| 217 | state->bg_tilemap = tilemap_create( machine, get_tile_info_bg,tilemap_scan_rows,8,8,64,32 ); | |
| 218 | state->fg_tilemap = tilemap_create( machine, get_tile_info_fg,tilemap_scan_rows,8,8,64,32 ); | |
| 200 | 219 | |
| 201 | tilemap_set_transparent_pen(fg_tilemap,0); | |
| 220 | tilemap_set_transparent_pen(state->fg_tilemap,0); | |
| 202 | 221 | } |
| 203 | 222 | |
| 204 | 223 | static SCREEN_UPDATE( ettrivia ) |
| 205 | 224 | { |
| 206 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); | |
| 207 | tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); | |
| 225 | ettrivia_state *state = screen->machine->driver_data<ettrivia_state>(); | |
| 226 | tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0); | |
| 227 | tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0); | |
| 208 | 228 | return 0; |
| 209 | 229 | } |
| 210 | 230 | |
| r10886 | r10887 | |
| 237 | 257 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 238 | 258 | } |
| 239 | 259 | |
| 240 | static MACHINE_CONFIG_START( ettrivia, | |
| 260 | static MACHINE_CONFIG_START( ettrivia, ettriv | |
| 241 | 261 | MCFG_CPU_ADD("maincpu", Z80,12000000/4-48000) //should be ok, it gives the 300 interrupts expected |
| 242 | 262 | MCFG_CPU_PROGRAM_MAP(cpu_map) |
| 243 | 263 | MCFG_CPU_IO_MAP(io_map) |
| r10886 | r10887 | |
|---|---|---|
| 17 | 17 | #include "cpu/cop400/cop400.h" |
| 18 | 18 | //#include "dlair.lh" |
| 19 | 19 | |
| 20 | extern const char layout_dlair[]; | |
| 21 | 20 | |
| 22 | static device_t *laserdisc; | |
| 23 | static UINT8 laserdisc_data; | |
| 21 | struct ssi263_t | |
| 22 | { | |
| 23 | UINT8 dr; | |
| 24 | UINT8 p; | |
| 25 | UINT16 i; | |
| 26 | UINT8 r; | |
| 27 | UINT8 t; | |
| 28 | UINT8 c; | |
| 29 | UINT8 a; | |
| 30 | UINT8 f; | |
| 31 | UINT8 mode; | |
| 32 | }; | |
| 24 | 33 | |
| 25 | static int rx_bit; | |
| 26 | static int keylatch; | |
| 34 | class thayers_state : public driver_device | |
| 35 | { | |
| 36 | public: | |
| 37 | thayers_state(running_machine &machine, const driver_device_config_base &config) | |
| 38 | : driver_device(machine, config) { } | |
| 27 | 39 | |
| 28 | static UINT8 cop_data_latch; | |
| 29 | static int cop_data_latch_enable; | |
| 30 | static UINT8 cop_l; | |
| 31 | static UINT8 cop_cmd_latch; | |
| 40 | device_t *laserdisc; | |
| 41 | UINT8 laserdisc_data; | |
| 42 | int rx_bit; | |
| 43 | int keylatch; | |
| 44 | UINT8 cop_data_latch; | |
| 45 | int cop_data_latch_enable; | |
| 46 | UINT8 cop_l; | |
| 47 | UINT8 cop_cmd_latch; | |
| 48 | int timer_int; | |
| 49 | int data_rdy_int; | |
| 50 | int ssi_data_request; | |
| 51 | int cart_present; | |
| 52 | int pr7820_enter; | |
| 53 | struct ssi263_t ssi263; | |
| 54 | }; | |
| 32 | 55 | |
| 33 | static int timer_int; | |
| 34 | static int data_rdy_int; | |
| 35 | static int ssi_data_request; | |
| 36 | 56 | |
| 37 | static int cart_present; | |
| 38 | static int pr7820_enter; | |
| 57 | extern const char layout_dlair[]; | |
| 39 | 58 | |
| 59 | ||
| 60 | ||
| 40 | 61 | static const UINT8 led_map[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x00 }; |
| 41 | 62 | |
| 42 | 63 | /* Interrupts */ |
| 43 | 64 | |
| 44 | 65 | static void check_interrupt(running_machine *machine) |
| 45 | 66 | { |
| 46 | if (!timer_int || !data_rdy_int || !ssi_data_request) | |
| 67 | thayers_state *state = machine->driver_data<thayers_state>(); | |
| 68 | if (!state->timer_int || !state->data_rdy_int || !state->ssi_data_request) | |
| 47 | 69 | { |
| 48 | 70 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, HOLD_LINE); |
| 49 | 71 | } |
| r10886 | r10887 | |
| 69 | 91 | |
| 70 | 92 | static READ8_HANDLER( irqstate_r ) |
| 71 | 93 | { |
| 94 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 72 | 95 | /* |
| 73 | 96 | |
| 74 | 97 | bit description |
| r10886 | r10887 | |
| 84 | 107 | |
| 85 | 108 | */ |
| 86 | 109 | |
| 87 | return (data_rdy_int << 5) | (timer_int << 4) | 0x08 | (ssi_data_request << 2); | |
| 110 | return (state->data_rdy_int << 5) | (state->timer_int << 4) | 0x08 | (state->ssi_data_request << 2); | |
| 88 | 111 | } |
| 89 | 112 | |
| 90 | 113 | static WRITE8_HANDLER( timer_int_ack_w ) |
| 91 | 114 | { |
| 92 | timer_int = 1; | |
| 115 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 116 | state->timer_int = 1; | |
| 93 | 117 | |
| 94 | 118 | check_interrupt(space->machine); |
| 95 | 119 | } |
| 96 | 120 | |
| 97 | 121 | static WRITE8_HANDLER( data_rdy_int_ack_w ) |
| 98 | 122 | { |
| 99 | data_rdy_int = 1; | |
| 123 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 124 | state->data_rdy_int = 1; | |
| 100 | 125 | |
| 101 | 126 | check_interrupt(space->machine); |
| 102 | 127 | } |
| 103 | 128 | |
| 104 | 129 | static WRITE8_HANDLER( cop_d_w ) |
| 105 | 130 | { |
| 131 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 106 | 132 | /* |
| 107 | 133 | |
| 108 | 134 | bit description |
| r10886 | r10887 | |
| 116 | 142 | |
| 117 | 143 | if (!BIT(data, 0)) |
| 118 | 144 | { |
| 119 | timer_int = 0; | |
| 145 | state->timer_int = 0; | |
| 120 | 146 | } |
| 121 | 147 | |
| 122 | 148 | if (!BIT(data, 1)) |
| 123 | 149 | { |
| 124 | data_rdy_int = 0; | |
| 150 | state->data_rdy_int = 0; | |
| 125 | 151 | } |
| 126 | 152 | |
| 127 | 153 | check_interrupt(space->machine); |
| r10886 | r10887 | |
| 131 | 157 | |
| 132 | 158 | static READ8_HANDLER( cop_data_r ) |
| 133 | 159 | { |
| 134 | if (!cop_data_latch_enable) | |
| 160 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 161 | if (!state->cop_data_latch_enable) | |
| 135 | 162 | { |
| 136 | return cop_data_latch; | |
| 163 | return state->cop_data_latch; | |
| 137 | 164 | } |
| 138 | 165 | else |
| 139 | 166 | { |
| 140 | return cop_l; | |
| 167 | return state->cop_l; | |
| 141 | 168 | } |
| 142 | 169 | } |
| 143 | 170 | |
| 144 | 171 | static WRITE8_HANDLER( cop_data_w ) |
| 145 | 172 | { |
| 146 | cop_data_latch = data; | |
| 173 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 174 | state->cop_data_latch = data; | |
| 147 | 175 | } |
| 148 | 176 | |
| 149 | 177 | static READ8_HANDLER( cop_l_r ) |
| 150 | 178 | { |
| 151 | if (!cop_data_latch_enable) | |
| 179 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 180 | if (!state->cop_data_latch_enable) | |
| 152 | 181 | { |
| 153 | return cop_data_latch; | |
| 182 | return state->cop_data_latch; | |
| 154 | 183 | } |
| 155 | 184 | else |
| 156 | 185 | { |
| r10886 | r10887 | |
| 160 | 189 | |
| 161 | 190 | static WRITE8_HANDLER( cop_l_w ) |
| 162 | 191 | { |
| 163 | cop_l = data; | |
| 192 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 193 | state->cop_l = data; | |
| 164 | 194 | } |
| 165 | 195 | |
| 166 | 196 | static READ8_HANDLER( cop_g_r ) |
| 167 | 197 | { |
| 198 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 168 | 199 | /* |
| 169 | 200 | |
| 170 | 201 | bit description |
| r10886 | r10887 | |
| 176 | 207 | |
| 177 | 208 | */ |
| 178 | 209 | |
| 179 | return cop_cmd_latch; | |
| 210 | return state->cop_cmd_latch; | |
| 180 | 211 | } |
| 181 | 212 | |
| 182 | 213 | static WRITE8_HANDLER( control_w ) |
| 183 | 214 | { |
| 215 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 184 | 216 | /* |
| 185 | 217 | |
| 186 | 218 | bit description |
| r10886 | r10887 | |
| 196 | 228 | |
| 197 | 229 | */ |
| 198 | 230 | |
| 199 | cop_cmd_latch = (data >> 5) & 0x07; | |
| 231 | state->cop_cmd_latch = (data >> 5) & 0x07; | |
| 200 | 232 | } |
| 201 | 233 | |
| 202 | 234 | static WRITE8_HANDLER( cop_g_w ) |
| 203 | 235 | { |
| 236 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 204 | 237 | /* |
| 205 | 238 | |
| 206 | 239 | bit description |
| r10886 | r10887 | |
| 212 | 245 | |
| 213 | 246 | */ |
| 214 | 247 | |
| 215 | cop_data_latch_enable = BIT(data, 3); | |
| 248 | state->cop_data_latch_enable = BIT(data, 3); | |
| 216 | 249 | } |
| 217 | 250 | |
| 218 | 251 | /* Keyboard */ |
| 219 | 252 | |
| 220 | 253 | static READ8_HANDLER(cop_si_r) |
| 221 | 254 | { |
| 255 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 222 | 256 | /* keyboard data */ |
| 223 | 257 | |
| 224 | 258 | /* |
| r10886 | r10887 | |
| 229 | 263 | |
| 230 | 264 | */ |
| 231 | 265 | |
| 232 | switch (rx_bit) | |
| 266 | switch (state->rx_bit) | |
| 233 | 267 | { |
| 234 | 268 | case 0: |
| 235 | 269 | case 1: |
| r10886 | r10887 | |
| 237 | 271 | return 1; |
| 238 | 272 | |
| 239 | 273 | case 4: |
| 240 | return (keylatch == 9); | |
| 274 | return (state->keylatch == 9); | |
| 241 | 275 | |
| 242 | 276 | case 5: |
| 243 | 277 | case 6: |
| r10886 | r10887 | |
| 247 | 281 | UINT8 data; |
| 248 | 282 | char port[4]; |
| 249 | 283 | |
| 250 | sprintf(port, "R%d", keylatch); | |
| 284 | sprintf(port, "R%d", state->keylatch); | |
| 251 | 285 | |
| 252 | data = BIT(input_port_read(space->machine, port), rx_bit - 5); | |
| 286 | data = BIT(input_port_read(space->machine, port), state->rx_bit - 5); | |
| 253 | 287 | |
| 254 | 288 | return data; |
| 255 | 289 | } |
| r10886 | r10887 | |
| 261 | 295 | |
| 262 | 296 | static WRITE8_HANDLER( cop_so_w ) |
| 263 | 297 | { |
| 298 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 264 | 299 | /* keyboard clock */ |
| 265 | 300 | |
| 266 | 301 | if (data) |
| 267 | 302 | { |
| 268 | rx_bit++; | |
| 303 | state->rx_bit++; | |
| 269 | 304 | |
| 270 | if (rx_bit == 10) | |
| 305 | if (state->rx_bit == 10) | |
| 271 | 306 | { |
| 272 | rx_bit = 0; | |
| 307 | state->rx_bit = 0; | |
| 273 | 308 | |
| 274 | keylatch++; | |
| 309 | state->keylatch++; | |
| 275 | 310 | |
| 276 | if (keylatch == 10) | |
| 311 | if (state->keylatch == 10) | |
| 277 | 312 | { |
| 278 | keylatch = 0; | |
| 313 | state->keylatch = 0; | |
| 279 | 314 | } |
| 280 | 315 | } |
| 281 | 316 | } |
| r10886 | r10887 | |
| 285 | 320 | |
| 286 | 321 | static WRITE8_HANDLER( control2_w ) |
| 287 | 322 | { |
| 323 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 288 | 324 | /* |
| 289 | 325 | |
| 290 | 326 | bit description |
| r10886 | r10887 | |
| 300 | 336 | |
| 301 | 337 | */ |
| 302 | 338 | |
| 303 | if ((!BIT(data, 2)) & cart_present) | |
| 339 | if ((!BIT(data, 2)) & state->cart_present) | |
| 304 | 340 | { |
| 305 | 341 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, HOLD_LINE); |
| 306 | 342 | } |
| r10886 | r10887 | |
| 313 | 349 | |
| 314 | 350 | static READ8_HANDLER( laserdsc_data_r ) |
| 315 | 351 | { |
| 316 | return laserdisc_data_r(laserdisc); | |
| 352 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 353 | return laserdisc_data_r(state->laserdisc); | |
| 317 | 354 | } |
| 318 | 355 | |
| 319 | 356 | static WRITE8_HANDLER( laserdsc_data_w ) |
| 320 | 357 | { |
| 321 | laserdisc_data = data; | |
| 358 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 359 | state->laserdisc_data = data; | |
| 322 | 360 | } |
| 323 | 361 | |
| 324 | 362 | static WRITE8_HANDLER( laserdsc_control_w ) |
| 325 | 363 | { |
| 364 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 326 | 365 | /* |
| 327 | 366 | |
| 328 | 367 | bit description |
| r10886 | r10887 | |
| 342 | 381 | |
| 343 | 382 | if (BIT(data, 5)) |
| 344 | 383 | { |
| 345 | laserdisc_data_w(laserdisc, laserdisc_data); | |
| 384 | laserdisc_data_w(state->laserdisc, state->laserdisc_data); | |
| 346 | 385 | } |
| 347 | 386 | |
| 348 | switch (laserdisc_get_type(laserdisc)) | |
| 387 | switch (laserdisc_get_type(state->laserdisc)) | |
| 349 | 388 | { |
| 350 | 389 | case LASERDISC_TYPE_PIONEER_PR7820: |
| 351 | pr7820_enter = BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE; | |
| 390 | state->pr7820_enter = BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE; | |
| 352 | 391 | |
| 353 | laserdisc_line_w(laserdisc, LASERDISC_LINE_ENTER, pr7820_enter); | |
| 392 | laserdisc_line_w(state->laserdisc, LASERDISC_LINE_ENTER, state->pr7820_enter); | |
| 354 | 393 | |
| 355 | 394 | // BIT(data, 7) is INT/_EXT, but there is no such input line in laserdsc.h |
| 356 | 395 | break; |
| 357 | 396 | |
| 358 | 397 | case LASERDISC_TYPE_PIONEER_LDV1000: |
| 359 | laserdisc_line_w(laserdisc, LASERDISC_LINE_ENTER, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); | |
| 398 | laserdisc_line_w(state->laserdisc, LASERDISC_LINE_ENTER, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); | |
| 360 | 399 | break; |
| 361 | 400 | } |
| 362 | 401 | } |
| r10886 | r10887 | |
| 419 | 458 | "L", "L1", "LF", "W", "B", "D", "KV", "P", "T", "K", "HV", "HVC", "HF", "HFC", "HN", "Z", "S", "J", "SCH", "V", "F", "THV", "TH", "M", "N", "NG", ":A", ":OH", ":U", ":UH", "E2", "LB" |
| 420 | 459 | }; |
| 421 | 460 | |
| 422 | static struct SSI263 | |
| 423 | { | |
| 424 | UINT8 dr; | |
| 425 | UINT8 p; | |
| 426 | UINT16 i; | |
| 427 | UINT8 r; | |
| 428 | UINT8 t; | |
| 429 | UINT8 c; | |
| 430 | UINT8 a; | |
| 431 | UINT8 f; | |
| 432 | UINT8 mode; | |
| 433 | } ssi263; | |
| 434 | ||
| 435 | 461 | static TIMER_CALLBACK( ssi263_phoneme_tick ) |
| 436 | 462 | { |
| 437 | ssi_data_request = 0; | |
| 463 | thayers_state *state = machine->driver_data<thayers_state>(); | |
| 464 | state->ssi_data_request = 0; | |
| 438 | 465 | check_interrupt(machine); |
| 439 | 466 | } |
| 440 | 467 | |
| 441 | 468 | static WRITE8_HANDLER( ssi263_register_w ) |
| 442 | 469 | { |
| 470 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 471 | struct ssi263_t &ssi263 = state->ssi263; | |
| 443 | 472 | switch (offset) |
| 444 | 473 | { |
| 445 | 474 | case 0: |
| r10886 | r10887 | |
| 451 | 480 | ssi263.dr = (data >> 5) & 0x03; |
| 452 | 481 | ssi263.p = data & 0x3f; |
| 453 | 482 | |
| 454 | ssi_data_request = 1; | |
| 483 | state->ssi_data_request = 1; | |
| 455 | 484 | check_interrupt(space->machine); |
| 456 | 485 | |
| 457 | 486 | switch (ssi263.mode) |
| r10886 | r10887 | |
| 541 | 570 | |
| 542 | 571 | static READ8_HANDLER( ssi263_register_r ) |
| 543 | 572 | { |
| 573 | thayers_state *state = space->machine->driver_data<thayers_state>(); | |
| 544 | 574 | // D7 becomes an output, as the inverted state of A/_R. The register address bits are ignored. |
| 545 | 575 | |
| 546 | return !ssi_data_request << 7; | |
| 576 | return !state->ssi_data_request << 7; | |
| 547 | 577 | } |
| 548 | 578 | |
| 549 | 579 | /* Memory Maps */ |
| r10886 | r10887 | |
| 584 | 614 | |
| 585 | 615 | static CUSTOM_INPUT( laserdisc_enter_r ) |
| 586 | 616 | { |
| 587 | switch (laserdisc_get_type(laserdisc)) | |
| 617 | thayers_state *state = field->port->machine->driver_data<thayers_state>(); | |
| 618 | switch (laserdisc_get_type(state->laserdisc)) | |
| 588 | 619 | { |
| 589 | 620 | case LASERDISC_TYPE_PIONEER_PR7820: |
| 590 | return pr7820_enter; | |
| 621 | return state->pr7820_enter; | |
| 591 | 622 | |
| 592 | 623 | case LASERDISC_TYPE_PIONEER_LDV1000: |
| 593 | return (laserdisc_line_r(laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1; | |
| 624 | return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1; | |
| 594 | 625 | } |
| 595 | 626 | |
| 596 | 627 | return 0; |
| r10886 | r10887 | |
| 598 | 629 | |
| 599 | 630 | static CUSTOM_INPUT( laserdisc_ready_r ) |
| 600 | 631 | { |
| 601 | switch (laserdisc_get_type(laserdisc)) | |
| 632 | thayers_state *state = field->port->machine->driver_data<thayers_state>(); | |
| 633 | switch (laserdisc_get_type(state->laserdisc)) | |
| 602 | 634 | { |
| 603 | 635 | case LASERDISC_TYPE_PIONEER_PR7820: |
| 604 | return (laserdisc_line_r(laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1; | |
| 636 | return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1; | |
| 605 | 637 | |
| 606 | 638 | case LASERDISC_TYPE_PIONEER_LDV1000: |
| 607 | return (laserdisc_line_r(laserdisc, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1; | |
| 639 | return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1; | |
| 608 | 640 | } |
| 609 | 641 | |
| 610 | 642 | return 0; |
| r10886 | r10887 | |
| 715 | 747 | |
| 716 | 748 | static MACHINE_START( thayers ) |
| 717 | 749 | { |
| 718 | laserdisc = machine->device("laserdisc"); | |
| 719 | memset(&ssi263, 0, sizeof(ssi263)); | |
| 750 | thayers_state *state = machine->driver_data<thayers_state>(); | |
| 751 | state->laserdisc = machine->device("laserdisc"); | |
| 752 | memset(&state->ssi263, 0, sizeof(state->ssi263)); | |
| 720 | 753 | } |
| 721 | 754 | |
| 722 | 755 | static MACHINE_RESET( thayers ) |
| 723 | 756 | { |
| 757 | thayers_state *state = machine->driver_data<thayers_state>(); | |
| 724 | 758 | int newtype; |
| 725 | 759 | |
| 726 | laserdisc_data = 0; | |
| 760 | state->laserdisc_data = 0; | |
| 727 | 761 | |
| 728 | rx_bit = 0; | |
| 729 | keylatch = 0; | |
| 762 | state->rx_bit = 0; | |
| 763 | state->keylatch = 0; | |
| 730 | 764 | |
| 731 | cop_data_latch = 0; | |
| 732 | cop_data_latch_enable = 0; | |
| 733 | cop_l = 0; | |
| 734 | cop_cmd_latch = 0; | |
| 765 | state->cop_data_latch = 0; | |
| 766 | state->cop_data_latch_enable = 0; | |
| 767 | state->cop_l = 0; | |
| 768 | state->cop_cmd_latch = 0; | |
| 735 | 769 | |
| 736 | timer_int = 1; | |
| 737 | data_rdy_int = 1; | |
| 738 | ssi_data_request = 1; | |
| 770 | state->timer_int = 1; | |
| 771 | state->data_rdy_int = 1; | |
| 772 | state->ssi_data_request = 1; | |
| 739 | 773 | |
| 740 | cart_present = 0; | |
| 741 | pr7820_enter = 0; | |
| 774 | state->cart_present = 0; | |
| 775 | state->pr7820_enter = 0; | |
| 742 | 776 | |
| 743 | 777 | newtype = (input_port_read(machine, "DSWB") & 0x18) ? LASERDISC_TYPE_PIONEER_LDV1000 : LASERDISC_TYPE_PIONEER_PR7820; |
| 744 | laserdisc_set_type(laserdisc, newtype); | |
| 778 | laserdisc_set_type(state->laserdisc, newtype); | |
| 745 | 779 | } |
| 746 | 780 | |
| 747 | 781 | /* COP400 Interface */ |
| r10886 | r10887 | |
| 755 | 789 | |
| 756 | 790 | /* Machine Driver */ |
| 757 | 791 | |
| 758 | static MACHINE_CONFIG_START( thayers, | |
| 792 | static MACHINE_CONFIG_START( thayers, thayers_stat | |
| 759 | 793 | /* basic machine hardware */ |
| 760 | 794 | MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) |
| 761 | 795 | MCFG_CPU_PROGRAM_MAP(thayers_map) |
| r10886 | r10887 | |
|---|---|---|
| 219 | 219 | #include "machine/8255ppi.h" |
| 220 | 220 | #include "machine/nvram.h" |
| 221 | 221 | |
| 222 | ||
| 223 | class sms_state : public driver_device | |
| 224 | { | |
| 225 | public: | |
| 226 | sms_state(running_machine &machine, const driver_device_config_base &config) | |
| 227 | : driver_device(machine, config) { } | |
| 228 | ||
| 229 | UINT8 communication_port[4]; | |
| 230 | UINT8 communication_port_status; | |
| 231 | bitmap_t *bitmap; | |
| 232 | UINT8 vid_regs[7]; | |
| 233 | }; | |
| 234 | ||
| 235 | ||
| 222 | 236 | /************************************* |
| 223 | 237 | * |
| 224 | 238 | * Bankswitching (for trivia question roms) |
| r10886 | r10887 | |
| 236 | 250 | * |
| 237 | 251 | *************************************/ |
| 238 | 252 | |
| 239 | static UINT8 communication_port[4]; | |
| 240 | static UINT8 communication_port_status = 0; | |
| 241 | ||
| 242 | 253 | static READ8_HANDLER(link_r) |
| 243 | 254 | { |
| 255 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 244 | 256 | switch(offset) |
| 245 | 257 | { |
| 246 | 258 | case 0: |
| 247 | communication_port_status &= ~0x01; | |
| 248 | return communication_port[0]; | |
| 259 | state->communication_port_status &= ~0x01; | |
| 260 | return state->communication_port[0]; | |
| 249 | 261 | case 1: |
| 250 | communication_port_status &= ~0x02; | |
| 251 | return communication_port[1]; | |
| 262 | state->communication_port_status &= ~0x02; | |
| 263 | return state->communication_port[1]; | |
| 252 | 264 | case 2: |
| 253 | return communication_port_status; | |
| 265 | return state->communication_port_status; | |
| 254 | 266 | } |
| 255 | 267 | return 0; |
| 256 | 268 | }; |
| 257 | 269 | |
| 258 | 270 | static WRITE8_HANDLER(link_w) |
| 259 | 271 | { |
| 272 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 260 | 273 | switch(offset) |
| 261 | 274 | { |
| 262 | 275 | case 0: |
| 263 | communication_port_status |= 0x08; | |
| 264 | communication_port[3] = data; | |
| 276 | state->communication_port_status |= 0x08; | |
| 277 | state->communication_port[3] = data; | |
| 265 | 278 | break; |
| 266 | 279 | case 1: |
| 267 | communication_port_status |= 0x04; | |
| 268 | communication_port[2] = data; | |
| 280 | state->communication_port_status |= 0x04; | |
| 281 | state->communication_port[2] = data; | |
| 269 | 282 | break; |
| 270 | 283 | } |
| 271 | 284 | } |
| 272 | 285 | |
| 273 | 286 | static READ8_HANDLER(z80_8088_r) |
| 274 | 287 | { |
| 275 | return communication_port_status; | |
| 288 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 289 | return state->communication_port_status; | |
| 276 | 290 | } |
| 277 | 291 | |
| 278 | 292 | static READ8_HANDLER(p03_r) |
| 279 | 293 | { |
| 294 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 280 | 295 | switch(offset) |
| 281 | 296 | { |
| 282 | 297 | case 0: |
| 283 | communication_port_status &= ~0x08; | |
| 284 | return communication_port[3]; | |
| 298 | state->communication_port_status &= ~0x08; | |
| 299 | return state->communication_port[3]; | |
| 285 | 300 | case 1: |
| 286 | communication_port_status &= ~0x04; | |
| 287 | return communication_port[2]; | |
| 301 | state->communication_port_status &= ~0x04; | |
| 302 | return state->communication_port[2]; | |
| 288 | 303 | } |
| 289 | 304 | return 0; |
| 290 | 305 | } |
| 291 | 306 | |
| 292 | 307 | static WRITE8_HANDLER(p03_w) |
| 293 | 308 | { |
| 309 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 294 | 310 | switch(offset) |
| 295 | 311 | { |
| 296 | 312 | case 0: |
| 297 | communication_port_status |= 0x01; | |
| 298 | communication_port[0] = data; | |
| 313 | state->communication_port_status |= 0x01; | |
| 314 | state->communication_port[0] = data; | |
| 299 | 315 | break; |
| 300 | 316 | case 1: |
| 301 | communication_port_status |= 0x02; | |
| 302 | communication_port[1] = data; | |
| 317 | state->communication_port_status |= 0x02; | |
| 318 | state->communication_port[1] = data; | |
| 303 | 319 | break; |
| 304 | 320 | } |
| 305 | 321 | } |
| r10886 | r10887 | |
| 416 | 432 | * |
| 417 | 433 | *************************************/ |
| 418 | 434 | |
| 419 | static bitmap_t *sms_bitmap; | |
| 420 | ||
| 421 | static UINT8 vid_regs[7]; | |
| 422 | ||
| 423 | 435 | static WRITE8_HANDLER(video_w) |
| 424 | 436 | { |
| 425 | vid_regs[offset] = data; | |
| 437 | sms_state *state = space->machine->driver_data<sms_state>(); | |
| 438 | state->vid_regs[offset] = data; | |
| 426 | 439 | if ( offset == 5 ) |
| 427 | 440 | { |
| 428 | 441 | int x,y; |
| 429 | int xstart = vid_regs[0] + vid_regs[1]*256; | |
| 430 | int width = vid_regs[2]; | |
| 431 | int ystart = vid_regs[3]; | |
| 432 | int height = vid_regs[4]; | |
| 433 | int color = vid_regs[5]; | |
| 442 | int xstart = state->vid_regs[0] + state->vid_regs[1]*256; | |
| 443 | int width = state->vid_regs[2]; | |
| 444 | int ystart = state->vid_regs[3]; | |
| 445 | int height = state->vid_regs[4]; | |
| 446 | int color = state->vid_regs[5]; | |
| 434 | 447 | |
| 435 | 448 | if ( height == 0 ) |
| 436 | 449 | height = 256; |
| r10886 | r10887 | |
| 443 | 456 | for ( x = xstart; x < xstart + width; x++ ) |
| 444 | 457 | { |
| 445 | 458 | if ( y < 256 ) |
| 446 | *BITMAP_ADDR16(s | |
| 459 | *BITMAP_ADDR16(state->bitmap, y, x) = color; | |
| 447 | 460 | } |
| 448 | 461 | } |
| 449 | 462 | } |
| r10886 | r10887 | |
| 451 | 464 | |
| 452 | 465 | static VIDEO_START( sms ) |
| 453 | 466 | { |
| 454 | sms_bitmap = machine->primary_screen->alloc_compatible_bitmap(); | |
| 467 | sms_state *state = machine->driver_data<sms_state>(); | |
| 468 | state->bitmap = machine->primary_screen->alloc_compatible_bitmap(); | |
| 455 | 469 | |
| 456 | state_save_register_global_array(machine, vid_regs); | |
| 457 | state_save_register_global_bitmap(machine, sms_bitmap); | |
| 470 | state_save_register_global_array(machine, state->vid_regs); | |
| 471 | state_save_register_global_bitmap(machine, state->bitmap); | |
| 458 | 472 | } |
| 459 | 473 | |
| 460 | 474 | static SCREEN_UPDATE( sms ) |
| 461 | 475 | { |
| 462 | copybitmap(bitmap, sms_bitmap, 0, 0, 0, 0, cliprect); | |
| 476 | sms_state *state = screen->machine->driver_data<sms_state>(); | |
| 477 | copybitmap(bitmap, state->bitmap, 0, 0, 0, 0, cliprect); | |
| 463 | 478 | return 0; |
| 464 | 479 | } |
| 465 | 480 | |
| r10886 | r10887 | |
| 516 | 531 | |
| 517 | 532 | static MACHINE_START( sms ) |
| 518 | 533 | { |
| 534 | sms_state *state = machine->driver_data<sms_state>(); | |
| 519 | 535 | memory_configure_bank(machine, "bank1", 0, 16, machine->region("questions")->base(), 0x4000); |
| 520 | 536 | |
| 521 | state_save_register_global(machine, communication_port_status); | |
| 522 | state_save_register_global_array(machine, communication_port); | |
| 537 | state_save_register_global(machine, state->communication_port_status); | |
| 538 | state_save_register_global_array(machine, state->communication_port); | |
| 523 | 539 | } |
| 524 | 540 | |
| 525 | 541 | static MACHINE_START( sureshot ) |
| 526 | 542 | { |
| 527 | state_save_register_global(machine, communication_port_status); | |
| 528 | state_save_register_global_array(machine, communication_port); | |
| 543 | sms_state *state = machine->driver_data<sms_state>(); | |
| 544 | state_save_register_global(machine, state->communication_port_status); | |
| 545 | state_save_register_global_array(machine, state->communication_port); | |
| 529 | 546 | } |
| 530 | 547 | |
| 531 | 548 | static MACHINE_RESET( sms ) |
| 532 | 549 | { |
| 533 | communication_port_status = 0; | |
| 550 | sms_state *state = machine->driver_data<sms_state>(); | |
| 551 | state->communication_port_status = 0; | |
| 534 | 552 | } |
| 535 | 553 | |
| 536 | static MACHINE_CONFIG_START( sms, | |
| 554 | static MACHINE_CONFIG_START( sms, sms | |
| 537 | 555 | MCFG_CPU_ADD("maincpu", I8088, XTAL_24MHz/8) |
| 538 | 556 | MCFG_CPU_PROGRAM_MAP(sms_map) |
| 539 | 557 |
| r10886 | r10887 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | ***************************************************************************/ |
| 39 | 39 | |
| 40 | static int nmi_enable; | |
| 41 | 40 | |
| 42 | 41 | static WRITE8_HANDLER( thedeep_nmi_w ) |
| 43 | 42 | { |
| 44 | nmi_enable = data; | |
| 43 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 44 | state->nmi_enable = data; | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static WRITE8_HANDLER( thedeep_sound_w ) |
| r10886 | r10887 | |
| 50 | 50 | cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | static UINT8 protection_command, protection_data; | |
| 54 | static int protection_index, protection_irq; | |
| 55 | static int rombank; | |
| 56 | 53 | |
| 57 | 54 | static MACHINE_RESET( thedeep ) |
| 58 | 55 | { |
| 56 | thedeep_state *state = machine->driver_data<thedeep_state>(); | |
| 59 | 57 | memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base() + 0x10000 + 0 * 0x4000); |
| 60 | thedeep_scroll[0] = 0; | |
| 61 | thedeep_scroll[1] = 0; | |
| 62 | thedeep_scroll[2] = 0; | |
| 63 | thedeep_scroll[3] = 0; | |
| 64 | protection_command = 0; | |
| 65 | protection_index = -1; | |
| 66 | protection_irq = 0; | |
| 67 | rombank = -1; | |
| 58 | state->scroll[0] = 0; | |
| 59 | state->scroll[1] = 0; | |
| 60 | state->scroll[2] = 0; | |
| 61 | state->scroll[3] = 0; | |
| 62 | state->protection_command = 0; | |
| 63 | state->protection_index = -1; | |
| 64 | state->protection_irq = 0; | |
| 65 | state->rombank = -1; | |
| 68 | 66 | } |
| 69 | 67 | |
| 70 | 68 | static WRITE8_HANDLER( thedeep_protection_w ) |
| 71 | 69 | { |
| 72 | protection_command = data; | |
| 73 | switch (protection_command) | |
| 70 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 71 | state->protection_command = data; | |
| 72 | switch (state->protection_command) | |
| 74 | 73 | { |
| 75 | 74 | case 0x11: |
| 76 | 75 | flip_screen_set(space->machine, 1); |
| r10886 | r10887 | |
| 86 | 85 | case 0x33: |
| 87 | 86 | { |
| 88 | 87 | UINT8 *rom; |
| 89 | int new_rombank = protection_command & 3; | |
| 90 | if (rombank == new_rombank) break; | |
| 91 | rombank = new_rombank; | |
| 88 | int new_rombank = state->protection_command & 3; | |
| 89 | if (state->rombank == new_rombank) break; | |
| 90 | state->rombank = new_rombank; | |
| 92 | 91 | rom = space->machine->region("maincpu")->base(); |
| 93 | memory_set_bankptr(space->machine, "bank1", rom + 0x10000 + rombank * 0x4000); | |
| 92 | memory_set_bankptr(space->machine, "bank1", rom + 0x10000 + state->rombank * 0x4000); | |
| 94 | 93 | /* there's code which falls through from the fixed ROM to bank #1, I have to */ |
| 95 | 94 | /* copy it there otherwise the CPU bank switching support will not catch it. */ |
| 96 | memcpy(rom + 0x08000, rom + 0x10000 + rombank * 0x4000, 0x4000); | |
| 95 | memcpy(rom + 0x08000, rom + 0x10000 + state->rombank * 0x4000, 0x4000); | |
| 97 | 96 | } |
| 98 | 97 | break; |
| 99 | 98 | |
| 100 | 99 | case 0x59: |
| 101 | 100 | { |
| 102 | if (protection_index < 0) | |
| 103 | protection_index = 0; | |
| 101 | if (state->protection_index < 0) | |
| 102 | state->protection_index = 0; | |
| 104 | 103 | |
| 105 | if ( protection_index < 0x19b ) | |
| 104 | if ( state->protection_index < 0x19b ) | |
| 106 | 105 | // d000-d00c: hl += a * b |
| 107 | 106 | // d00d-d029: input a (e.g. $39) output hl (e.g. h=$03 l=$09). |
| 108 | 107 | // Replace trainling 0's with space ($10). 00 -> ' ' |
| r10886 | r10887 | |
| 119 | 118 | // d166-d174: hl = (hl + 2*a) |
| 120 | 119 | // d175-d181: hl *= e (e must be non zero) |
| 121 | 120 | // d182-d19a: hl /= de |
| 122 | protection_data = space->machine->region("cpu3")->base()[0x185+protection_index++]; | |
| 121 | state->protection_data = space->machine->region("cpu3")->base()[0x185+state->protection_index++]; | |
| 123 | 122 | else |
| 124 | protection_data = 0xc9; | |
| 123 | state->protection_data = 0xc9; | |
| 125 | 124 | |
| 126 | protection_irq = 1; | |
| 125 | state->protection_irq = 1; | |
| 127 | 126 | } |
| 128 | 127 | break; |
| 129 | 128 | |
| 130 | 129 | default: |
| 131 | logerror( "pc %04x: protection_command %02x\n", cpu_get_pc(space->cpu),protection_command); | |
| 130 | logerror( "pc %04x: protection_command %02x\n", cpu_get_pc(space->cpu),state->protection_command); | |
| 132 | 131 | } |
| 133 | 132 | } |
| 134 | 133 | |
| 135 | 134 | static READ8_HANDLER( thedeep_e004_r ) |
| 136 | 135 | { |
| 137 | return protection_irq ? 1 : 0; | |
| 136 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 137 | return state->protection_irq ? 1 : 0; | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | static READ8_HANDLER( thedeep_protection_r ) |
| 141 | 141 | { |
| 142 | protection_irq = 0; | |
| 143 | return protection_data; | |
| 142 | thedeep_state *state = space->machine->driver_data<thedeep_state>(); | |
| 143 | state->protection_irq = 0; | |
| 144 | return state->protection_data; | |
| 144 | 145 | } |
| 145 | 146 | |
| 146 | 147 | static WRITE8_HANDLER( thedeep_e100_w ) |
| r10886 | r10887 | |
| 162 | 163 | AM_RANGE(0xe00b, 0xe00b) AM_READ_PORT("e00b") // DSW2 |
| 163 | 164 | AM_RANGE(0xe00c, 0xe00c) AM_WRITE(thedeep_sound_w ) // To Sound CPU |
| 164 | 165 | AM_RANGE(0xe100, 0xe100) AM_WRITE(thedeep_e100_w ) // ? |
| 165 | AM_RANGE(0xe210, 0xe213) AM_WRITEONLY AM_BASE( | |
| 166 | AM_RANGE(0xe210, 0xe213) AM_WRITEONLY AM_BASE_MEMBER( | |
| 166 | 167 | AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_BASE_SIZE_MEMBER(thedeep_state, spriteram, spriteram_size) // Sprites |
| 167 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(thedeep_vram_1_w) AM_BASE(&thedeep_vram_1 ) // Text Layer | |
| 168 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(thedeep_vram_0_w) AM_BASE(&thedeep_vram_0 ) // Background Layer | |
| 169 | AM_RANGE(0xf800, 0xf83f) AM_RAM AM_BASE(&thedeep_scroll2 ) // Column Scroll | |
| 168 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(thedeep_vram_1_w) AM_BASE_MEMBER(thedeep_state, vram_1 ) // Text Layer | |
| 169 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(thedeep_vram_0_w) AM_BASE_MEMBER(thedeep_state, vram_0 ) // Background Layer | |
| 170 | AM_RANGE(0xf800, 0xf83f) AM_RAM AM_BASE_MEMBER(thedeep_state, scroll2 ) // Column Scroll | |
| 170 | 171 | AM_RANGE(0xf840, 0xffff) AM_RAM |
| 171 | 172 | ADDRESS_MAP_END |
| 172 | 173 | |
| r10886 | r10887 | |
| 323 | 324 | |
| 324 | 325 | static INTERRUPT_GEN( thedeep_interrupt ) |
| 325 | 326 | { |
| 327 | thedeep_state *state = device->machine->driver_data<thedeep_state>(); | |
| 326 | 328 | if (cpu_getiloops(device)) |
| 327 | 329 | { |
| 328 | if (protection_command != 0x59) | |
| 330 | if (state->protection_command != 0x59) | |
| 329 | 331 | { |
| 330 | 332 | int coins = input_port_read(device->machine, "MCU"); |
| 331 | if (coins & 1) protection_data = 1; | |
| 332 | else if (coins & 2) protection_data = 2; | |
| 333 | else if (coins & 4) protection_data = 3; | |
| 334 | else protection_data = 0; | |
| 333 | if (coins & 1) state->protection_data = 1; | |
| 334 | else if (coins & 2) state->protection_data = 2; | |
| 335 | else if (coins & 4) state->protection_data = 3; | |
| 336 | else state->protection_data = 0; | |
| 335 | 337 | |
| 336 | if (protection_data) | |
| 337 | protection_irq = 1; | |
| 338 | if (state->protection_data) | |
| 339 | state->protection_irq = 1; | |
| 338 | 340 | } |
| 339 | if (protection_irq) | |
| 341 | if (state->protection_irq) | |
| 340 | 342 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 341 | 343 | } |
| 342 | 344 | else |
| 343 | 345 | { |
| 344 | if (nmi_enable) | |
| 346 | if (state->nmi_enable) | |
| 345 | 347 | { |
| 346 | 348 | cpu_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE); |
| 347 | 349 | cpu_set_input_line(device, INPUT_LINE_NMI, CLEAR_LINE); |
| r10886 | r10887 | |
|---|---|---|
| 439 | 439 | |
| 440 | 440 | int tank_shutter_position; |
| 441 | 441 | int cable_holder_release; |
| 442 | double pad_position[ 6 ]; | |
| 442 | 443 | }; |
| 443 | 444 | |
| 444 | 445 | INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ... ) |
| r10886 | r10887 | |
| 2625 | 2626 | |
| 2626 | 2627 | /* punch mania */ |
| 2627 | 2628 | |
| 2628 | static double pad_position[ 6 ]; | |
| 2629 | 2629 | |
| 2630 | 2630 | static double punchmania_inputs_callback( device_t *device, UINT8 input ) |
| 2631 | 2631 | { |
| 2632 | ksys573_state *state = device->machine->driver_data<ksys573_state>(); | |
| 2633 | double *pad_position = state->pad_position; | |
| 2632 | 2634 | int pads = input_port_read(device->machine, "PADS"); |
| 2633 | 2635 | for( int i = 0; i < 6; i++ ) |
| 2634 | 2636 | { |
| r10886 | r10887 | |
| 2664 | 2666 | |
| 2665 | 2667 | static void punchmania_output_callback( running_machine *machine, int offset, int data ) |
| 2666 | 2668 | { |
| 2669 | ksys573_state *state = machine->driver_data<ksys573_state>(); | |
| 2670 | double *pad_position = state->pad_position; | |
| 2667 | 2671 | char pad[ 7 ]; |
| 2668 | 2672 | |
| 2669 | 2673 | switch( offset ) |
| r10886 | r10887 | |
|---|---|---|
| 81 | 81 | #include "machine/nvram.h" |
| 82 | 82 | #include "re900.lh" |
| 83 | 83 | |
| 84 | static UINT8 *re900_rom; | |
| 85 | static UINT8 psg_pa, psg_pb, mux_data, ledant, player, stat_a; | |
| 86 | 84 | |
| 85 | class re900_state : public driver_device | |
| 86 | { | |
| 87 | public: | |
| 88 | re900_state(running_machine &machine, const driver_device_config_base &config) | |
| 89 | : driver_device(machine, config) { } | |
| 87 | 90 | |
| 91 | UINT8 *rom; | |
| 92 | UINT8 psg_pa; | |
| 93 | UINT8 psg_pb; | |
| 94 | UINT8 mux_data; | |
| 95 | UINT8 ledant; | |
| 96 | UINT8 player; | |
| 97 | UINT8 stat_a; | |
| 98 | }; | |
| 99 | ||
| 100 | ||
| 88 | 101 | /**************** |
| 89 | 102 | * Read Handlers * |
| 90 | 103 | ****************/ |
| r10886 | r10887 | |
| 106 | 119 | |
| 107 | 120 | static READ8_DEVICE_HANDLER (re_psg_portB_r) |
| 108 | 121 | { |
| 122 | re900_state *state = device->machine->driver_data<re900_state>(); | |
| 109 | 123 | UINT8 retval = 0xff; |
| 110 | 124 | logerror("llamada a re_psg_portB_r\n"); |
| 111 | 125 | /* This is a hack to select the active player due to Keyboard size restrictions */ |
| 112 | 126 | |
| 113 | output_set_lamp_value(player,1); | |
| 127 | output_set_lamp_value(state->player,1); | |
| 114 | 128 | |
| 115 | 129 | if (input_port_read(device->machine, "IN_S")) |
| 116 | 130 | { |
| 117 | if (!stat_a) | |
| 131 | if (!state->stat_a) | |
| 118 | 132 | { |
| 119 | 133 | output_set_lamp_value(1, 0); |
| 120 | 134 | output_set_lamp_value(2, 0); |
| r10886 | r10887 | |
| 122 | 136 | output_set_lamp_value(4, 0); |
| 123 | 137 | output_set_lamp_value(5, 0); |
| 124 | 138 | output_set_lamp_value(6, 0); |
| 125 | player++; | |
| 139 | state->player++; | |
| 126 | 140 | |
| 127 | if (player == 7) | |
| 141 | if (state->player == 7) | |
| 128 | 142 | { |
| 129 | player = 1; | |
| 143 | state->player = 1; | |
| 130 | 144 | } |
| 131 | 145 | |
| 132 | output_set_lamp_value(player, 1); /* It shows active player via layout buttons */ | |
| 133 | stat_a = 1; | |
| 146 | output_set_lamp_value(state->player, 1); /* It shows active player via layout buttons */ | |
| 147 | state->stat_a = 1; | |
| 134 | 148 | } |
| 135 | 149 | } |
| 136 | 150 | |
| 137 | 151 | else |
| 138 | 152 | { |
| 139 | stat_a = 0; | |
| 153 | state->stat_a = 0; | |
| 140 | 154 | } |
| 141 | 155 | /* End of Select Player Hack */ |
| 142 | 156 | |
| 143 | 157 | /* "INA": Unified port to share the player Keys among all players - Key In & Key Out have their own buttons on keyboard. */ |
| 144 | switch( mux_data ) | |
| 158 | switch( state->mux_data ) | |
| 145 | 159 | { |
| 146 | case 0x01: retval = (input_port_read(device->machine, "IN6") | 0x80 ) - (( player == 6 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 6 */ | |
| 147 | case 0x02: retval = (input_port_read(device->machine, "IN5") | 0x80 ) - (( player == 5 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 5 */ | |
| 148 | case 0x04: retval = (input_port_read(device->machine, "IN4") | 0x80 ) - (( player == 4 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 4 */ | |
| 149 | case 0x08: retval = (input_port_read(device->machine, "IN3") | 0x80 ) - (( player == 3 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 3 */ | |
| 150 | case 0x10: retval = (input_port_read(device->machine, "IN2") | 0x80 ) - (( player == 2 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 2 */ | |
| 151 | case 0x20: retval = (input_port_read(device->machine, "IN1") | 0x80 ) - (( player == 1 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 1 */ | |
| 160 | case 0x01: retval = (input_port_read(device->machine, "IN6") | 0x80 ) - (( state->player == 6 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 6 */ | |
| 161 | case 0x02: retval = (input_port_read(device->machine, "IN5") | 0x80 ) - (( state->player == 5 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 5 */ | |
| 162 | case 0x04: retval = (input_port_read(device->machine, "IN4") | 0x80 ) - (( state->player == 4 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 4 */ | |
| 163 | case 0x08: retval = (input_port_read(device->machine, "IN3") | 0x80 ) - (( state->player == 3 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 3 */ | |
| 164 | case 0x10: retval = (input_port_read(device->machine, "IN2") | 0x80 ) - (( state->player == 2 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 2 */ | |
| 165 | case 0x20: retval = (input_port_read(device->machine, "IN1") | 0x80 ) - (( state->player == 1 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 1 */ | |
| 152 | 166 | } |
| 153 | 167 | |
| 154 | 168 | return retval; |
| r10886 | r10887 | |
| 156 | 170 | |
| 157 | 171 | static READ8_HANDLER (rom_r) |
| 158 | 172 | { |
| 159 | return re900_rom[offset]; | |
| 173 | re900_state *state = space->machine->driver_data<re900_state>(); | |
| 174 | return state->rom[offset]; | |
| 160 | 175 | } |
| 161 | 176 | |
| 162 | 177 | |
| r10886 | r10887 | |
| 166 | 181 | |
| 167 | 182 | static WRITE8_DEVICE_HANDLER (re_mux_port_A_w) |
| 168 | 183 | { |
| 169 | psg_pa = data; | |
| 170 | mux_data = ((data >> 2) & 0x3f) ^ 0x3f; | |
| 184 | re900_state *state = device->machine->driver_data<re900_state>(); | |
| 185 | state->psg_pa = data; | |
| 186 | state->mux_data = ((data >> 2) & 0x3f) ^ 0x3f; | |
| 171 | 187 | } |
| 172 | 188 | |
| 173 | 189 | static WRITE8_DEVICE_HANDLER (re_mux_port_B_w) |
| 174 | 190 | { |
| 191 | re900_state *state = device->machine->driver_data<re900_state>(); | |
| 175 | 192 | UINT8 led; |
| 176 | psg_pb = data; | |
| 177 | led = (psg_pa >> 2) & 0x3f; | |
| 193 | state->psg_pb = data; | |
| 194 | led = (state->psg_pa >> 2) & 0x3f; | |
| 178 | 195 | |
| 179 | 196 | if (data == 0x7f) |
| 180 | 197 | { |
| 181 | 198 | output_set_lamp_value(20 + led, 1); |
| 182 | 199 | |
| 183 | if (led != ledant) | |
| 200 | if (led != state->ledant) | |
| 184 | 201 | { |
| 185 | output_set_lamp_value(20 + ledant, 0); | |
| 186 | ledant = led; | |
| 202 | output_set_lamp_value(20 + state->ledant, 0); | |
| 203 | state->ledant = led; | |
| 187 | 204 | } |
| 188 | 205 | } |
| 189 | 206 | } |
| r10886 | r10887 | |
| 205 | 222 | *******************************/ |
| 206 | 223 | |
| 207 | 224 | static ADDRESS_MAP_START( mem_prg, ADDRESS_SPACE_PROGRAM, 8 ) |
| 208 | AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE( | |
| 225 | AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE_MEMBER( | |
| 209 | 226 | ADDRESS_MAP_END |
| 210 | 227 | |
| 211 | 228 | static ADDRESS_MAP_START( mem_io, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 388 | 405 | * Machine Driver * |
| 389 | 406 | ***************************/ |
| 390 | 407 | |
| 391 | static MACHINE_CONFIG_START( re900, | |
| 408 | static MACHINE_CONFIG_START( re900, | |
| 392 | 409 | |
| 393 | 410 | /* basic machine hardware */ |
| 394 | 411 | MCFG_CPU_ADD("maincpu", I8051, MAIN_CLOCK) |
| r10886 | r10887 | |
| 440 | 457 | |
| 441 | 458 | static DRIVER_INIT( re900 ) |
| 442 | 459 | { |
| 460 | re900_state *state = machine->driver_data<re900_state>(); | |
| 443 | 461 | TMS9928A_configure(&tms9928a_interface); |
| 444 | player = 1; | |
| 445 | stat_a = 1; | |
| 446 | psg_pa = psg_pb = mux_data = ledant = 0; | |
| 462 | state->player = 1; | |
| 463 | state->stat_a = 1; | |
| 464 | state->psg_pa = state->psg_pb = state->mux_data = state->ledant = 0; | |
| 447 | 465 | } |
| 448 | 466 | |
| 449 | 467 |
| r10886 | r10887 | |
|---|---|---|
| 21 | 21 | #include "machine/eeprom.h" |
| 22 | 22 | |
| 23 | 23 | |
| 24 | static UINT16 *jackpool_vram; | |
| 25 | static UINT8 map_vreg; | |
| 26 | static UINT16 *jackpool_io; | |
| 24 | class jackpool_state : public driver_device | |
| 25 | { | |
| 26 | public: | |
| 27 | jackpool_state(running_machine &machine, const driver_device_config_base &config) | |
| 28 | : driver_device(machine, config) { } | |
| 27 | 29 | |
| 30 | UINT16 *vram; | |
| 31 | UINT8 map_vreg; | |
| 32 | UINT16 *io; | |
| 33 | }; | |
| 28 | 34 | |
| 35 | ||
| 29 | 36 | static VIDEO_START(jackpool) |
| 30 | 37 | { |
| 31 | 38 | } |
| 32 | 39 | |
| 33 | 40 | static SCREEN_UPDATE(jackpool) |
| 34 | 41 | { |
| 42 | jackpool_state *state = screen->machine->driver_data<jackpool_state>(); | |
| 35 | 43 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 36 | 44 | int count;// = 0x00000/2; |
| 37 | 45 | |
| 38 | 46 | int y,x; |
| 39 | 47 | |
| 40 | 48 | { |
| 41 | count = map_vreg*(0x4000/2); | |
| 49 | count = state->map_vreg*(0x4000/2); | |
| 42 | 50 | for (y=0;y<32;y++) |
| 43 | 51 | { |
| 44 | 52 | for (x=0;x<64;x++) |
| 45 | 53 | { |
| 46 | int tile = (jackpool_vram[count+(0x2000/2)] & 0x7fff); | |
| 47 | int attr = (jackpool_vram[count+(0x2000/2)+0x800] & 0x1f00)>>8; | |
| 54 | int tile = (state->vram[count+(0x2000/2)] & 0x7fff); | |
| 55 | int attr = (state->vram[count+(0x2000/2)+0x800] & 0x1f00)>>8; | |
| 48 | 56 | |
| 49 | 57 | drawgfx_opaque(bitmap,cliprect,gfx,tile,attr,0,0,x*8,y*8); |
| 50 | 58 | count++; |
| 51 | 59 | } |
| 52 | 60 | } |
| 53 | 61 | |
| 54 | count = map_vreg*(0x4000/2); | |
| 62 | count = state->map_vreg*(0x4000/2); | |
| 55 | 63 | for (y=0;y<32;y++) |
| 56 | 64 | { |
| 57 | 65 | for (x=0;x<64;x++) |
| 58 | 66 | { |
| 59 | int tile = ( | |
| 67 | int tile = (state-> | |
| 60 | 68 | |
| 61 | 69 | if(tile != 0) |
| 62 | 70 | { |
| 63 | int attr = (jackpool_vram[count+0x800] & 0x1f00)>>8; | |
| 64 | int t_pen = (jackpool_vram[count+0x800] & 0x1000); | |
| 71 | int attr = (state->vram[count+0x800] & 0x1f00)>>8; | |
| 72 | int t_pen = (state->vram[count+0x800] & 0x1000); | |
| 65 | 73 | |
| 66 | 74 | drawgfx_transpen(bitmap,cliprect,gfx,tile,attr,0,0,x*8,y*8,(t_pen) ? 0 : -1); |
| 67 | 75 | } |
| r10886 | r10887 | |
| 82 | 90 | |
| 83 | 91 | static READ16_HANDLER( jackpool_io_r ) |
| 84 | 92 | { |
| 93 | jackpool_state *state = space->machine->driver_data<jackpool_state>(); | |
| 85 | 94 | switch(offset*2) |
| 86 | 95 | { |
| 87 | 96 | case 0x00: return input_port_read(space->machine,"COIN1"); |
| r10886 | r10887 | |
| 106 | 115 | } |
| 107 | 116 | |
| 108 | 117 | // printf("R %02x\n",offset*2); |
| 109 | return | |
| 118 | return state-> | |
| 110 | 119 | } |
| 111 | 120 | |
| 112 | 121 | static WRITE16_HANDLER( jackpool_io_w ) |
| 113 | 122 | { |
| 114 | COMBINE_DATA(&jackpool_io[offset]); | |
| 123 | jackpool_state *state = space->machine->driver_data<jackpool_state>(); | |
| 124 | COMBINE_DATA(&state->io[offset]); | |
| 115 | 125 | |
| 116 | 126 | switch(offset*2) |
| 117 | 127 | { |
| r10886 | r10887 | |
| 127 | 137 | case 0x46: /* ---- ---x coin counter */break; |
| 128 | 138 | case 0x4a: /* ---- ---x Ticket motor */break; |
| 129 | 139 | case 0x4c: /* ---- ---x Hopper motor */break; |
| 130 | case 0x4e: map_vreg = data & 1; break; | |
| 140 | case 0x4e: state->map_vreg = data & 1; break; | |
| 131 | 141 | case 0x50: eeprom_set_cs_line(space->machine->device("eeprom"), (data & 1) ? CLEAR_LINE : ASSERT_LINE ); break; |
| 132 | 142 | case 0x52: eeprom_set_clock_line(space->machine->device("eeprom"), (data & 1) ? ASSERT_LINE : CLEAR_LINE ); break; |
| 133 | 143 | case 0x54: eeprom_write_bit(space->machine->device("eeprom"), data & 1); break; |
| r10886 | r10887 | |
| 160 | 170 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 161 | 171 | AM_RANGE(0x100000, 0x10ffff) AM_RAM |
| 162 | 172 | AM_RANGE(0x120000, 0x1200ff) AM_RAM |
| 163 | AM_RANGE(0x340000, 0x347fff) AM_RAM AM_BASE( | |
| 173 | AM_RANGE(0x340000, 0x347fff) AM_RAM AM_BASE_MEMBER( | |
| 164 | 174 | AM_RANGE(0x348000, 0x34ffff) AM_RAM //<- vram banks 2 & 3? |
| 165 | 175 | |
| 166 | 176 | AM_RANGE(0x360000, 0x3603ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 167 | AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE( | |
| 177 | AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE_MEMBER( | |
| 168 | 178 | |
| 169 | 179 | AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_ff_r) AM_WRITENOP //UART |
| 170 | 180 | AM_RANGE(0xa00000, 0xa00001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff) |
| r10886 | r10887 | |
| 239 | 249 | } |
| 240 | 250 | |
| 241 | 251 | |
| 242 | static MACHINE_CONFIG_START( jackpool, | |
| 252 | static MACHINE_CONFIG_START( jackpool, ja | |
| 243 | 253 | MCFG_CPU_ADD("maincpu", M68000, 12000000) // ? |
| 244 | 254 | MCFG_CPU_PROGRAM_MAP(jackpool_mem) |
| 245 | 255 | MCFG_CPU_VBLANK_INT("screen",jackpool_interrupt) // ? |
| r10886 | r10887 | |
|---|---|---|
| 125 | 125 | #include "machine/eeprom.h" |
| 126 | 126 | |
| 127 | 127 | |
| 128 | class pntnpuzl_state : public driver_device | |
| 129 | { | |
| 130 | public: | |
| 131 | pntnpuzl_state(running_machine &machine, const driver_device_config_base &config) | |
| 132 | : driver_device(machine, config) { } | |
| 133 | ||
| 134 | UINT16 eeprom; | |
| 135 | UINT16* _3a0000ram; | |
| 136 | UINT16* bank; | |
| 137 | int indx; | |
| 138 | int sub; | |
| 139 | int rgb[3]; | |
| 140 | UINT16 pntpzl_200000; | |
| 141 | UINT16 serial; | |
| 142 | UINT16 serial_out; | |
| 143 | UINT16 read_count; | |
| 144 | int touchscr[5]; | |
| 145 | }; | |
| 146 | ||
| 147 | ||
| 128 | 148 | static const eeprom_interface eeprom_intf = |
| 129 | 149 | { |
| 130 | 150 | 6, /* address bits */ |
| r10886 | r10887 | |
| 136 | 156 | "*10011xxxx" /* unlock command */ |
| 137 | 157 | }; |
| 138 | 158 | |
| 139 | static UINT16 pntnpuzl_eeprom; | |
| 140 | 159 | |
| 141 | 160 | static READ16_DEVICE_HANDLER( pntnpuzl_eeprom_r ) |
| 142 | 161 | { |
| 162 | pntnpuzl_state *state = device->machine->driver_data<pntnpuzl_state>(); | |
| 143 | 163 | /* bit 11 is EEPROM data */ |
| 144 | return ( | |
| 164 | return (s | |
| 145 | 165 | } |
| 146 | 166 | |
| 147 | 167 | static WRITE16_DEVICE_HANDLER( pntnpuzl_eeprom_w ) |
| 148 | 168 | { |
| 149 | pntnpuzl_eeprom = data; | |
| 169 | pntnpuzl_state *state = device->machine->driver_data<pntnpuzl_state>(); | |
| 170 | state->eeprom = data; | |
| 150 | 171 | |
| 151 | 172 | /* bit 12 is data */ |
| 152 | 173 | /* bit 13 is clock (active high) */ |
| r10886 | r10887 | |
| 160 | 181 | |
| 161 | 182 | |
| 162 | 183 | |
| 163 | static UINT16* pntnpuzl_3a0000ram; | |
| 164 | static UINT16* pntnpuzl_bank; | |
| 165 | 184 | /* vid */ |
| 166 | 185 | static VIDEO_START( pntnpuzl ) |
| 167 | 186 | { |
| 168 | pntnpuzl_3a0000ram=auto_alloc_array(machine, UINT16, 0x100000/2); | |
| 187 | pntnpuzl_state *state = machine->driver_data<pntnpuzl_state>(); | |
| 188 | state->_3a0000ram=auto_alloc_array(machine, UINT16, 0x100000/2); | |
| 169 | 189 | } |
| 170 | 190 | |
| 171 | 191 | static SCREEN_UPDATE( pntnpuzl ) |
| 172 | 192 | { |
| 193 | pntnpuzl_state *state = screen->machine->driver_data<pntnpuzl_state>(); | |
| 173 | 194 | int x,y; |
| 174 | 195 | int count; |
| 175 | 196 | #if 0 |
| r10886 | r10887 | |
| 225 | 246 | { |
| 226 | 247 | for(x=0;x<xxx;x+=2) |
| 227 | 248 | { |
| 228 | *BITMAP_ADDR16(bitmap, y, x) = (pntnpuzl_3a0000ram[count]&0x1f00)>>8; | |
| 229 | *BITMAP_ADDR16(bitmap, y, x+1) = (pntnpuzl_3a0000ram[count]&0x001f)>>0; | |
| 249 | *BITMAP_ADDR16(bitmap, y, x) = (state->_3a0000ram[count]&0x1f00)>>8; | |
| 250 | *BITMAP_ADDR16(bitmap, y, x+1) = (state->_3a0000ram[count]&0x001f)>>0; | |
| 230 | 251 | count++; |
| 231 | 252 | } |
| 232 | 253 | } |
| r10886 | r10887 | |
| 235 | 256 | |
| 236 | 257 | static WRITE16_HANDLER( pntnpuzl_palette_w ) |
| 237 | 258 | { |
| 238 | stat | |
| 259 | pntnpuzl_state | |
| 239 | 260 | |
| 240 | 261 | if (ACCESSING_BITS_8_15) |
| 241 | 262 | { |
| 242 | indx = data >> 8; | |
| 243 | sub = 0; | |
| 263 | state->indx = data >> 8; | |
| 264 | state->sub = 0; | |
| 244 | 265 | } |
| 245 | 266 | if (ACCESSING_BITS_0_7) |
| 246 | 267 | { |
| 247 | rgb[sub++] = data & 0xff; | |
| 248 | if (sub == 3) | |
| 268 | state->rgb[state->sub++] = data & 0xff; | |
| 269 | if (state->sub == 3) | |
| 249 | 270 | { |
| 250 | palette_set_color_rgb(space->machine,indx++,pal6bit(rgb[0]),pal6bit(rgb[1]),pal6bit(rgb[2])); | |
| 251 | sub = 0; | |
| 252 | if (indx == 256) indx = 0; | |
| 271 | palette_set_color_rgb(space->machine,state->indx++,pal6bit(state->rgb[0]),pal6bit(state->rgb[1]),pal6bit(state->rgb[2])); | |
| 272 | state->sub = 0; | |
| 273 | if (state->indx == 256) state->indx = 0; | |
| 253 | 274 | } |
| 254 | 275 | } |
| 255 | 276 | } |
| r10886 | r10887 | |
| 265 | 286 | |
| 266 | 287 | static READ16_HANDLER( pntnpuzl_vid_r ) |
| 267 | 288 | { |
| 268 | // logerror("read_videoram: pc = %06x : offset %04x reg %04x\n",cpu_get_pc(space->cpu),offset*2, pntnpuzl_bank[0]); | |
| 269 | return pntnpuzl_3a0000ram[offset+ (pntnpuzl_bank[0]&0x0001)*0x8000 ]; | |
| 289 | pntnpuzl_state *state = space->machine->driver_data<pntnpuzl_state>(); | |
| 290 | // logerror("read_videoram: pc = %06x : offset %04x reg %04x\n",cpu_get_pc(space->cpu),offset*2, state->bank[0]); | |
| 291 | return state->_3a0000ram[offset+ (state->bank[0]&0x0001)*0x8000 ]; | |
| 270 | 292 | } |
| 271 | 293 | |
| 272 | 294 | static WRITE16_HANDLER( pntnpuzl_vid_w ) |
| 273 | 295 | { |
| 274 | // logerror("write_to_videoram: pc = %06x : offset %04x data %04x reg %04x\n",cpu_get_pc(space->cpu),offset*2, data, pntnpuzl_bank[0]); | |
| 275 | COMBINE_DATA(&pntnpuzl_3a0000ram[offset+ (pntnpuzl_bank[0]&0x0001)*0x8000 ]); | |
| 296 | pntnpuzl_state *state = space->machine->driver_data<pntnpuzl_state>(); | |
| 297 | // logerror("write_to_videoram: pc = %06x : offset %04x data %04x reg %04x\n",cpu_get_pc(space->cpu),offset*2, data, state->bank[0]); | |
| 298 | COMBINE_DATA(&state->_3a0000ram[offset+ (state->bank[0]&0x0001)*0x8000 ]); | |
| 276 | 299 | } |
| 277 | 300 | |
| 278 | 301 | static READ16_HANDLER( pntnpuzl_vblank_r ) |
| r10886 | r10887 | |
| 303 | 326 | 01 53 45 32 0d ---> 80 0c |
| 304 | 327 | 01 03 46 31 38 0d ---> 80 0c |
| 305 | 328 | */ |
| 306 | static UINT16 pntpzl_200000, serial, serial_out,read_count; | |
| 307 | 329 | |
| 308 | 330 | static WRITE16_HANDLER( pntnpuzl_200000_w ) |
| 309 | 331 | { |
| 332 | pntnpuzl_state *state = space->machine->driver_data<pntnpuzl_state>(); | |
| 310 | 333 | // logerror("200000: %04x\n",data); |
| 311 | 334 | // bit 12: set to 1 when going to serial output to 280018 |
| 312 | if ((pntpzl_200000 & 0x1000) && !(data & 0x1000)) | |
| 335 | if ((state->pntpzl_200000 & 0x1000) && !(data & 0x1000)) | |
| 313 | 336 | { |
| 314 | serial_out = (serial>>1) & 0xff; | |
| 315 | read_count = 0; | |
| 316 | logerror("serial out: %02x\n",serial_out); | |
| 337 | state->serial_out = (state->serial>>1) & 0xff; | |
| 338 | state->read_count = 0; | |
| 339 | logerror("serial out: %02x\n",state->serial_out); | |
| 317 | 340 | } |
| 318 | 341 | |
| 319 | pntpzl_200000 = data; | |
| 342 | state->pntpzl_200000 = data; | |
| 320 | 343 | } |
| 321 | 344 | |
| 322 | 345 | static WRITE16_HANDLER( pntnpuzl_280018_w ) |
| 323 | 346 | { |
| 347 | pntnpuzl_state *state = space->machine->driver_data<pntnpuzl_state>(); | |
| 324 | 348 | // logerror("%04x: 280018: %04x\n",cpu_get_pc(space->cpu),data); |
| 325 | serial >>= 1; | |
| 349 | state->serial >>= 1; | |
| 326 | 350 | if (data & 0x2000) |
| 327 | serial |= 0x400; | |
| 351 | state->serial |= 0x400; | |
| 328 | 352 | } |
| 329 | 353 | |
| 330 | 354 | static READ16_HANDLER( pntnpuzl_280014_r ) |
| 331 | 355 | { |
| 356 | pntnpuzl_state *state = space->machine->driver_data<pntnpuzl_state>(); | |
| 332 | 357 | static const int startup[3] = { 0x80, 0x0c, 0x00 }; |
| 333 | 358 | int res; |
| 334 | 359 | |
| 335 | if (serial_out == 0x11) | |
| 360 | if (state->serial_out == 0x11) | |
| 336 | 361 | { |
| 337 | static int touchscr[5]; | |
| 338 | 362 | if (input_port_read(space->machine, "IN0") & 0x10) |
| 339 | 363 | { |
| 340 | touchscr[0] = 0x1b; | |
| 341 | touchscr[2] = BITSWAP8(input_port_read(space->machine, "TOUCHX"),0,1,2,3,4,5,6,7); | |
| 342 | touchscr[4] = BITSWAP8(input_port_read(space->machine, "TOUCHY"),0,1,2,3,4,5,6,7); | |
| 364 | state->touchscr[0] = 0x1b; | |
| 365 | state->touchscr[2] = BITSWAP8(input_port_read(space->machine, "TOUCHX"),0,1,2,3,4,5,6,7); | |
| 366 | state->touchscr[4] = BITSWAP8(input_port_read(space->machine, "TOUCHY"),0,1,2,3,4,5,6,7); | |
| 343 | 367 | } |
| 344 | 368 | else |
| 345 | touchscr[0] = 0; | |
| 369 | state->touchscr[0] = 0; | |
| 346 | 370 | |
| 347 | if (read_count >= 10) read_count = 0; | |
| 348 | res = touchscr[read_count/2]; | |
| 349 | read_count++; | |
| 371 | if (state->read_count >= 10) state->read_count = 0; | |
| 372 | res = state->touchscr[state->read_count/2]; | |
| 373 | state->read_count++; | |
| 350 | 374 | } |
| 351 | 375 | else |
| 352 | 376 | { |
| 353 | if (read_count >= 6) read_count = 0; | |
| 354 | res = startup[read_count/2]; | |
| 355 | read_count++; | |
| 377 | if (state->read_count >= 6) state->read_count = 0; | |
| 378 | res = startup[state->read_count/2]; | |
| 379 | state->read_count++; | |
| 356 | 380 | } |
| 357 | 381 | logerror("read 280014: %02x\n",res); |
| 358 | 382 | return res << 8; |
| r10886 | r10887 | |
| 386 | 410 | |
| 387 | 411 | /* standard VGA */ |
| 388 | 412 | AM_RANGE(0x3a0000, 0x3affff) AM_READWRITE(pntnpuzl_vid_r, pntnpuzl_vid_w) |
| 389 | AM_RANGE(0x3c03c4, 0x3c03c5) AM_RAM AM_BASE( | |
| 413 | AM_RANGE(0x3c03c4, 0x3c03c5) AM_RAM AM_BASE_MEMBER( | |
| 390 | 414 | AM_RANGE(0x3c03c8, 0x3c03c9) AM_WRITE(pntnpuzl_palette_w) |
| 391 | 415 | AM_RANGE(0x3c03da, 0x3c03db) AM_READ(pntnpuzl_vblank_r) |
| 392 | 416 | |
| r10886 | r10887 | |
| 436 | 460 | |
| 437 | 461 | |
| 438 | 462 | |
| 439 | static MACHINE_CONFIG_START( pntnpuzl, | |
| 463 | static MACHINE_CONFIG_START( pntnpuzl, pntnpuzl_stat | |
| 440 | 464 | MCFG_CPU_ADD("maincpu", M68000, 12000000)//?? |
| 441 | 465 | MCFG_CPU_PROGRAM_MAP(pntnpuzl_map) |
| 442 | 466 | MCFG_CPU_VBLANK_INT("screen", pntnpuzl_irq) // irq1 = coin irq2 = service irq4 = coin |
| r10886 | r10887 | |
|---|---|---|
| 82 | 82 | : driver_device(machine, config) { } |
| 83 | 83 | |
| 84 | 84 | UINT8 *spriteram; |
| 85 | UINT8 nAyCtrl; | |
| 86 | UINT8 nAyData; | |
| 87 | UINT8 nmi_mask; | |
| 88 | UINT8 *videoram; | |
| 89 | UINT8 *colorram; | |
| 85 | 90 | }; |
| 86 | 91 | |
| 87 | 92 | |
| 88 | static UINT8 nAyCtrl, nAyData; | |
| 89 | static UINT8 nmi_mask; | |
| 90 | static UINT8 *videoram; | |
| 91 | static UINT8 *colorram; | |
| 92 | ||
| 93 | 93 | static VIDEO_START(mirax) |
| 94 | 94 | { |
| 95 | 95 | } |
| r10886 | r10887 | |
| 124 | 124 | |
| 125 | 125 | static SCREEN_UPDATE(mirax) |
| 126 | 126 | { |
| 127 | mirax_state *state = screen->machine->driver_data<mirax_state>(); | |
| 127 | 128 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 128 | 129 | int count = 0x00000; |
| 129 | 130 | int y,x; |
| r10886 | r10887 | |
| 132 | 133 | { |
| 133 | 134 | for (x=0;x<32;x++) |
| 134 | 135 | { |
| 135 | int tile = videoram[count]; | |
| 136 | int color = (colorram[x*2]<<8) | (colorram[(x*2)+1]); | |
| 136 | int tile = state->videoram[count]; | |
| 137 | int color = (state->colorram[x*2]<<8) | (state->colorram[(x*2)+1]); | |
| 137 | 138 | int x_scroll = (color & 0xff00)>>8; |
| 138 | 139 | tile |= ((color & 0xe0)<<3); |
| 139 | 140 | |
| r10886 | r10887 | |
| 154 | 155 | { |
| 155 | 156 | for (x=0;x<32;x++) |
| 156 | 157 | { |
| 157 | int tile = videoram[count]; | |
| 158 | int color = (colorram[x*2]<<8) | (colorram[(x*2)+1]); | |
| 158 | int tile = state->videoram[count]; | |
| 159 | int color = (state->colorram[x*2]<<8) | (state->colorram[(x*2)+1]); | |
| 159 | 160 | int x_scroll = (color & 0xff00)>>8; |
| 160 | 161 | tile |= ((color & 0xe0)<<3); |
| 161 | 162 | |
| r10886 | r10887 | |
| 176 | 177 | |
| 177 | 178 | static SOUND_START(mirax) |
| 178 | 179 | { |
| 179 | nAyCtrl = 0x00; | |
| 180 | nAyData = 0x00; | |
| 180 | mirax_state *state = machine->driver_data<mirax_state>(); | |
| 181 | state->nAyCtrl = 0x00; | |
| 182 | state->nAyData = 0x00; | |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | static WRITE8_HANDLER(audio_w) |
| 184 | 186 | { |
| 187 | mirax_state *state = space->machine->driver_data<mirax_state>(); | |
| 185 | 188 | if(cpu_get_previouspc(space->cpu)==0x2fd) |
| 186 | 189 | { |
| 187 | nAyCtrl=offset; | |
| 188 | nAyData=data; | |
| 190 | state->nAyCtrl=offset; | |
| 191 | state->nAyData=data; | |
| 189 | 192 | } |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | 195 | static WRITE8_DEVICE_HANDLER(ay_sel) |
| 193 | 196 | { |
| 197 | mirax_state *state = device->machine->driver_data<mirax_state>(); | |
| 194 | 198 | if(cpu_get_previouspc(device->machine->device("audiocpu"))==0x309) |
| 195 | 199 | { |
| 196 | ay8910_address_w(device,0,nAyCtrl); | |
| 197 | ay8910_data_w(device,0,nAyData); | |
| 200 | ay8910_address_w(device,0,state->nAyCtrl); | |
| 201 | ay8910_data_w(device,0,state->nAyData); | |
| 198 | 202 | } |
| 199 | 203 | } |
| 200 | 204 | |
| r10886 | r10887 | |
| 205 | 209 | |
| 206 | 210 | static WRITE8_HANDLER( nmi_mask_w ) |
| 207 | 211 | { |
| 208 | nmi_mask = data & 1; | |
| 212 | mirax_state *state = space->machine->driver_data<mirax_state>(); | |
| 213 | state->nmi_mask = data & 1; | |
| 209 | 214 | if(data & 0xfe) |
| 210 | 215 | printf("Warning: %02x written at $f501\n",data); |
| 211 | 216 | } |
| r10886 | r10887 | |
| 219 | 224 | static ADDRESS_MAP_START( mirax_main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 220 | 225 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 221 | 226 | AM_RANGE(0xc800, 0xd7ff) AM_RAM |
| 222 | AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE( | |
| 227 | AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_MEMBER(mirax_state, videoram) | |
| 223 | 228 | AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_BASE_MEMBER(mirax_state, spriteram) |
| 224 | AM_RANGE(0xea00, 0xea3f) AM_RAM AM_BASE( | |
| 229 | AM_RANGE(0xea00, 0xea3f) AM_RAM AM_BASE_MEMBER(mirax_state, colorram) //per-column color + bank bits for the videoram | |
| 225 | 230 | AM_RANGE(0xf000, 0xf000) AM_READ_PORT("P1") |
| 226 | 231 | AM_RANGE(0xf100, 0xf100) AM_READ_PORT("P2") |
| 227 | 232 | AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW1") |
| r10886 | r10887 | |
| 384 | 389 | |
| 385 | 390 | static INTERRUPT_GEN( mirax_vblank_irq ) |
| 386 | 391 | { |
| 387 | if(nmi_mask) | |
| 392 | mirax_state *state = device->machine->driver_data<mirax_state>(); | |
| 393 | if(state->nmi_mask) | |
| 388 | 394 | cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); |
| 389 | 395 | } |
| 390 | 396 |
| r10886 | r10887 | |
|---|---|---|
| 211 | 211 | MAXIO=128 |
| 212 | 212 | }; |
| 213 | 213 | |
| 214 | static UINT32 PS7500_IO[MAXIO]; | |
| 215 | static UINT32 PS7500_FIFO[256]; | |
| 216 | static UINT32 *vram; | |
| 217 | static UINT32 flashAdr,flashOffset,adrLatch,flashType,flashN; | |
| 218 | 214 | |
| 219 | static void PS7500_startTimer0(void); | |
| 220 | static void PS7500_startTimer1(void); | |
| 215 | class ssfindo_state : public driver_device | |
| 216 | { | |
| 217 | public: | |
| 218 | ssfindo_state(running_machine &machine, const driver_device_config_base &config) | |
| 219 | : driver_device(machine, config) { } | |
| 221 | 220 | |
| 222 | static emu_timer *PS7500timer0; | |
| 223 | static emu_timer *PS7500timer1; | |
| 221 | UINT32 PS7500_IO[MAXIO]; | |
| 222 | UINT32 PS7500_FIFO[256]; | |
| 223 | UINT32 *vram; | |
| 224 | UINT32 flashAdr; | |
| 225 | UINT32 flashOffset; | |
| 226 | UINT32 adrLatch; | |
| 227 | UINT32 flashType; | |
| 228 | UINT32 flashN; | |
| 229 | emu_timer *PS7500timer0; | |
| 230 | emu_timer *PS7500timer1; | |
| 231 | int iocr_hack; | |
| 232 | }; | |
| 224 | 233 | |
| 225 | static int iocr_hack; | |
| 226 | 234 | |
| 235 | static void PS7500_startTimer0(running_machine *machine); | |
| 236 | static void PS7500_startTimer1(running_machine *machine); | |
| 237 | ||
| 238 | ||
| 227 | 239 | static SCREEN_UPDATE(ssfindo) |
| 228 | 240 | { |
| 241 | ssfindo_state *state = screen->machine->driver_data<ssfindo_state>(); | |
| 229 | 242 | int s,x,y; |
| 230 | 243 | |
| 231 | if( PS7500_IO[VIDCR]&0x20) //video DMA enabled | |
| 244 | if( state->PS7500_IO[VIDCR]&0x20) //video DMA enabled | |
| 232 | 245 | { |
| 233 | s=( (PS7500_IO[VIDINITA]&0x1fffffff)-0x10000000)/4; | |
| 246 | s=( (state->PS7500_IO[VIDINITA]&0x1fffffff)-0x10000000)/4; | |
| 234 | 247 | |
| 235 | 248 | if(s>=0 && s<(0x10000000/4)) |
| 236 | 249 | { |
| 237 | 250 | for(y=0;y<256;y++) |
| 238 | 251 | for(x=0;x<320;x+=4) |
| 239 | 252 | { |
| 240 | *BITMAP_ADDR16(bitmap, y, x+0) = vram[s]&0xff; | |
| 241 | *BITMAP_ADDR16(bitmap, y, x+1) = (vram[s]>>8)&0xff; | |
| 242 | *BITMAP_ADDR16(bitmap, y, x+2) = (vram[s]>>16)&0xff; | |
| 243 | *BITMAP_ADDR16(bitmap, y, x+3) = (vram[s]>>24)&0xff; | |
| 253 | *BITMAP_ADDR16(bitmap, y, x+0) = state->vram[s]&0xff; | |
| 254 | *BITMAP_ADDR16(bitmap, y, x+1) = (state->vram[s]>>8)&0xff; | |
| 255 | *BITMAP_ADDR16(bitmap, y, x+2) = (state->vram[s]>>16)&0xff; | |
| 256 | *BITMAP_ADDR16(bitmap, y, x+3) = (state->vram[s]>>24)&0xff; | |
| 244 | 257 | s++; |
| 245 | 258 | } |
| 246 | 259 | } |
| r10886 | r10887 | |
| 251 | 264 | |
| 252 | 265 | static WRITE32_HANDLER(FIFO_w) |
| 253 | 266 | { |
| 254 | PS7500_FIFO[data>>28]=data; | |
| 267 | ssfindo_state *state = space->machine->driver_data<ssfindo_state>(); | |
| 268 | state->PS7500_FIFO[data>>28]=data; | |
| 255 | 269 | |
| 256 | 270 | if(!(data>>28)) |
| 257 | 271 | { |
| 258 | palette_set_color_rgb(space->machine, PS7500_FIFO[1]&0xff, data&0xff,(data>>8)&0xff,(data>>16)&0xff); | |
| 259 | PS7500_FIFO[1]++; //autoinc | |
| 272 | palette_set_color_rgb(space->machine, state->PS7500_FIFO[1]&0xff, data&0xff,(data>>8)&0xff,(data>>16)&0xff); | |
| 273 | state->PS7500_FIFO[1]++; //autoinc | |
| 260 | 274 | } |
| 261 | 275 | } |
| 262 | 276 | static TIMER_CALLBACK( PS7500_Timer0_callback ) |
| 263 | 277 | { |
| 264 | PS7500_IO[IRQSTA]|=0x20; | |
| 265 | if(PS7500_IO[IRQMSKA]&0x20) | |
| 278 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 279 | state->PS7500_IO[IRQSTA]|=0x20; | |
| 280 | if(state->PS7500_IO[IRQMSKA]&0x20) | |
| 266 | 281 | { |
| 267 | 282 | generic_pulse_irq_line(machine->device("maincpu"), ARM7_IRQ_LINE); |
| 268 | 283 | } |
| 269 | 284 | } |
| 270 | 285 | |
| 271 | static void PS7500_startTimer0( | |
| 286 | static void PS7500_startTimer0(running_machine *machine) | |
| 272 | 287 | { |
| 273 | int val=((PS7500_IO[T0low]&0xff)|((PS7500_IO[T0high]&0xff)<<8))>>1; | |
| 288 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 289 | int val=((state->PS7500_IO[T0low]&0xff)|((state->PS7500_IO[T0high]&0xff)<<8))>>1; | |
| 274 | 290 | |
| 275 | 291 | if(val==0) |
| 276 | PS7500timer0->adjust(attotime::never); | |
| 292 | state->PS7500timer0->adjust(attotime::never); | |
| 277 | 293 | else |
| 278 | PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); | |
| 294 | state->PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); | |
| 279 | 295 | } |
| 280 | 296 | |
| 281 | 297 | static TIMER_CALLBACK( PS7500_Timer1_callback ) |
| 282 | 298 | { |
| 283 | PS7500_IO[IRQSTA]|=0x40; | |
| 284 | if(PS7500_IO[IRQMSKA]&0x40) | |
| 299 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 300 | state->PS7500_IO[IRQSTA]|=0x40; | |
| 301 | if(state->PS7500_IO[IRQMSKA]&0x40) | |
| 285 | 302 | { |
| 286 | 303 | generic_pulse_irq_line(machine->device("maincpu"), ARM7_IRQ_LINE); |
| 287 | 304 | } |
| 288 | 305 | } |
| 289 | 306 | |
| 290 | static void PS7500_startTimer1( | |
| 307 | static void PS7500_startTimer1(running_machine *machine) | |
| 291 | 308 | { |
| 292 | int val=((PS7500_IO[T1low]&0xff)|((PS7500_IO[T1high]&0xff)<<8))>>1; | |
| 309 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 310 | int val=((state->PS7500_IO[T1low]&0xff)|((state->PS7500_IO[T1high]&0xff)<<8))>>1; | |
| 293 | 311 | if(val==0) |
| 294 | PS7500timer1->adjust(attotime::never); | |
| 312 | state->PS7500timer1->adjust(attotime::never); | |
| 295 | 313 | else |
| 296 | PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); | |
| 314 | state->PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); | |
| 297 | 315 | } |
| 298 | 316 | |
| 299 | 317 | static INTERRUPT_GEN( ssfindo_interrupt ) |
| 300 | 318 | { |
| 301 | PS7500_IO[IRQSTA]|=0x08; | |
| 302 | if(PS7500_IO[IRQMSKA]&0x08) | |
| 319 | ssfindo_state *state = device->machine->driver_data<ssfindo_state>(); | |
| 320 | state->PS7500_IO[IRQSTA]|=0x08; | |
| 321 | if(state->PS7500_IO[IRQMSKA]&0x08) | |
| 303 | 322 | { |
| 304 | 323 | generic_pulse_irq_line(device, ARM7_IRQ_LINE); |
| 305 | 324 | } |
| 306 | 325 | } |
| 307 | 326 | |
| 308 | static void PS7500_reset( | |
| 327 | static void PS7500_reset(running_machine *machine) | |
| 309 | 328 | { |
| 310 | PS7500_IO[IOCR] = 0x3f; | |
| 311 | PS7500_IO[VIDCR] = 0; | |
| 329 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 330 | state->PS7500_IO[IOCR] = 0x3f; | |
| 331 | state->PS7500_IO[VIDCR] = 0; | |
| 312 | 332 | |
| 313 | PS7500timer0->adjust( attotime::never); | |
| 314 | PS7500timer1->adjust( attotime::never); | |
| 333 | state->PS7500timer0->adjust( attotime::never); | |
| 334 | state->PS7500timer1->adjust( attotime::never); | |
| 315 | 335 | } |
| 316 | 336 | |
| 317 | 337 | typedef void (*ssfindo_speedup_func)(address_space *space); |
| r10886 | r10887 | |
| 336 | 356 | |
| 337 | 357 | static READ32_HANDLER(PS7500_IO_r) |
| 338 | 358 | { |
| 359 | ssfindo_state *state = space->machine->driver_data<ssfindo_state>(); | |
| 339 | 360 | switch(offset) |
| 340 | 361 | { |
| 341 | 362 | case MSECR: |
| r10886 | r10887 | |
| 346 | 367 | mame_printf_debug("IOLINESR %i @%x\n", offset, cpu_get_pc(space->cpu)); |
| 347 | 368 | #endif |
| 348 | 369 | |
| 349 | if(flashType == 1) | |
| 370 | if(state->flashType == 1) | |
| 350 | 371 | return 0; |
| 351 | 372 | else |
| 352 | 373 | return space->machine->rand(); |
| 353 | 374 | |
| 354 | 375 | case IRQSTA: |
| 355 | return (PS7500_IO[offset] & (~2)) | 0x80; | |
| 376 | return (state->PS7500_IO[offset] & (~2)) | 0x80; | |
| 356 | 377 | |
| 357 | 378 | case IRQRQA: |
| 358 | return (PS7500_IO[IRQSTA] & PS7500_IO[IRQMSKA]) | 0x80; | |
| 379 | return (state->PS7500_IO[IRQSTA] & state->PS7500_IO[IRQMSKA]) | 0x80; | |
| 359 | 380 | |
| 360 | 381 | case IOCR: //TODO: nINT1, OD[n] p.81 |
| 361 | 382 | if (ssfindo_speedup) ssfindo_speedup(space); |
| 362 | 383 | |
| 363 | if( iocr_hack) | |
| 384 | if( state->iocr_hack) | |
| 364 | 385 | { |
| 365 | 386 | return (input_port_read(space->machine, "PS7500") & 0x80) | 0x34 | (space->machine->rand()&3); //eeprom read ? |
| 366 | 387 | } |
| r10886 | r10887 | |
| 368 | 389 | return (input_port_read(space->machine, "PS7500") & 0x80) | 0x37; |
| 369 | 390 | |
| 370 | 391 | case VIDCR: |
| 371 | return (PS7500_IO[offset] | 0x50) & 0xfffffff0; | |
| 392 | return (state->PS7500_IO[offset] | 0x50) & 0xfffffff0; | |
| 372 | 393 | |
| 373 | 394 | case T1low: |
| 374 | 395 | case T0low: |
| r10886 | r10887 | |
| 379 | 400 | case VIDSTART: |
| 380 | 401 | case VIDINITA: //TODO: bits 29 ("equal") and 30 (last bit) p.105 |
| 381 | 402 | |
| 382 | return PS7500_IO[offset]; | |
| 403 | return state->PS7500_IO[offset]; | |
| 383 | 404 | |
| 384 | 405 | |
| 385 | 406 | } |
| 386 | return space->machine->rand();//PS7500_IO[offset]; | |
| 407 | return space->machine->rand();//state->PS7500_IO[offset]; | |
| 387 | 408 | } |
| 388 | 409 | |
| 389 | 410 | static WRITE32_HANDLER(PS7500_IO_w) |
| 390 | 411 | { |
| 391 | UINT32 temp=PS7500_IO[offset]; | |
| 412 | ssfindo_state *state = space->machine->driver_data<ssfindo_state>(); | |
| 413 | UINT32 temp=state->PS7500_IO[offset]; | |
| 392 | 414 | |
| 393 | 415 | COMBINE_DATA(&temp); |
| 394 | 416 | |
| 395 | 417 | switch(offset) |
| 396 | 418 | { |
| 397 | 419 | case IOLINES: //TODO: eeprom 24c01 |
| 398 | PS7500_IO[offset]=data; | |
| 420 | state->PS7500_IO[offset]=data; | |
| 399 | 421 | if(data&0xc0) |
| 400 | adrLatch=0; | |
| 422 | state->adrLatch=0; | |
| 401 | 423 | |
| 402 | if(cpu_get_pc(space->cpu) == 0xbac0 && flashType == 1) | |
| 424 | if(cpu_get_pc(space->cpu) == 0xbac0 && state->flashType == 1) | |
| 403 | 425 | { |
| 404 | flashN=data&1; | |
| 426 | state->flashN=data&1; | |
| 405 | 427 | } |
| 406 | 428 | |
| 407 | 429 | #if 0 |
| r10886 | r10887 | |
| 410 | 432 | break; |
| 411 | 433 | |
| 412 | 434 | case IRQRQA: |
| 413 | PS7500_IO[IRQSTA]&=~temp; | |
| 435 | state->PS7500_IO[IRQSTA]&=~temp; | |
| 414 | 436 | break; |
| 415 | 437 | |
| 416 | 438 | case IRQMSKA: |
| 417 | PS7500_IO[IRQMSKA]=(temp&(~2))|0x80; | |
| 439 | state->PS7500_IO[IRQMSKA]=(temp&(~2))|0x80; | |
| 418 | 440 | break; |
| 419 | 441 | |
| 420 | 442 | case T1GO: |
| 421 | PS7500_startTimer1(); | |
| 443 | PS7500_startTimer1(space->machine); | |
| 422 | 444 | break; |
| 423 | 445 | |
| 424 | 446 | case T0GO: |
| 425 | PS7500_startTimer0(); | |
| 447 | PS7500_startTimer0(space->machine); | |
| 426 | 448 | break; |
| 427 | 449 | |
| 428 | 450 | case VIDEND: |
| 429 | 451 | case VIDSTART: |
| 430 | COMBINE_DATA(&PS7500_IO[offset]); | |
| 431 | PS7500_IO[offset]&=0xfffffff0; // qword align | |
| 452 | COMBINE_DATA(&state->PS7500_IO[offset]); | |
| 453 | state->PS7500_IO[offset]&=0xfffffff0; // qword align | |
| 432 | 454 | break; |
| 433 | 455 | |
| 434 | 456 | case IOCR: |
| r10886 | r10887 | |
| 444 | 466 | case T0high: |
| 445 | 467 | case VIDCR: |
| 446 | 468 | case VIDINITA: //TODO: bit 30 (last bit) p.105 |
| 447 | COMBINE_DATA(&PS7500_IO[offset]); | |
| 469 | COMBINE_DATA(&state->PS7500_IO[offset]); | |
| 448 | 470 | break; |
| 449 | 471 | |
| 450 | 472 | |
| r10886 | r10887 | |
| 454 | 476 | |
| 455 | 477 | static READ32_HANDLER(io_r) |
| 456 | 478 | { |
| 479 | ssfindo_state *state = space->machine->driver_data<ssfindo_state>(); | |
| 457 | 480 | UINT16 *FLASH = (UINT16 *)space->machine->region("user2")->base(); //16 bit - WORD access |
| 458 | 481 | |
| 459 | int adr=flashAdr*0x200+(flashOffset); | |
| 482 | int adr=state->flashAdr*0x200+(state->flashOffset); | |
| 460 | 483 | |
| 461 | 484 | |
| 462 | switch(flashType) | |
| 485 | switch(state->flashType) | |
| 463 | 486 | { |
| 464 | 487 | case 0: |
| 465 | if(PS7500_IO[IOLINES]&1) //bit 0 of IOLINES = flash select ( 5/6 or 3/2 ) | |
| 488 | if(state->PS7500_IO[IOLINES]&1) //bit 0 of IOLINES = flash select ( 5/6 or 3/2 ) | |
| 466 | 489 | adr+=0x400000; |
| 467 | 490 | break; |
| 468 | 491 | |
| 469 | 492 | case 1: |
| 470 | adr+=0x400000*flashN; | |
| 493 | adr+=0x400000*state->flashN; | |
| 471 | 494 | break; |
| 472 | 495 | } |
| 473 | 496 | |
| 474 | 497 | if(adr<0x400000*2) |
| 475 | 498 | { |
| 476 | flashOffset++; | |
| 499 | state->flashOffset++; | |
| 477 | 500 | return FLASH[adr]; |
| 478 | 501 | } |
| 479 | 502 | return 0; |
| r10886 | r10887 | |
| 481 | 504 | |
| 482 | 505 | static WRITE32_HANDLER(io_w) |
| 483 | 506 | { |
| 507 | ssfindo_state *state = space->machine->driver_data<ssfindo_state>(); | |
| 484 | 508 | UINT32 temp = 0; |
| 485 | 509 | COMBINE_DATA(&temp); |
| 486 | 510 | |
| 487 | 511 | #if 0 |
| 488 | logerror("[io_w] = %x @%x [latch=%x]\n",data,cpu_get_pc(space->cpu),adrLatch); | |
| 512 | logerror("[io_w] = %x @%x [latch=%x]\n",data,cpu_get_pc(space->cpu),state->adrLatch); | |
| 489 | 513 | #endif |
| 490 | 514 | |
| 491 | if(adrLatch==1) | |
| 492 | flashAdr=(temp>>16)&0xff; | |
| 493 | if(adrLatch==2) | |
| 515 | if(state->adrLatch==1) | |
| 516 | state->flashAdr=(temp>>16)&0xff; | |
| 517 | if(state->adrLatch==2) | |
| 494 | 518 | { |
| 495 | flashAdr|=(temp>>16)&0xff00; | |
| 496 | flashOffset=0; | |
| 519 | state->flashAdr|=(temp>>16)&0xff00; | |
| 520 | state->flashOffset=0; | |
| 497 | 521 | } |
| 498 | adrLatch=(adrLatch+1)%3; | |
| 522 | state->adrLatch=(state->adrLatch+1)%3; | |
| 499 | 523 | } |
| 500 | 524 | |
| 501 | 525 | static WRITE32_HANDLER(debug_w) |
| r10886 | r10887 | |
| 535 | 559 | AM_RANGE(0x0324f000, 0x0324f003) AM_READ(SIMPLEIO_r) |
| 536 | 560 | AM_RANGE(0x03245000, 0x03245003) AM_WRITENOP /* sound ? */ |
| 537 | 561 | AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w) |
| 538 | AM_RANGE(0x10000000, 0x11ffffff) AM_RAM AM_BASE | |
| 562 | AM_RANGE(0x10000000, 0x11ffffff) AM_RAM AM_BASE_MEMBER(ssfindo_state, vram) | |
| 539 | 563 | ADDRESS_MAP_END |
| 540 | 564 | |
| 541 | 565 | static ADDRESS_MAP_START( ppcar_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| r10886 | r10887 | |
| 550 | 574 | AM_RANGE(0x033c0000, 0x033c0003) AM_READ(io_r) AM_WRITE(io_w) |
| 551 | 575 | AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w) |
| 552 | 576 | AM_RANGE(0x08000000, 0x08ffffff) AM_RAM |
| 553 | AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_BASE | |
| 577 | AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_BASE_MEMBER(ssfindo_state, vram) | |
| 554 | 578 | ADDRESS_MAP_END |
| 555 | 579 | |
| 556 | 580 | static READ32_HANDLER(tetfight_unk_r) |
| r10886 | r10887 | |
| 572 | 596 | AM_RANGE(0x03240004, 0x03240007) AM_READ_PORT("IN0") |
| 573 | 597 | AM_RANGE(0x03240008, 0x0324000b) AM_READ_PORT("DSW2") |
| 574 | 598 | AM_RANGE(0x03240020, 0x03240023) AM_READWRITE( tetfight_unk_r, tetfight_unk_w) |
| 575 | AM_RANGE(0x10000000, 0x14ffffff) AM_RAM AM_BASE | |
| 599 | AM_RANGE(0x10000000, 0x14ffffff) AM_RAM AM_BASE_MEMBER(ssfindo_state, vram) | |
| 576 | 600 | ADDRESS_MAP_END |
| 577 | 601 | |
| 578 | 602 | static MACHINE_RESET( ssfindo ) |
| 579 | 603 | { |
| 580 | PS7500_reset(); | |
| 604 | PS7500_reset(machine); | |
| 581 | 605 | } |
| 582 | 606 | |
| 583 | 607 | static INPUT_PORTS_START( ssfindo ) |
| r10886 | r10887 | |
| 716 | 740 | INPUT_PORTS_END |
| 717 | 741 | |
| 718 | 742 | |
| 719 | static MACHINE_CONFIG_START( ssfindo, | |
| 743 | static MACHINE_CONFIG_START( ssfindo, ssfin | |
| 720 | 744 | |
| 721 | 745 | /* basic machine hardware */ |
| 722 | 746 | MCFG_CPU_ADD("maincpu", ARM7, 54000000) // guess... |
| r10886 | r10887 | |
| 823 | 847 | |
| 824 | 848 | static DRIVER_INIT(common) |
| 825 | 849 | { |
| 850 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 826 | 851 | ssfindo_speedup = 0; |
| 827 | PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback)); | |
| 828 | PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback)); | |
| 852 | state->PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback)); | |
| 853 | state->PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback)); | |
| 829 | 854 | |
| 830 | 855 | } |
| 831 | 856 | |
| 832 | 857 | static DRIVER_INIT(ssfindo) |
| 833 | 858 | { |
| 859 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 834 | 860 | DRIVER_INIT_CALL(common); |
| 835 | flashType=0; | |
| 861 | state->flashType=0; | |
| 836 | 862 | ssfindo_speedup = ssfindo_speedups; |
| 837 | iocr_hack=0; | |
| 863 | state->iocr_hack=0; | |
| 838 | 864 | } |
| 839 | 865 | |
| 840 | 866 | static DRIVER_INIT(ppcar) |
| 841 | 867 | { |
| 868 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 842 | 869 | DRIVER_INIT_CALL(common); |
| 843 | flashType=1; | |
| 870 | state->flashType=1; | |
| 844 | 871 | ssfindo_speedup = ppcar_speedups; |
| 845 | iocr_hack=0; | |
| 872 | state->iocr_hack=0; | |
| 846 | 873 | } |
| 847 | 874 | |
| 848 | 875 | static DRIVER_INIT(tetfight) |
| 849 | 876 | { |
| 877 | ssfindo_state *state = machine->driver_data<ssfindo_state>(); | |
| 850 | 878 | DRIVER_INIT_CALL(common); |
| 851 | flashType=0; | |
| 852 | iocr_hack=1; | |
| 879 | state->flashType=0; | |
| 880 | state->iocr_hack=1; | |
| 853 | 881 | } |
| 854 | 882 | |
| 855 | 883 | GAME( 1999, ssfindo, 0, ssfindo, ssfindo, ssfindo, ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND ) |
| r10886 | r10887 | |
|---|---|---|
| 184 | 184 | |
| 185 | 185 | UINT8 *videoram; |
| 186 | 186 | required_shared_ptr<UINT8> cmos_ram; |
| 187 | UINT16 autohold_addr; | |
| 188 | tilemap_t *bg_tilemap; | |
| 189 | UINT8 wingboard; | |
| 190 | UINT8 jumper_e16_e17; | |
| 191 | UINT8 *program_ram; | |
| 192 | UINT8 *s3000_ram; | |
| 193 | UINT8 *s5000_ram; | |
| 194 | UINT8 *s7000_ram; | |
| 195 | UINT8 *sb000_ram; | |
| 196 | UINT8 *sd000_ram; | |
| 197 | UINT8 *sf000_ram; | |
| 198 | UINT16 vid_address; | |
| 199 | UINT8 *palette_ram; | |
| 200 | UINT8 *palette_ram2; | |
| 201 | UINT8 *io_port; | |
| 202 | UINT64 last_cycles; | |
| 203 | UINT8 coin_state; | |
| 204 | UINT64 last_door; | |
| 205 | UINT8 door_open; | |
| 206 | UINT64 last_coin_out; | |
| 207 | UINT8 coin_out_state; | |
| 208 | int sda_dir; | |
| 187 | 209 | }; |
| 188 | 210 | |
| 189 | 211 | |
| r10886 | r10887 | |
| 192 | 214 | #define MC6845_CLOCK ((MASTER_CLOCK)/8/3) |
| 193 | 215 | #define SOUND_CLOCK ((MASTER_CLOCK)/12) |
| 194 | 216 | |
| 195 | static UINT16 autohold_addr; /* address to patch in program RAM to enable autohold feature */ | |
| 196 | 217 | |
| 197 | static tilemap_t *bg_tilemap; | |
| 198 | static UINT8 wingboard; | |
| 199 | static UINT8 jumper_e16_e17; /* Set this to TRUE when CG chips are 27c512 instead of 27c256 */ | |
| 200 | ||
| 201 | /* Pointers to External RAM */ | |
| 202 | static UINT8 *program_ram; | |
| 203 | static UINT8 *s3000_ram; | |
| 204 | static UINT8 *s5000_ram; | |
| 205 | static UINT8 *s7000_ram; | |
| 206 | static UINT8 *sb000_ram; | |
| 207 | static UINT8 *sd000_ram; | |
| 208 | static UINT8 *sf000_ram; | |
| 209 | ||
| 210 | /* Variables used instead of CRTC6845 system */ | |
| 211 | static UINT16 vid_address = 0; | |
| 212 | ||
| 213 | /* Holds upper video address, palette number and jumper_e16_e17 flag */ | |
| 214 | static UINT8 *palette_ram; | |
| 215 | static UINT8 *palette_ram2; | |
| 216 | ||
| 217 | /* IO Ports */ | |
| 218 | static UINT8 *io_port; | |
| 219 | ||
| 220 | /* Coin, Door, Hopper and EEPROM States */ | |
| 221 | static UINT64 last_cycles; | |
| 222 | static UINT8 coin_state = 0; | |
| 223 | static UINT64 last_door; | |
| 224 | static UINT8 door_open = 0; | |
| 225 | static UINT64 last_coin_out; | |
| 226 | static UINT8 coin_out_state = 0; | |
| 227 | static int sda_dir = 0; | |
| 228 | ||
| 229 | /* Static Variables */ | |
| 230 | 218 | #define eeprom_NVRAM_SIZE 0x200 // 4k Bit |
| 231 | 219 | |
| 232 | 220 | /* EEPROM is a X2404P 4K-bit Serial I2C Bus */ |
| r10886 | r10887 | |
| 260 | 248 | |
| 261 | 249 | static void peplus_load_superdata(running_machine *machine, const char *bank_name) |
| 262 | 250 | { |
| 251 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 263 | 252 | UINT8 *super_data = machine->region(bank_name)->base(); |
| 264 | 253 | |
| 265 | 254 | /* Distribute Superboard Data */ |
| 266 | memcpy(s3000_ram, &super_data[0x3000], 0x1000); | |
| 267 | memcpy(s5000_ram, &super_data[0x5000], 0x1000); | |
| 268 | memcpy(s7000_ram, &super_data[0x7000], 0x1000); | |
| 269 | memcpy(sb000_ram, &super_data[0xb000], 0x1000); | |
| 270 | memcpy(sd000_ram, &super_data[0xd000], 0x1000); | |
| 271 | memcpy(sf000_ram, &super_data[0xf000], 0x1000); | |
| 255 | memcpy(state->s3000_ram, &super_data[0x3000], 0x1000); | |
| 256 | memcpy(state->s5000_ram, &super_data[0x5000], 0x1000); | |
| 257 | memcpy(state->s7000_ram, &super_data[0x7000], 0x1000); | |
| 258 | memcpy(state->sb000_ram, &super_data[0xb000], 0x1000); | |
| 259 | memcpy(state->sd000_ram, &super_data[0xd000], 0x1000); | |
| 260 | memcpy(state->sf000_ram, &super_data[0xf000], 0x1000); | |
| 272 | 261 | } |
| 273 | 262 | |
| 274 | 263 | |
| r10886 | r10887 | |
| 311 | 300 | |
| 312 | 301 | static MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr) |
| 313 | 302 | { |
| 314 | vid_address = address; | |
| 303 | peplus_state *state = device->machine->driver_data<peplus_state>(); | |
| 304 | state->vid_address = address; | |
| 315 | 305 | } |
| 316 | 306 | |
| 317 | 307 | static WRITE8_DEVICE_HANDLER( peplus_crtc_mode_w ) |
| r10886 | r10887 | |
| 347 | 337 | { |
| 348 | 338 | peplus_state *state = device->machine->driver_data<peplus_state>(); |
| 349 | 339 | UINT8 *videoram = state->videoram; |
| 350 | videoram[vid_address] = data; | |
| 351 | palette_ram[vid_address] = io_port[1]; | |
| 352 | palette_ram2[vid_address] = io_port[3]; | |
| 340 | videoram[state->vid_address] = data; | |
| 341 | state->palette_ram[state->vid_address] = state->io_port[1]; | |
| 342 | state->palette_ram2[state->vid_address] = state->io_port[3]; | |
| 353 | 343 | |
| 354 | tilemap_mark_tile_dirty(bg_tilemap, vid_address); | |
| 344 | tilemap_mark_tile_dirty(state->bg_tilemap, state->vid_address); | |
| 355 | 345 | |
| 356 | 346 | /* An access here triggers a device read !*/ |
| 357 | 347 | (void) mc6845_register_r(device, 0); |
| r10886 | r10887 | |
| 359 | 349 | |
| 360 | 350 | static WRITE8_HANDLER( peplus_io_w ) |
| 361 | 351 | { |
| 362 | io_port[offset] = data; | |
| 352 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 353 | state->io_port[offset] = data; | |
| 363 | 354 | } |
| 364 | 355 | |
| 365 | 356 | static WRITE8_HANDLER( peplus_duart_w ) |
| r10886 | r10887 | |
| 373 | 364 | char bank_name[6]; |
| 374 | 365 | |
| 375 | 366 | /* Test for Wingboard PAL Trigger Condition */ |
| 376 | if (offset == 0x1fff && wingboard && data < 5) | |
| 367 | if (offset == 0x1fff && state->wingboard && data < 5) | |
| 377 | 368 | { |
| 378 | 369 | sprintf(bank_name, "user%d", data + 1); |
| 379 | 370 | peplus_load_superdata(space->machine, bank_name); |
| r10886 | r10887 | |
| 384 | 375 | |
| 385 | 376 | static WRITE8_HANDLER( peplus_s3000_w ) |
| 386 | 377 | { |
| 387 | s3000_ram[offset] = data; | |
| 378 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 379 | state->s3000_ram[offset] = data; | |
| 388 | 380 | } |
| 389 | 381 | |
| 390 | 382 | static WRITE8_HANDLER( peplus_s5000_w ) |
| 391 | 383 | { |
| 392 | s5000_ram[offset] = data; | |
| 384 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 385 | state->s5000_ram[offset] = data; | |
| 393 | 386 | } |
| 394 | 387 | |
| 395 | 388 | static WRITE8_HANDLER( peplus_s7000_w ) |
| 396 | 389 | { |
| 397 | s7000_ram[offset] = data; | |
| 390 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 391 | state->s7000_ram[offset] = data; | |
| 398 | 392 | } |
| 399 | 393 | |
| 400 | 394 | static WRITE8_HANDLER( peplus_sb000_w ) |
| 401 | 395 | { |
| 402 | sb000_ram[offset] = data; | |
| 396 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 397 | state->sb000_ram[offset] = data; | |
| 403 | 398 | } |
| 404 | 399 | |
| 405 | 400 | static WRITE8_HANDLER( peplus_sd000_w ) |
| 406 | 401 | { |
| 407 | sd000_ram[offset] = data; | |
| 402 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 403 | state->sd000_ram[offset] = data; | |
| 408 | 404 | } |
| 409 | 405 | |
| 410 | 406 | static WRITE8_HANDLER( peplus_sf000_w ) |
| 411 | 407 | { |
| 412 | sf000_ram[offset] = data; | |
| 408 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 409 | state->sf000_ram[offset] = data; | |
| 413 | 410 | } |
| 414 | 411 | |
| 415 | 412 | static WRITE8_HANDLER( peplus_output_bank_a_w ) |
| 416 | 413 | { |
| 414 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 417 | 415 | output_set_value("pe_bnka0",(data >> 0) & 1); /* Coin Lockout */ |
| 418 | 416 | output_set_value("pe_bnka1",(data >> 1) & 1); /* Diverter */ |
| 419 | 417 | output_set_value("pe_bnka2",(data >> 2) & 1); /* Bell */ |
| r10886 | r10887 | |
| 423 | 421 | output_set_value("pe_bnka6",(data >> 6) & 1); /* specific to a kind of machine */ |
| 424 | 422 | output_set_value("pe_bnka7",(data >> 7) & 1); /* specific to a kind of machine */ |
| 425 | 423 | |
| 426 | coin_out_state = 0; | |
| 424 | state->coin_out_state = 0; | |
| 427 | 425 | if(((data >> 4) & 1) || ((data >> 5) & 1)) |
| 428 | coin_out_state = 3; | |
| 426 | state->coin_out_state = 3; | |
| 429 | 427 | } |
| 430 | 428 | |
| 431 | 429 | static WRITE8_HANDLER( peplus_output_bank_b_w ) |
| r10886 | r10887 | |
| 454 | 452 | |
| 455 | 453 | static WRITE8_DEVICE_HANDLER(i2c_nvram_w) |
| 456 | 454 | { |
| 455 | peplus_state *state = device->machine->driver_data<peplus_state>(); | |
| 457 | 456 | i2cmem_scl_write(device,BIT(data, 2)); |
| 458 | sda_dir = BIT(data, 1); | |
| 457 | state->sda_dir = BIT(data, 1); | |
| 459 | 458 | i2cmem_sda_write(device,BIT(data, 0)); |
| 460 | 459 | } |
| 461 | 460 | |
| r10886 | r10887 | |
| 466 | 465 | |
| 467 | 466 | static READ8_HANDLER( peplus_io_r ) |
| 468 | 467 | { |
| 469 | return io_port[offset]; | |
| 468 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 469 | return state->io_port[offset]; | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | static READ8_HANDLER( peplus_duart_r ) |
| r10886 | r10887 | |
| 483 | 483 | |
| 484 | 484 | static READ8_HANDLER( peplus_s3000_r ) |
| 485 | 485 | { |
| 486 | return s3000_ram[offset]; | |
| 486 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 487 | return state->s3000_ram[offset]; | |
| 487 | 488 | } |
| 488 | 489 | |
| 489 | 490 | static READ8_HANDLER( peplus_s5000_r ) |
| 490 | 491 | { |
| 491 | return s5000_ram[offset]; | |
| 492 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 493 | return state->s5000_ram[offset]; | |
| 492 | 494 | } |
| 493 | 495 | |
| 494 | 496 | static READ8_HANDLER( peplus_s7000_r ) |
| 495 | 497 | { |
| 496 | return s7000_ram[offset]; | |
| 498 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 499 | return state->s7000_ram[offset]; | |
| 497 | 500 | } |
| 498 | 501 | |
| 499 | 502 | static READ8_HANDLER( peplus_sb000_r ) |
| 500 | 503 | { |
| 501 | return sb000_ram[offset]; | |
| 504 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 505 | return state->sb000_ram[offset]; | |
| 502 | 506 | } |
| 503 | 507 | |
| 504 | 508 | static READ8_HANDLER( peplus_sd000_r ) |
| 505 | 509 | { |
| 506 | return sd000_ram[offset]; | |
| 510 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 511 | return state->sd000_ram[offset]; | |
| 507 | 512 | } |
| 508 | 513 | |
| 509 | 514 | static READ8_HANDLER( peplus_sf000_r ) |
| 510 | 515 | { |
| 511 | return sf000_ram[offset]; | |
| 516 | peplus_state *state = space->machine->driver_data<peplus_state>(); | |
| 517 | return state->sf000_ram[offset]; | |
| 512 | 518 | } |
| 513 | 519 | |
| 514 | 520 | /* Last Color in Every Palette is bgcolor */ |
| r10886 | r10887 | |
| 529 | 535 | |
| 530 | 536 | static READ8_DEVICE_HANDLER( peplus_input_bank_a_r ) |
| 531 | 537 | { |
| 538 | peplus_state *state = device->machine->driver_data<peplus_state>(); | |
| 532 | 539 | /* |
| 533 | 540 | Bit 0 = COIN DETECTOR A |
| 534 | 541 | Bit 1 = COIN DETECTOR B |
| r10886 | r10887 | |
| 546 | 553 | UINT16 door_wait = 500; |
| 547 | 554 | |
| 548 | 555 | UINT8 sda = 0; |
| 549 | if(!sda_dir) | |
| 556 | if(!state->sda_dir) | |
| 550 | 557 | { |
| 551 | 558 | sda = i2cmem_sda_read(device); |
| 552 | 559 | } |
| 553 | 560 | |
| 554 | if ((input_port_read_safe(device->machine, "SENSOR",0x00) & 0x01) == 0x01 && coin_state == 0) { | |
| 555 | coin_state = 1; // Start Coin Cycle | |
| 556 | last_cycles = device->machine->firstcpu->total_cycles(); | |
| 561 | if ((input_port_read_safe(device->machine, "SENSOR",0x00) & 0x01) == 0x01 && state->coin_state == 0) { | |
| 562 | state->coin_state = 1; // Start Coin Cycle | |
| 563 | state->last_cycles = device->machine->firstcpu->total_cycles(); | |
| 557 | 564 | } else { |
| 558 | 565 | /* Process Next Coin Optic State */ |
| 559 | if (curr_cycles - last_cycles > 600000/6 && coin_state != 0) { | |
| 560 | coin_state++; | |
| 561 | if (coin_state > 5) | |
| 562 | coin_state = 0; | |
| 563 | last_cycles = device->machine->firstcpu->total_cycles(); | |
| 566 | if (curr_cycles - state->last_cycles > 600000/6 && state->coin_state != 0) { | |
| 567 | state->coin_state++; | |
| 568 | if (state->coin_state > 5) | |
| 569 | state->coin_state = 0; | |
| 570 | state->last_cycles = device->machine->firstcpu->total_cycles(); | |
| 564 | 571 | } |
| 565 | 572 | } |
| 566 | 573 | |
| 567 | switch (coin_state) | |
| 574 | switch (state->coin_state) | |
| 568 | 575 | { |
| 569 | 576 | case 0x00: // No Coin |
| 570 | 577 | coin_optics = 0x00; |
| r10886 | r10887 | |
| 586 | 593 | break; |
| 587 | 594 | } |
| 588 | 595 | |
| 589 | if (wingboard) | |
| 596 | if (state->wingboard) | |
| 590 | 597 | door_wait = 12345; |
| 591 | 598 | |
| 592 | if (curr_cycles - last_door > door_wait) { | |
| 599 | if (curr_cycles - state->last_door > door_wait) { | |
| 593 | 600 | if ((input_port_read_safe(device->machine, "DOOR",0xff) & 0x01) == 0x01) { |
| 594 | door_open = (!door_open & 0x01); | |
| 601 | state->door_open = (!state->door_open & 0x01); | |
| 595 | 602 | } else { |
| 596 | door_open = 1; | |
| 603 | state->door_open = 1; | |
| 597 | 604 | } |
| 598 | last_door = device->machine->firstcpu->total_cycles(); | |
| 605 | state->last_door = device->machine->firstcpu->total_cycles(); | |
| 599 | 606 | } |
| 600 | 607 | |
| 601 | if (curr_cycles - last_coin_out > 600000/12 && coin_out_state != 0) { // Guessing with 600000 | |
| 602 | if (coin_out_state != 2) { | |
| 603 | coin_out_state = 2; // Coin-Out Off | |
| 608 | if (curr_cycles - state->last_coin_out > 600000/12 && state->coin_out_state != 0) { // Guessing with 600000 | |
| 609 | if (state->coin_out_state != 2) { | |
| 610 | state->coin_out_state = 2; // Coin-Out Off | |
| 604 | 611 | } else { |
| 605 | coin_out_state = 3; // Coin-Out On | |
| 612 | state->coin_out_state = 3; // Coin-Out On | |
| 606 | 613 | } |
| 607 | 614 | |
| 608 | last_coin_out = device->machine->firstcpu->total_cycles(); | |
| 615 | state->last_coin_out = device->machine->firstcpu->total_cycles(); | |
| 609 | 616 | } |
| 610 | 617 | |
| 611 | switch (coin_out_state) | |
| 618 | switch (state->coin_out_state) | |
| 612 | 619 | { |
| 613 | 620 | case 0x00: // No Coin-Out |
| 614 | 621 | coin_out = 0x00; |
| r10886 | r10887 | |
| 624 | 631 | break; |
| 625 | 632 | } |
| 626 | 633 | |
| 627 | bank_a = (sda<<7) | bank_a | (door_open<<5) | coin_optics | coin_out; | |
| 634 | bank_a = (sda<<7) | bank_a | (state->door_open<<5) | coin_optics | coin_out; | |
| 628 | 635 | |
| 629 | 636 | return bank_a; |
| 630 | 637 | } |
| r10886 | r10887 | |
| 638 | 645 | { |
| 639 | 646 | peplus_state *state = machine->driver_data<peplus_state>(); |
| 640 | 647 | UINT8 *videoram = state->videoram; |
| 641 | int pr = palette_ram[tile_index]; | |
| 642 | int pr2 = palette_ram2[tile_index]; | |
| 648 | int pr = state->palette_ram[tile_index]; | |
| 649 | int pr2 = state->palette_ram2[tile_index]; | |
| 643 | 650 | int vr = videoram[tile_index]; |
| 644 | 651 | |
| 645 | 652 | int code = ((pr & 0x0f)*256) | vr; |
| 646 | 653 | int color = (pr>>4) & 0x0f; |
| 647 | 654 | |
| 648 | 655 | // Access 2nd Half of CGs and CAP |
| 649 | if (jumper_e16_e17 && (pr2 & 0x10) == 0x10) | |
| 656 | if (state->jumper_e16_e17 && (pr2 & 0x10) == 0x10) | |
| 650 | 657 | { |
| 651 | 658 | code += 0x1000; |
| 652 | 659 | color += 0x10; |
| r10886 | r10887 | |
| 657 | 664 | |
| 658 | 665 | static VIDEO_START( peplus ) |
| 659 | 666 | { |
| 660 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25); | |
| 661 | palette_ram = auto_alloc_array(machine, UINT8, 0x3000); | |
| 662 | memset(palette_ram, 0, 0x3000); | |
| 663 | palette_ram2 = auto_alloc_array(machine, UINT8, 0x3000); | |
| 664 | memset(palette_ram2, 0, 0x3000); | |
| 667 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 668 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25); | |
| 669 | state->palette_ram = auto_alloc_array(machine, UINT8, 0x3000); | |
| 670 | memset(state->palette_ram, 0, 0x3000); | |
| 671 | state->palette_ram2 = auto_alloc_array(machine, UINT8, 0x3000); | |
| 672 | memset(state->palette_ram2, 0, 0x3000); | |
| 665 | 673 | } |
| 666 | 674 | |
| 667 | 675 | static SCREEN_UPDATE( peplus ) |
| 668 | 676 | { |
| 669 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 677 | peplus_state *state = screen->machine->driver_data<peplus_state>(); | |
| 678 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 670 | 679 | |
| 671 | 680 | return 0; |
| 672 | 681 | } |
| r10886 | r10887 | |
| 722 | 731 | *************************/ |
| 723 | 732 | |
| 724 | 733 | static ADDRESS_MAP_START( peplus_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 725 | AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE( | |
| 734 | AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE_MEMBER(peplus_state, program_ram) | |
| 726 | 735 | ADDRESS_MAP_END |
| 727 | 736 | |
| 728 | 737 | static ADDRESS_MAP_START( peplus_iomap, ADDRESS_SPACE_IO, 8 ) |
| r10886 | r10887 | |
| 736 | 745 | AM_RANGE(0x2083, 0x2083) AM_DEVREADWRITE("crtc", mc6845_register_r, peplus_crtc_display_w) |
| 737 | 746 | |
| 738 | 747 | // Superboard Data |
| 739 | AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE( | |
| 748 | AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE_MEMBER(peplus_state, s3000_ram) | |
| 740 | 749 | |
| 741 | 750 | // Sound and Dipswitches |
| 742 | 751 | AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("aysnd", ay8910_address_w) |
| 743 | 752 | AM_RANGE(0x4004, 0x4004) AM_READ_PORT("SW1")/* likely ay8910 input port, not direct */ AM_DEVWRITE("aysnd", ay8910_data_w) |
| 744 | 753 | |
| 745 | 754 | // Superboard Data |
| 746 | AM_RANGE(0x5000, 0x5fff) AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_BASE( | |
| 755 | AM_RANGE(0x5000, 0x5fff) AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_BASE_MEMBER(peplus_state, s5000_ram) | |
| 747 | 756 | |
| 748 | 757 | // Background Color Latch |
| 749 | 758 | AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w) |
| r10886 | r10887 | |
| 752 | 761 | AM_RANGE(0x06001, 0x06400) AM_RAM AM_BASE_MEMBER(peplus_state, videoram) |
| 753 | 762 | |
| 754 | 763 | // Superboard Data |
| 755 | AM_RANGE(0x7000, 0x7fff) AM_READWRITE(peplus_s7000_r, peplus_s7000_w) AM_BASE( | |
| 764 | AM_RANGE(0x7000, 0x7fff) AM_READWRITE(peplus_s7000_r, peplus_s7000_w) AM_BASE_MEMBER(peplus_state, s7000_ram) | |
| 756 | 765 | |
| 757 | 766 | // Input Bank A, Output Bank C |
| 758 | 767 | AM_RANGE(0x8000, 0x8000) AM_DEVREAD("i2cmem",peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w) |
| r10886 | r10887 | |
| 764 | 773 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_WRITE(peplus_output_bank_b_w) |
| 765 | 774 | |
| 766 | 775 | // Superboard Data |
| 767 | AM_RANGE(0xb000, 0xbfff) AM_READWRITE(peplus_sb000_r, peplus_sb000_w) AM_BASE( | |
| 776 | AM_RANGE(0xb000, 0xbfff) AM_READWRITE(peplus_sb000_r, peplus_sb000_w) AM_BASE_MEMBER(peplus_state, sb000_ram) | |
| 768 | 777 | |
| 769 | 778 | // Output Bank A |
| 770 | 779 | AM_RANGE(0xc000, 0xc000) AM_READ(peplus_watchdog_r) AM_WRITE(peplus_output_bank_a_w) |
| 771 | 780 | |
| 772 | 781 | // Superboard Data |
| 773 | AM_RANGE(0xd000, 0xdfff) AM_READWRITE(peplus_sd000_r, peplus_sd000_w) AM_BASE( | |
| 782 | AM_RANGE(0xd000, 0xdfff) AM_READWRITE(peplus_sd000_r, peplus_sd000_w) AM_BASE_MEMBER(peplus_state, sd000_ram) | |
| 774 | 783 | |
| 775 | 784 | // DUART |
| 776 | 785 | AM_RANGE(0xe000, 0xe00f) AM_READWRITE(peplus_duart_r, peplus_duart_w) |
| 777 | 786 | |
| 778 | 787 | // Superboard Data |
| 779 | AM_RANGE(0xf000, 0xffff) AM_READWRITE(peplus_sf000_r, peplus_sf000_w) AM_BASE( | |
| 788 | AM_RANGE(0xf000, 0xffff) AM_READWRITE(peplus_sf000_r, peplus_sf000_w) AM_BASE_MEMBER(peplus_state, sf000_ram) | |
| 780 | 789 | |
| 781 | 790 | /* Ports start here */ |
| 782 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_BASE( | |
| 791 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_BASE_MEMBER(peplus_state, io_port) | |
| 783 | 792 | ADDRESS_MAP_END |
| 784 | 793 | |
| 785 | 794 | |
| r10886 | r10887 | |
| 987 | 996 | |
| 988 | 997 | static MACHINE_RESET( peplus ) |
| 989 | 998 | { |
| 990 | /* | |
| 991 | AutoHold Feature Currently Disabled | |
| 999 | /* AutoHold Feature Currently Disabled */ | |
| 1000 | #if 0 | |
| 1001 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 992 | 1002 | |
| 993 | // pepp0158 | |
| 994 | program_ram[0xa19f] = 0x22; // RET - Disable Memory Test | |
| 995 | program_ram[0xddea] = 0x22; // RET - Disable Program Checksum | |
| 996 | autohold_addr = 0x5ffe; // AutoHold Address | |
| 1003 | // pepp0158 | |
| 1004 | state->program_ram[0xa19f] = 0x22; // RET - Disable Memory Test | |
| 1005 | state->program_ram[0xddea] = 0x22; // RET - Disable Program Checksum | |
| 1006 | state->autohold_addr = 0x5ffe; // AutoHold Address | |
| 997 | 1007 | |
| 998 | // pepp0188 | |
| 999 | program_ram[0x9a8d] = 0x22; // RET - Disable Memory Test | |
| 1000 | program_ram[0xf429] = 0x22; // RET - Disable Program Checksum | |
| 1001 | autohold_addr = 0x742f; // AutoHold Address | |
| 1008 | // pepp0188 | |
| 1009 | state->program_ram[0x9a8d] = 0x22; // RET - Disable Memory Test | |
| 1010 | state->program_ram[0xf429] = 0x22; // RET - Disable Program Checksum | |
| 1011 | state->autohold_addr = 0x742f; // AutoHold Address | |
| 1002 | 1012 | |
| 1003 | // pepp0516 | |
| 1004 | program_ram[0x9a24] = 0x22; // RET - Disable Memory Test | |
| 1005 | program_ram[0xd61d] = 0x22; // RET - Disable Program Checksum | |
| 1006 | autohold_addr = 0x5e7e; // AutoHold Address | |
| 1013 | // pepp0516 | |
| 1014 | state->program_ram[0x9a24] = 0x22; // RET - Disable Memory Test | |
| 1015 | state->program_ram[0xd61d] = 0x22; // RET - Disable Program Checksum | |
| 1016 | state->autohold_addr = 0x5e7e; // AutoHold Address | |
| 1007 | 1017 | |
| 1008 | if (autohold_addr) | |
| 1009 | program_ram[autohold_addr] = input_port_read_safe(machine, "AUTOHOLD",0x00) & 0x01; | |
| 1010 | */ | |
| 1018 | if (state->autohold_addr) | |
| 1019 | state->program_ram[state->autohold_addr] = input_port_read_safe(machine, "AUTOHOLD",0x00) & 0x01; | |
| 1020 | #endif | |
| 1011 | 1021 | } |
| 1012 | 1022 | |
| 1013 | 1023 | |
| r10886 | r10887 | |
| 1056 | 1066 | /* Normal board */ |
| 1057 | 1067 | static void peplus_init(running_machine *machine) |
| 1058 | 1068 | { |
| 1069 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 1059 | 1070 | /* default : no address to patch in program RAM to enable autohold feature */ |
| 1060 | autohold_addr = 0; | |
| 1071 | state->autohold_addr = 0; | |
| 1061 | 1072 | } |
| 1062 | 1073 | |
| 1063 | 1074 | |
| r10886 | r10887 | |
| 1068 | 1079 | /* Normal board */ |
| 1069 | 1080 | static DRIVER_INIT( peplus ) |
| 1070 | 1081 | { |
| 1071 | wingboard = FALSE; | |
| 1072 | jumper_e16_e17 = FALSE; | |
| 1082 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 1083 | state->wingboard = FALSE; | |
| 1084 | state->jumper_e16_e17 = FALSE; | |
| 1073 | 1085 | peplus_init(machine); |
| 1074 | 1086 | } |
| 1075 | 1087 | |
| 1076 | 1088 | /* Superboard */ |
| 1077 | 1089 | static DRIVER_INIT( peplussb ) |
| 1078 | 1090 | { |
| 1079 | wingboard = FALSE; | |
| 1080 | jumper_e16_e17 = FALSE; | |
| 1091 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 1092 | state->wingboard = FALSE; | |
| 1093 | state->jumper_e16_e17 = FALSE; | |
| 1081 | 1094 | peplus_load_superdata(machine, "user1"); |
| 1082 | 1095 | |
| 1083 | 1096 | peplus_init(machine); |
| r10886 | r10887 | |
| 1086 | 1099 | /* Superboard with Attached Wingboard */ |
| 1087 | 1100 | static DRIVER_INIT( peplussbw ) |
| 1088 | 1101 | { |
| 1089 | wingboard = TRUE; | |
| 1090 | jumper_e16_e17 = TRUE; | |
| 1102 | peplus_state *state = machine->driver_data<peplus_state>(); | |
| 1103 | state->wingboard = TRUE; | |
| 1104 | state->jumper_e16_e17 = TRUE; | |
| 1091 | 1105 | peplus_load_superdata(machine, "user1"); |
| 1092 | 1106 | |
| 1093 | 1107 | peplus_init(machine); |
| r10886 | r10887 | |
|---|---|---|
| 24 | 24 | Execution timing of the Z80 is important because it maintains music tempo |
| 25 | 25 | by polling the 2203's second timer. Even when working alone with no |
| 26 | 26 | context-switch the chip shouldn't be running at 1.5MHz otherwise it won't |
| 27 | keep the right pace. Similar Kon | |
| 27 | keep the right pace. Similar Kon | |
| 28 | 28 | battlnts, flkatck...etc.) all have a 3.579545MHz Z80 for sound. |
| 29 | 29 | |
| 30 | 30 | In spite of adjusting clock speed polling is deemed inaccurate when |
| r10886 | r10887 | |
|---|---|---|
| 97 | 97 | #include "machine/nvram.h" |
| 98 | 98 | |
| 99 | 99 | |
| 100 | class jokrwild_state : public driver_device | |
| 101 | { | |
| 102 | public: | |
| 103 | jokrwild_state(running_machine &machine, const driver_device_config_base &config) | |
| 104 | : driver_device(machine, config) { } | |
| 105 | ||
| 106 | UINT8 *videoram; | |
| 107 | UINT8 *colorram; | |
| 108 | tilemap_t *bg_tilemap; | |
| 109 | }; | |
| 110 | ||
| 111 | ||
| 100 | 112 | /************************* |
| 101 | 113 | * Video Hardware * |
| 102 | 114 | *************************/ |
| 103 | 115 | |
| 104 | static UINT8 *videoram; | |
| 105 | static UINT8 *colorram; | |
| 106 | static tilemap_t *bg_tilemap; | |
| 107 | 116 | |
| 108 | ||
| 109 | 117 | static WRITE8_HANDLER( jokrwild_videoram_w ) |
| 110 | 118 | { |
| 111 | videoram[offset] = data; | |
| 112 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 119 | jokrwild_state *state = space->machine->driver_data<jokrwild_state>(); | |
| 120 | state->videoram[offset] = data; | |
| 121 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 113 | 122 | } |
| 114 | 123 | |
| 115 | 124 | |
| 116 | 125 | static WRITE8_HANDLER( jokrwild_colorram_w ) |
| 117 | 126 | { |
| 118 | colorram[offset] = data; | |
| 119 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 127 | jokrwild_state *state = space->machine->driver_data<jokrwild_state>(); | |
| 128 | state->colorram[offset] = data; | |
| 129 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 120 | 130 | } |
| 121 | 131 | |
| 122 | 132 | |
| 123 | 133 | static TILE_GET_INFO( get_bg_tile_info ) |
| 124 | 134 | { |
| 135 | jokrwild_state *state = machine->driver_data<jokrwild_state>(); | |
| 125 | 136 | /* - bits - |
| 126 | 137 | 7654 3210 |
| 127 | 138 | xx-- ---- bank select. |
| 128 | 139 | ---- xxxx color code. |
| 129 | 140 | */ |
| 130 | int attr = colorram[tile_index]; | |
| 131 | int code = videoram[tile_index] | ((attr & 0xc0) << 2); | |
| 141 | int attr = state->colorram[tile_index]; | |
| 142 | int code = state->videoram[tile_index] | ((attr & 0xc0) << 2); | |
| 132 | 143 | int color = (attr & 0x0f); |
| 133 | 144 | |
| 134 | 145 | SET_TILE_INFO( 0, code , color , 0); |
| r10886 | r10887 | |
| 137 | 148 | |
| 138 | 149 | static VIDEO_START( jokrwild ) |
| 139 | 150 | { |
| 140 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 26); | |
| 151 | jokrwild_state *state = machine->driver_data<jokrwild_state>(); | |
| 152 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 26); | |
| 141 | 153 | } |
| 142 | 154 | |
| 143 | 155 | |
| 144 | 156 | static SCREEN_UPDATE( jokrwild ) |
| 145 | 157 | { |
| 146 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 158 | jokrwild_state *state = screen->machine->driver_data<jokrwild_state>(); | |
| 159 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 147 | 160 | return 0; |
| 148 | 161 | } |
| 149 | 162 | |
| r10886 | r10887 | |
| 179 | 192 | *************************/ |
| 180 | 193 | |
| 181 | 194 | static ADDRESS_MAP_START( jokrwild_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 182 | AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(jokrwild_videoram_w) AM_BASE( | |
| 195 | AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(jokrwild_videoram_w) AM_BASE_MEMBER(jokrwild_state, videoram) | |
| 183 | 196 | AM_RANGE(0x0400, 0x07ff) AM_RAM //FIXME: backup RAM |
| 184 | AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(jokrwild_colorram_w) AM_BASE( | |
| 197 | AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(jokrwild_colorram_w) AM_BASE_MEMBER(jokrwild_state, colorram) | |
| 185 | 198 | AM_RANGE(0x2400, 0x27ff) AM_RAM //stack RAM |
| 186 | 199 | AM_RANGE(0x4004, 0x4007) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w) |
| 187 | 200 | AM_RANGE(0x4008, 0x400b) AM_DEVREADWRITE("pia1", pia6821_r, pia6821_w) //optical sensor is here |
| r10886 | r10887 | |
| 455 | 468 | * Machine Drivers * |
| 456 | 469 | *************************/ |
| 457 | 470 | |
| 458 | static MACHINE_CONFIG_START( jokrwild, | |
| 471 | static MACHINE_CONFIG_START( jokrwild, jokrwil | |
| 459 | 472 | |
| 460 | 473 | /* basic machine hardware */ |
| 461 | 474 | MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/2) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 14 | 14 | #include "cpu/z80/z80.h" |
| 15 | 15 | #include "sound/ay8910.h" |
| 16 | 16 | |
| 17 | static UINT8 *poker72_vram,*poker72_pal; | |
| 18 | static UINT8 tile_bank; | |
| 19 | 17 | |
| 18 | class poker72_state : public driver_device | |
| 19 | { | |
| 20 | public: | |
| 21 | poker72_state(running_machine &machine, const driver_device_config_base &config) | |
| 22 | : driver_device(machine, config) { } | |
| 23 | ||
| 24 | UINT8 *vram; | |
| 25 | UINT8 *pal; | |
| 26 | UINT8 tile_bank; | |
| 27 | }; | |
| 28 | ||
| 29 | ||
| 20 | 30 | static VIDEO_START(poker72) |
| 21 | 31 | { |
| 22 | ||
| 23 | 32 | } |
| 24 | 33 | |
| 25 | 34 | static SCREEN_UPDATE(poker72) |
| 26 | 35 | { |
| 36 | poker72_state *state = screen->machine->driver_data<poker72_state>(); | |
| 27 | 37 | int x,y,count; |
| 28 | 38 | |
| 29 | 39 | count = 0; |
| r10886 | r10887 | |
| 32 | 42 | { |
| 33 | 43 | for (x=0;x<64;x++) |
| 34 | 44 | { |
| 35 | int tile = ((poker72_vram[count+1] & 0x0f) << 8 ) | (poker72_vram[count+0] & 0xff); //TODO: tile bank | |
| 36 | int fx = (poker72_vram[count+1] & 0x10); | |
| 37 | int fy = (poker72_vram[count+1] & 0x20); | |
| 38 | int color = (poker72_vram[count+1] & 0xc0) >> 6; | |
| 45 | int tile = ((state->vram[count+1] & 0x0f) << 8 ) | (state->vram[count+0] & 0xff); //TODO: tile bank | |
| 46 | int fx = (state->vram[count+1] & 0x10); | |
| 47 | int fy = (state->vram[count+1] & 0x20); | |
| 48 | int color = (state->vram[count+1] & 0xc0) >> 6; | |
| 39 | 49 | |
| 40 | tile|= tile_bank << 12; | |
| 50 | tile|= state->tile_bank << 12; | |
| 41 | 51 | |
| 42 | 52 | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,fx,fy,x*8,y*8); |
| 43 | 53 | |
| r10886 | r10887 | |
| 50 | 60 | |
| 51 | 61 | static WRITE8_HANDLER( poker72_paletteram_w ) |
| 52 | 62 | { |
| 63 | poker72_state *state = space->machine->driver_data<poker72_state>(); | |
| 53 | 64 | int r,g,b; |
| 54 | | |
| 65 | state-> | |
| 55 | 66 | |
| 56 | r = poker72_pal[(offset & 0x3ff)+0x000] & 0x3f; | |
| 57 | g = poker72_pal[(offset & 0x3ff)+0x400] & 0x3f; | |
| 58 | b = poker72_pal[(offset & 0x3ff)+0x800] & 0x3f; | |
| 67 | r = state->pal[(offset & 0x3ff)+0x000] & 0x3f; | |
| 68 | g = state->pal[(offset & 0x3ff)+0x400] & 0x3f; | |
| 69 | b = state->pal[(offset & 0x3ff)+0x800] & 0x3f; | |
| 59 | 70 | |
| 60 | 71 | palette_set_color_rgb( space->machine, offset & 0x3ff, pal6bit(r), pal6bit(g), pal6bit(b)); |
| 61 | 72 | } |
| r10886 | r10887 | |
| 77 | 88 | |
| 78 | 89 | static WRITE8_HANDLER( tile_bank_w ) |
| 79 | 90 | { |
| 80 | tile_bank = (data & 4) >> 2; | |
| 91 | poker72_state *state = space->machine->driver_data<poker72_state>(); | |
| 92 | state->tile_bank = (data & 4) >> 2; | |
| 81 | 93 | } |
| 82 | 94 | |
| 83 | 95 | static ADDRESS_MAP_START( poker72_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 84 | 96 | AM_RANGE(0x0000, 0xbfff) AM_ROMBANK("bank1") |
| 85 | 97 | AM_RANGE(0xc000, 0xdfff) AM_RAM //work ram |
| 86 | AM_RANGE(0xe000, 0xefff) AM_RAM AM_BASE(&poker72_vram) | |
| 87 | AM_RANGE(0xf000, 0xfbff) AM_RAM_WRITE(poker72_paletteram_w) AM_BASE(&poker72_pal) | |
| 98 | AM_RANGE(0xe000, 0xefff) AM_RAM AM_BASE_MEMBER(poker72_state, vram) | |
| 99 | AM_RANGE(0xf000, 0xfbff) AM_RAM_WRITE(poker72_paletteram_w) AM_BASE_MEMBER(poker72_state, pal) | |
| 88 | 100 | AM_RANGE(0xfc00, 0xfdff) AM_RAM //??? |
| 89 | 101 | AM_RANGE(0xfe08, 0xfe08) AM_READ_PORT("IN0") |
| 90 | 102 | AM_RANGE(0xfe09, 0xfe09) AM_READ_PORT("IN1") |
| r10886 | r10887 | |
| 329 | 341 | memory_set_bankptr(machine, "bank1", &ROM[0]); |
| 330 | 342 | } |
| 331 | 343 | |
| 332 | static MACHINE_CONFIG_START( poker72, | |
| 344 | static MACHINE_CONFIG_START( poker72, pok | |
| 333 | 345 | |
| 334 | 346 | |
| 335 | 347 | /* basic machine hardware */ |
| r10886 | r10887 | |
|---|---|---|
| 73 | 73 | #include "machine/pckeybrd.h" |
| 74 | 74 | #include "machine/idectrl.h" |
| 75 | 75 | |
| 76 | static void ide_interrupt(device_t *device, int state); | |
| 77 | 76 | |
| 78 | static UINT32 *cga_ram; | |
| 79 | static UINT32 *bios_ram; | |
| 77 | class gamecstl_state : public driver_device | |
| 78 | { | |
| 79 | public: | |
| 80 | gamecstl_state(running_machine &machine, const driver_device_config_base &config) | |
| 81 | : driver_device(machine, config) { } | |
| 80 | 82 | |
| 81 | static struct { | |
| 83 | UINT32 *cga_ram; | |
| 84 | UINT32 *bios_ram; | |
| 85 | UINT8 mxtc_config_reg[256]; | |
| 86 | UINT8 piix4_config_reg[4][256]; | |
| 87 | int dma_channel; | |
| 88 | UINT8 dma_offset[2][4]; | |
| 89 | UINT8 at_pages[0x10]; | |
| 90 | ||
| 82 | 91 | device_t *pit8254; |
| 83 | 92 | device_t *pic8259_1; |
| 84 | 93 | device_t *pic8259_2; |
| 85 | 94 | device_t *dma8237_1; |
| 86 | 95 | device_t *dma8237_2; |
| 87 | } | |
| 96 | } | |
| 88 | 97 | |
| 89 | 98 | |
| 99 | static void ide_interrupt(device_t *device, int state); | |
| 100 | ||
| 101 | ||
| 90 | 102 | static const rgb_t cga_palette[16] = |
| 91 | 103 | { |
| 92 | 104 | MAKE_RGB( 0x00, 0x00, 0x00 ), MAKE_RGB( 0x00, 0x00, 0xaa ), MAKE_RGB( 0x00, 0xaa, 0x00 ), MAKE_RGB( 0x00, 0xaa, 0xaa ), |
| r10886 | r10887 | |
| 126 | 138 | |
| 127 | 139 | static SCREEN_UPDATE(gamecstl) |
| 128 | 140 | { |
| 141 | gamecstl_state *state = screen->machine->driver_data<gamecstl_state>(); | |
| 129 | 142 | int i, j; |
| 130 | 143 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 131 | UINT32 *cga = cga_ram; | |
| 144 | UINT32 *cga = state->cga_ram; | |
| 132 | 145 | int index = 0; |
| 133 | 146 | |
| 134 | 147 | bitmap_fill(bitmap, cliprect, 0); |
| r10886 | r10887 | |
| 173 | 186 | |
| 174 | 187 | |
| 175 | 188 | // Intel 82439TX System Controller (MXTC) |
| 176 | static UINT8 mxtc_config_reg[256]; | |
| 177 | 189 | |
| 178 | 190 | static UINT8 mxtc_config_r(device_t *busdevice, device_t *device, int function, int reg) |
| 179 | 191 | { |
| 192 | gamecstl_state *state = busdevice->machine->driver_data<gamecstl_state>(); | |
| 180 | 193 | // mame_printf_debug("MXTC: read %d, %02X\n", function, reg); |
| 181 | 194 | |
| 182 | return mxtc_config_reg[reg]; | |
| 195 | return state->mxtc_config_reg[reg]; | |
| 183 | 196 | } |
| 184 | 197 | |
| 185 | 198 | static void mxtc_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data) |
| 186 | 199 | { |
| 200 | gamecstl_state *state = busdevice->machine->driver_data<gamecstl_state>(); | |
| 187 | 201 | // mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", busdevice->machine->describe_context(), function, reg, data); |
| 188 | 202 | |
| 189 | 203 | switch(reg) |
| r10886 | r10887 | |
| 192 | 206 | { |
| 193 | 207 | if (data & 0x10) // enable RAM access to region 0xf0000 - 0xfffff |
| 194 | 208 | { |
| 195 | memory_set_bankptr(busdevice->machine, "bank1", bios_ram); | |
| 209 | memory_set_bankptr(busdevice->machine, "bank1", state->bios_ram); | |
| 196 | 210 | } |
| 197 | 211 | else // disable RAM access (reads go to BIOS ROM) |
| 198 | 212 | { |
| r10886 | r10887 | |
| 202 | 216 | } |
| 203 | 217 | } |
| 204 | 218 | |
| 205 | mxtc_config_reg[reg] = data; | |
| 219 | state->mxtc_config_reg[reg] = data; | |
| 206 | 220 | } |
| 207 | 221 | |
| 208 | static void intel82439tx_init( | |
| 222 | static void intel82439tx_init(running_machine *machine) | |
| 209 | 223 | { |
| 210 | mxtc_config_reg[0x60] = 0x02; | |
| 211 | mxtc_config_reg[0x61] = 0x02; | |
| 212 | mxtc_config_reg[0x62] = 0x02; | |
| 213 | mxtc_config_reg[0x63] = 0x02; | |
| 214 | mxtc_config_reg[0x64] = 0x02; | |
| 215 | mxtc_config_reg[0x65] = 0x02; | |
| 224 | gamecstl_state *state = machine->driver_data<gamecstl_state>(); | |
| 225 | state->mxtc_config_reg[0x60] = 0x02; | |
| 226 | state->mxtc_config_reg[0x61] = 0x02; | |
| 227 | state->mxtc_config_reg[0x62] = 0x02; | |
| 228 | state->mxtc_config_reg[0x63] = 0x02; | |
| 229 | state->mxtc_config_reg[0x64] = 0x02; | |
| 230 | state->mxtc_config_reg[0x65] = 0x02; | |
| 216 | 231 | } |
| 217 | 232 | |
| 218 | 233 | static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) |
| r10886 | r10887 | |
| 258 | 273 | } |
| 259 | 274 | |
| 260 | 275 | // Intel 82371AB PCI-to-ISA / IDE bridge (PIIX4) |
| 261 | static UINT8 piix4_config_reg[4][256]; | |
| 262 | 276 | |
| 263 | 277 | static UINT8 piix4_config_r(device_t *busdevice, device_t *device, int function, int reg) |
| 264 | 278 | { |
| 279 | gamecstl_state *state = busdevice->machine->driver_data<gamecstl_state>(); | |
| 265 | 280 | // mame_printf_debug("PIIX4: read %d, %02X\n", function, reg); |
| 266 | return piix4_config_reg[function][reg]; | |
| 281 | return state->piix4_config_reg[function][reg]; | |
| 267 | 282 | } |
| 268 | 283 | |
| 269 | 284 | static void piix4_config_w(device_t *busdevice, device_t *device, int function, int reg, UINT8 data) |
| 270 | 285 | { |
| 286 | gamecstl_state *state = busdevice->machine->driver_data<gamecstl_state>(); | |
| 271 | 287 | // mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", busdevice->machine->describe_context(), function, reg, data); |
| 272 | piix4_config_reg[function][reg] = data; | |
| 288 | state->piix4_config_reg[function][reg] = data; | |
| 273 | 289 | } |
| 274 | 290 | |
| 275 | 291 | static UINT32 intel82371ab_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) |
| r10886 | r10887 | |
| 358 | 374 | |
| 359 | 375 | static WRITE32_HANDLER(bios_ram_w) |
| 360 | 376 | { |
| 361 | if (mxtc_config_reg[0x59] & 0x20) // write to RAM if this region is write-enabled | |
| 377 | gamecstl_state *state = space->machine->driver_data<gamecstl_state>(); | |
| 378 | if (state->mxtc_config_reg[0x59] & 0x20) // write to RAM if this region is write-enabled | |
| 362 | 379 | { |
| 363 | COMBINE_DATA(bios_ram + offset); | |
| 380 | COMBINE_DATA(state->bios_ram + offset); | |
| 364 | 381 | } |
| 365 | 382 | } |
| 366 | 383 | |
| r10886 | r10887 | |
| 371 | 388 | * |
| 372 | 389 | *************************************************************************/ |
| 373 | 390 | |
| 374 | static int dma_channel; | |
| 375 | static UINT8 dma_offset[2][4]; | |
| 376 | static UINT8 at_pages[0x10]; | |
| 377 | 391 | |
| 378 | 392 | |
| 379 | 393 | static READ8_HANDLER(at_page8_r) |
| 380 | 394 | { |
| 381 | UINT8 data = at_pages[offset % 0x10]; | |
| 395 | gamecstl_state *state = space->machine->driver_data<gamecstl_state>(); | |
| 396 | UINT8 data = state->at_pages[offset % 0x10]; | |
| 382 | 397 | |
| 383 | 398 | switch(offset % 8) |
| 384 | 399 | { |
| 385 | 400 | case 1: |
| 386 | data = dma_offset[(offset / 8) & 1][2]; | |
| 401 | data = state->dma_offset[(offset / 8) & 1][2]; | |
| 387 | 402 | break; |
| 388 | 403 | case 2: |
| 389 | data = dma_offset[(offset / 8) & 1][3]; | |
| 404 | data = state->dma_offset[(offset / 8) & 1][3]; | |
| 390 | 405 | break; |
| 391 | 406 | case 3: |
| 392 | data = dma_offset[(offset / 8) & 1][1]; | |
| 407 | data = state->dma_offset[(offset / 8) & 1][1]; | |
| 393 | 408 | break; |
| 394 | 409 | case 7: |
| 395 | data = dma_offset[(offset / 8) & 1][0]; | |
| 410 | data = state->dma_offset[(offset / 8) & 1][0]; | |
| 396 | 411 | break; |
| 397 | 412 | } |
| 398 | 413 | return data; |
| r10886 | r10887 | |
| 401 | 416 | |
| 402 | 417 | static WRITE8_HANDLER(at_page8_w) |
| 403 | 418 | { |
| 404 | at_pages[offset % 0x10] = data; | |
| 419 | gamecstl_state *state = space->machine->driver_data<gamecstl_state>(); | |
| 420 | state->at_pages[offset % 0x10] = data; | |
| 405 | 421 | |
| 406 | 422 | switch(offset % 8) |
| 407 | 423 | { |
| 408 | 424 | case 1: |
| 409 | dma_offset[(offset / 8) & 1][2] = data; | |
| 425 | state->dma_offset[(offset / 8) & 1][2] = data; | |
| 410 | 426 | break; |
| 411 | 427 | case 2: |
| 412 | dma_offset[(offset / 8) & 1][3] = data; | |
| 428 | state->dma_offset[(offset / 8) & 1][3] = data; | |
| 413 | 429 | break; |
| 414 | 430 | case 3: |
| 415 | dma_offset[(offset / 8) & 1][1] = data; | |
| 431 | state->dma_offset[(offset / 8) & 1][1] = data; | |
| 416 | 432 | break; |
| 417 | 433 | case 7: |
| 418 | dma_offset[(offset / 8) & 1][0] = data; | |
| 434 | state->dma_offset[(offset / 8) & 1][0] = data; | |
| 419 | 435 | break; |
| 420 | 436 | } |
| 421 | 437 | } |
| r10886 | r10887 | |
| 432 | 448 | |
| 433 | 449 | static READ8_HANDLER( pc_dma_read_byte ) |
| 434 | 450 | { |
| 435 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 451 | gamecstl_state *state = space->machine->driver_data<gamecstl_state>(); | |
| 452 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 436 | 453 | & 0xFF0000; |
| 437 | 454 | |
| 438 | 455 | return space->read_byte(page_offset + offset); |
| r10886 | r10887 | |
| 441 | 458 | |
| 442 | 459 | static WRITE8_HANDLER( pc_dma_write_byte ) |
| 443 | 460 | { |
| 444 | offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16) | |
| 461 | gamecstl_state *state = space->machine->driver_data<gamecstl_state>(); | |
| 462 | offs_t page_offset = (((offs_t) state->dma_offset[0][state->dma_channel]) << 16) | |
| 445 | 463 | & 0xFF0000; |
| 446 | 464 | |
| 447 | 465 | space->write_byte(page_offset + offset, data); |
| r10886 | r10887 | |
| 449 | 467 | |
| 450 | 468 | static void set_dma_channel(device_t *device, int channel, int state) |
| 451 | 469 | { |
| 452 | if (!state) dma_channel = channel; | |
| 470 | gamecstl_state *drvstate = device->machine->driver_data<gamecstl_state>(); | |
| 471 | if (!state) drvstate->dma_channel = channel; | |
| 453 | 472 | } |
| 454 | 473 | |
| 455 | 474 | static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); } |
| r10886 | r10887 | |
| 496 | 515 | static ADDRESS_MAP_START( gamecstl_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 497 | 516 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAM |
| 498 | 517 | AM_RANGE(0x000a0000, 0x000affff) AM_RAM |
| 499 | AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE( | |
| 518 | AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE_MEMBER(gamecstl_state, cga_ram) | |
| 500 | 519 | AM_RANGE(0x000e0000, 0x000effff) AM_RAM |
| 501 | 520 | AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bank1") |
| 502 | 521 | AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w) |
| r10886 | r10887 | |
| 583 | 602 | |
| 584 | 603 | static IRQ_CALLBACK(irq_callback) |
| 585 | 604 | { |
| 605 | gamecstl_state *state = device->machine->driver_data<gamecstl_state>(); | |
| 586 | 606 | int r = 0; |
| 587 | r = pic8259_acknowledge( | |
| 607 | r = pic8259_acknowledge( | |
| 588 | 608 | if (r==0) |
| 589 | 609 | { |
| 590 | r = pic8259_acknowledge( | |
| 610 | r = pic8259_acknowledge( | |
| 591 | 611 | } |
| 592 | 612 | return r; |
| 593 | 613 | } |
| 594 | 614 | |
| 595 | 615 | static MACHINE_START(gamecstl) |
| 596 | 616 | { |
| 597 | gamecstl_devices.pit8254 = machine->device( "pit8254" ); | |
| 598 | gamecstl_devices.pic8259_1 = machine->device( "pic8259_1" ); | |
| 599 | gamecstl_devices.pic8259_2 = machine->device( "pic8259_2" ); | |
| 600 | gamecstl_devices.dma8237_1 = machine->device( "dma8237_1" ); | |
| 601 | gamecstl_devices.dma8237_2 = machine->device( "dma8237_2" ); | |
| 617 | gamecstl_state *state = machine->driver_data<gamecstl_state>(); | |
| 618 | state->pit8254 = machine->device( "pit8254" ); | |
| 619 | state->pic8259_1 = machine->device( "pic8259_1" ); | |
| 620 | state->pic8259_2 = machine->device( "pic8259_2" ); | |
| 621 | state->dma8237_1 = machine->device( "dma8237_1" ); | |
| 622 | state->dma8237_2 = machine->device( "dma8237_2" ); | |
| 602 | 623 | } |
| 603 | 624 | |
| 604 | 625 | static MACHINE_RESET(gamecstl) |
| r10886 | r10887 | |
| 656 | 677 | } |
| 657 | 678 | }; |
| 658 | 679 | |
| 659 | static MACHINE_CONFIG_START( gamecstl, | |
| 680 | static MACHINE_CONFIG_START( gamecstl, gam | |
| 660 | 681 | |
| 661 | 682 | /* basic machine hardware */ |
| 662 | 683 | MCFG_CPU_ADD("maincpu", PENTIUM, 200000000) |
| r10886 | r10887 | |
| 707 | 728 | |
| 708 | 729 | static void keyboard_interrupt(running_machine *machine, int state) |
| 709 | 730 | { |
| 710 | pic8259_ir1_w(gamecstl_devices.pic8259_1, state); | |
| 731 | gamecstl_state *drvstate = machine->driver_data<gamecstl_state>(); | |
| 732 | pic8259_ir1_w(drvstate->pic8259_1, state); | |
| 711 | 733 | } |
| 712 | 734 | |
| 713 | 735 | static void ide_interrupt(device_t *device, int state) |
| 714 | 736 | { |
| 715 | pic8259_ir6_w(gamecstl_devices.pic8259_2, state); | |
| 737 | gamecstl_state *drvstate = device->machine->driver_data<gamecstl_state>(); | |
| 738 | pic8259_ir6_w(drvstate->pic8259_2, state); | |
| 716 | 739 | } |
| 717 | 740 | |
| 718 | 741 | static int gamecstl_get_out2(running_machine *machine) |
| 719 | 742 | { |
| 720 | return pit8253_get_output( gamecstl_devices.pit8254, 2 ); | |
| 743 | gamecstl_state *state = machine->driver_data<gamecstl_state>(); | |
| 744 | return pit8253_get_output( state->pit8254, 2 ); | |
| 721 | 745 | } |
| 722 | 746 | |
| 723 | 747 | static const struct kbdc8042_interface at8042 = |
| r10886 | r10887 | |
| 727 | 751 | |
| 728 | 752 | static void gamecstl_set_keyb_int(running_machine *machine, int state) |
| 729 | 753 | { |
| 730 | pic8259_ir1_w(gamecstl_devices.pic8259_1, state); | |
| 754 | gamecstl_state *drvstate = machine->driver_data<gamecstl_state>(); | |
| 755 | pic8259_ir1_w(drvstate->pic8259_1, state); | |
| 731 | 756 | } |
| 732 | 757 | |
| 733 | 758 | static DRIVER_INIT( gamecstl ) |
| 734 | 759 | { |
| 735 | bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 760 | gamecstl_state *state = machine->driver_data<gamecstl_state>(); | |
| 761 | state->bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); | |
| 736 | 762 | |
| 737 | 763 | init_pc_common(machine, PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int); |
| 738 | 764 | |
| 739 | intel82439tx_init(); | |
| 765 | intel82439tx_init(machine); | |
| 740 | 766 | |
| 741 | 767 | kbdc8042_init(machine, &at8042); |
| 742 | 768 | } |
| r10886 | r10887 | |
|---|---|---|
| 25 | 25 | #include "machine/nvram.h" |
| 26 | 26 | |
| 27 | 27 | |
| 28 | #define NUM_PENS (8) | |
| 28 | class wldarrow_state : public driver_device | |
| 29 | { | |
| 30 | public: | |
| 31 | wldarrow_state(running_machine &machine, const driver_device_config_base &config) | |
| 32 | : driver_device(machine, config) { } | |
| 29 | 33 | |
| 34 | UINT8 *videoram_0; | |
| 35 | UINT8 *videoram_1; | |
| 36 | UINT8 *videoram_2; | |
| 37 | size_t videoram_size; | |
| 38 | }; | |
| 30 | 39 | |
| 31 | static UINT8 *wldarrow_videoram_0; | |
| 32 | static UINT8 *wldarrow_videoram_1; | |
| 33 | static UINT8 *wldarrow_videoram_2; | |
| 34 | static size_t wldarrow_videoram_size; | |
| 35 | 40 | |
| 41 | #define NUM_PENS (8) | |
| 36 | 42 | |
| 37 | 43 | |
| 38 | 44 | /************************************* |
| r10886 | r10887 | |
| 54 | 60 | |
| 55 | 61 | static SCREEN_UPDATE( wldarrow ) |
| 56 | 62 | { |
| 63 | wldarrow_state *state = screen->machine->driver_data<wldarrow_state>(); | |
| 57 | 64 | pen_t pens[NUM_PENS]; |
| 58 | 65 | offs_t offs; |
| 59 | 66 | |
| 60 | 67 | get_pens(pens); |
| 61 | 68 | |
| 62 | for (offs = 0; offs < | |
| 69 | for (offs = 0; offs < st | |
| 63 | 70 | { |
| 64 | 71 | int i; |
| 65 | 72 | |
| 66 | 73 | UINT8 y = offs >> 5; |
| 67 | 74 | UINT8 x = offs << 3; |
| 68 | 75 | |
| 69 | UINT8 data0 = wldarrow_videoram_0[offs]; | |
| 70 | UINT8 data1 = wldarrow_videoram_1[offs]; | |
| 71 | UINT8 data2 = wldarrow_videoram_2[offs]; | |
| 76 | UINT8 data0 = state->videoram_0[offs]; | |
| 77 | UINT8 data1 = state->videoram_1[offs]; | |
| 78 | UINT8 data2 = state->videoram_2[offs]; | |
| 72 | 79 | |
| 73 | 80 | /* weird equations, but it matches every flyer screenshot - |
| 74 | 81 | perhaphs they used a look-up PROM? */ |
| r10886 | r10887 | |
| 167 | 174 | static ADDRESS_MAP_START( wldarrow_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 168 | 175 | AM_RANGE(0x0000, 0x37ff) AM_ROM |
| 169 | 176 | AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0") |
| 170 | AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&wldarrow_videoram_0) AM_SIZE(&wldarrow_videoram_size) | |
| 171 | AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(&wldarrow_videoram_1) | |
| 172 | AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE(&wldarrow_videoram_2) | |
| 177 | AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE_MEMBER(wldarrow_state, videoram_0) AM_SIZE_MEMBER(wldarrow_state, videoram_size) | |
| 178 | AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE_MEMBER(wldarrow_state, videoram_1) | |
| 179 | AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE_MEMBER(wldarrow_state, videoram_2) | |
| 173 | 180 | AM_RANGE(0xcd00, 0xcdff) AM_RAM AM_SHARE("nvram") |
| 174 | 181 | AM_RANGE(0xf000, 0xf000) AM_READ_PORT("BITSW") AM_DEVWRITE("dac", wldarrow_dac_1_w) |
| 175 | 182 | AM_RANGE(0xf004, 0xf004) AM_READ_PORT("IN1") AM_WRITE(lights_1_w) |
| r10886 | r10887 | |
| 345 | 352 | * |
| 346 | 353 | *************************************/ |
| 347 | 354 | |
| 348 | static MACHINE_CONFIG_START( wldarrow, dr | |
| 355 | static MACHINE_CONFIG_START( wldarrow, wldar | |
| 349 | 356 | |
| 350 | 357 | /* basic machine hardware */ |
| 351 | 358 | MCFG_CPU_ADD("maincpu", I8080, 2000000) |
| r10886 | r10887 | |
|---|---|---|
| 42 | 42 | #include "audio/taito_en.h" |
| 43 | 43 | #include "sound/okim6295.h" |
| 44 | 44 | |
| 45 | static UINT32 coin_word[2], *f3_ram; | |
| 46 | int f3_game; | |
| 47 | 45 | |
| 48 | ||
| 49 | 46 | /******************************************************************************/ |
| 50 | 47 | |
| 51 | 48 | static CUSTOM_INPUT( f3_analog_r ) |
| r10886 | r10887 | |
| 60 | 57 | |
| 61 | 58 | static CUSTOM_INPUT( f3_coin_r ) |
| 62 | 59 | { |
| 60 | taito_f3_state *state = field->port->machine->driver_data<taito_f3_state>(); | |
| 63 | 61 | int num = (FPTR)param; |
| 64 | return coin_word[num]; | |
| 62 | return state->coin_word[num]; | |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | static READ32_HANDLER( f3_control_r ) |
| r10886 | r10887 | |
| 77 | 75 | |
| 78 | 76 | static WRITE32_HANDLER( f3_control_w ) |
| 79 | 77 | { |
| 78 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 80 | 79 | switch (offset) |
| 81 | 80 | { |
| 82 | 81 | case 0x00: /* Watchdog */ |
| r10886 | r10887 | |
| 90 | 89 | coin_lockout_w(space->machine, 1,~data & 0x02000000); |
| 91 | 90 | coin_counter_w(space->machine, 0, data & 0x04000000); |
| 92 | 91 | coin_counter_w(space->machine, 1, data & 0x08000000); |
| 93 | coin_word[0]=(data>>16)&0xffff; | |
| 92 | state->coin_word[0]=(data>>16)&0xffff; | |
| 94 | 93 | } |
| 95 | 94 | return; |
| 96 | 95 | |
| r10886 | r10887 | |
| 108 | 107 | coin_lockout_w(space->machine, 3,~data & 0x02000000); |
| 109 | 108 | coin_counter_w(space->machine, 2, data & 0x04000000); |
| 110 | 109 | coin_counter_w(space->machine, 3, data & 0x08000000); |
| 111 | coin_word[1]=(data>>16)&0xffff; | |
| 110 | state->coin_word[1]=(data>>16)&0xffff; | |
| 112 | 111 | } |
| 113 | 112 | return; |
| 114 | 113 | } |
| r10886 | r10887 | |
| 127 | 126 | |
| 128 | 127 | static WRITE32_HANDLER( f3_sound_bankswitch_w ) |
| 129 | 128 | { |
| 130 | if (f3_game==KIRAMEKI) { | |
| 129 | taito_f3_state *state = space->machine->driver_data<taito_f3_state>(); | |
| 130 | if (state->f3_game==KIRAMEKI) { | |
| 131 | 131 | UINT16 *rom = (UINT16 *)space->machine->region("audiocpu")->base(); |
| 132 | 132 | UINT32 idx; |
| 133 | 133 | |
| r10886 | r10887 | |
| 152 | 152 | static ADDRESS_MAP_START( f3_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 153 | 153 | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 154 | 154 | AM_RANGE(0x300000, 0x30007f) AM_WRITE(f3_sound_bankswitch_w) |
| 155 | AM_RANGE(0x400000, 0x41ffff) AM_MIRROR(0x20000) AM_RAM AM_BASE( | |
| 155 | AM_RANGE(0x400000, 0x41ffff) AM_MIRROR(0x20000) AM_RAM AM_BASE_MEMBER(taito_f3_state, f3_ram) | |
| 156 | 156 | AM_RANGE(0x440000, 0x447fff) AM_RAM_WRITE(f3_palette_24bit_w) AM_BASE_GENERIC(paletteram) |
| 157 | 157 | AM_RANGE(0x4a0000, 0x4a001f) AM_READWRITE(f3_control_r, f3_control_w) |
| 158 | 158 | AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE_SIZE_MEMBER(taito_f3_state, spriteram, spriteram_size) |
| 159 | AM_RANGE(0x610000, 0x61bfff) AM_RAM_WRITE(f3_pf_data_w) AM_BASE( | |
| 159 | AM_RANGE(0x610000, 0x61bfff) AM_RAM_WRITE(f3_pf_data_w) AM_BASE_MEMBER(taito_f3_state, f3_pf_data) | |
| 160 | 160 | AM_RANGE(0x61c000, 0x61dfff) AM_RAM_WRITE(f3_videoram_w) AM_BASE_MEMBER(taito_f3_state, videoram) |
| 161 | AM_RANGE(0x61e000, 0x61ffff) AM_RAM_WRITE(f3_vram_w) AM_BASE(&f3_vram) | |
| 162 | AM_RANGE(0x620000, 0x62ffff) AM_RAM_WRITE(f3_lineram_w) AM_BASE(&f3_line_ram) | |
| 163 | AM_RANGE(0x630000, 0x63ffff) AM_RAM_WRITE(f3_pivot_w) AM_BASE(&f3_pivot_ram) | |
| 161 | AM_RANGE(0x61e000, 0x61ffff) AM_RAM_WRITE(f3_vram_w) AM_BASE_MEMBER(taito_f3_state, f3_vram) | |
| 162 | AM_RANGE(0x620000, 0x62ffff) AM_RAM_WRITE(f3_lineram_w) AM_BASE_MEMBER(taito_f3_state, f3_line_ram) | |
| 163 | AM_RANGE(0x630000, 0x63ffff) AM_RAM_WRITE(f3_pivot_w) AM_BASE_MEMBER(taito_f3_state, f3_pivot_ram) | |
| 164 | 164 | AM_RANGE(0x660000, 0x66000f) AM_WRITE(f3_control_0_w) |
| 165 | 165 | AM_RANGE(0x660010, 0x66001f) AM_WRITE(f3_control_1_w) |
| 166 | 166 | AM_RANGE(0xc00000, 0xc007ff) AM_RAM AM_SHARE("f3_shared") |
| r10886 | r10887 | |
| 385 | 385 | |
| 386 | 386 | static MACHINE_START(f3) |
| 387 | 387 | { |
| 388 | state_save_register_global_array(machine, coin_word); | |
| 388 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 389 | state_save_register_global_array(machine, state->coin_word); | |
| 389 | 390 | } |
| 390 | 391 | |
| 391 | 392 | static MACHINE_CONFIG_START( f3, taito_f3_state ) |
| r10886 | r10887 | |
| 3555 | 3556 | |
| 3556 | 3557 | static DRIVER_INIT( ringrage ) |
| 3557 | 3558 | { |
| 3558 | f3_game=RINGRAGE; | |
| 3559 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3560 | state->f3_game=RINGRAGE; | |
| 3559 | 3561 | tile_decode(machine); |
| 3560 | 3562 | } |
| 3561 | 3563 | |
| 3562 | 3564 | static DRIVER_INIT( arabianm ) |
| 3563 | 3565 | { |
| 3564 | f3_game=ARABIANM; | |
| 3566 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3567 | state->f3_game=ARABIANM; | |
| 3565 | 3568 | tile_decode(machine); |
| 3566 | 3569 | } |
| 3567 | 3570 | |
| 3568 | 3571 | static DRIVER_INIT( ridingf ) |
| 3569 | 3572 | { |
| 3570 | f3_game=RIDINGF; | |
| 3573 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3574 | state->f3_game=RIDINGF; | |
| 3571 | 3575 | tile_decode(machine); |
| 3572 | 3576 | } |
| 3573 | 3577 | |
| 3574 | 3578 | static DRIVER_INIT( gseeker ) |
| 3575 | 3579 | { |
| 3576 | f3_game=GSEEKER; | |
| 3580 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3581 | state->f3_game=GSEEKER; | |
| 3577 | 3582 | tile_decode(machine); |
| 3578 | 3583 | } |
| 3579 | 3584 | |
| 3580 | 3585 | static DRIVER_INIT( gunlock ) |
| 3581 | 3586 | { |
| 3582 | f3_game=GUNLOCK; | |
| 3587 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3588 | state->f3_game=GUNLOCK; | |
| 3583 | 3589 | tile_decode(machine); |
| 3584 | 3590 | } |
| 3585 | 3591 | |
| 3586 | 3592 | static DRIVER_INIT( elvactr ) |
| 3587 | 3593 | { |
| 3588 | f3_game=EACTION2; | |
| 3594 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3595 | state->f3_game=EACTION2; | |
| 3589 | 3596 | tile_decode(machine); |
| 3590 | 3597 | } |
| 3591 | 3598 | |
| 3592 | 3599 | static DRIVER_INIT( cupfinal ) |
| 3593 | 3600 | { |
| 3594 | f3_game=SCFINALS; | |
| 3601 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3602 | state->f3_game=SCFINALS; | |
| 3595 | 3603 | tile_decode(machine); |
| 3596 | 3604 | } |
| 3597 | 3605 | |
| 3598 | 3606 | static DRIVER_INIT( trstaroj ) |
| 3599 | 3607 | { |
| 3600 | f3_game=TRSTAR; | |
| 3608 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3609 | state->f3_game=TRSTAR; | |
| 3601 | 3610 | tile_decode(machine); |
| 3602 | 3611 | } |
| 3603 | 3612 | |
| 3604 | 3613 | static DRIVER_INIT( scfinals ) |
| 3605 | 3614 | { |
| 3615 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3606 | 3616 | UINT32 *RAM = (UINT32 *)machine->region("maincpu")->base(); |
| 3607 | 3617 | |
| 3608 | 3618 | /* Doesn't boot without this - eprom related? */ |
| r10886 | r10887 | |
| 3611 | 3621 | /* Rom checksum error */ |
| 3612 | 3622 | RAM[0xdd0/4]=0x4e750000; |
| 3613 | 3623 | |
| 3614 | f3_game=SCFINALS; | |
| 3624 | state->f3_game=SCFINALS; | |
| 3615 | 3625 | tile_decode(machine); |
| 3616 | 3626 | } |
| 3617 | 3627 | |
| 3618 | 3628 | static DRIVER_INIT( lightbr ) |
| 3619 | 3629 | { |
| 3620 | f3_game=LIGHTBR; | |
| 3630 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3631 | state->f3_game=LIGHTBR; | |
| 3621 | 3632 | tile_decode(machine); |
| 3622 | 3633 | } |
| 3623 | 3634 | |
| 3624 | 3635 | static DRIVER_INIT( kaiserkn ) |
| 3625 | 3636 | { |
| 3626 | f3_game=KAISERKN; | |
| 3637 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3638 | state->f3_game=KAISERKN; | |
| 3627 | 3639 | tile_decode(machine); |
| 3628 | 3640 | } |
| 3629 | 3641 | |
| 3630 | 3642 | static DRIVER_INIT( dariusg ) |
| 3631 | 3643 | { |
| 3632 | f3_game=DARIUSG; | |
| 3644 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3645 | state->f3_game=DARIUSG; | |
| 3633 | 3646 | tile_decode(machine); |
| 3634 | 3647 | } |
| 3635 | 3648 | |
| 3636 | 3649 | static DRIVER_INIT( spcinvdj ) |
| 3637 | 3650 | { |
| 3638 | f3_game=SPCINVDX; | |
| 3651 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3652 | state->f3_game=SPCINVDX; | |
| 3639 | 3653 | tile_decode(machine); |
| 3640 | 3654 | } |
| 3641 | 3655 | |
| 3642 | 3656 | static DRIVER_INIT( qtheater ) |
| 3643 | 3657 | { |
| 3644 | f3_game=QTHEATER; | |
| 3658 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3659 | state->f3_game=QTHEATER; | |
| 3645 | 3660 | tile_decode(machine); |
| 3646 | 3661 | } |
| 3647 | 3662 | |
| 3648 | 3663 | static DRIVER_INIT( spcinv95 ) |
| 3649 | 3664 | { |
| 3650 | f3_game=SPCINV95; | |
| 3665 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3666 | state->f3_game=SPCINV95; | |
| 3651 | 3667 | tile_decode(machine); |
| 3652 | 3668 | } |
| 3653 | 3669 | |
| 3654 | 3670 | static DRIVER_INIT( gekirido ) |
| 3655 | 3671 | { |
| 3656 | f3_game=GEKIRIDO; | |
| 3672 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3673 | state->f3_game=GEKIRIDO; | |
| 3657 | 3674 | tile_decode(machine); |
| 3658 | 3675 | } |
| 3659 | 3676 | |
| 3660 | 3677 | static DRIVER_INIT( ktiger2 ) |
| 3661 | 3678 | { |
| 3662 | f3_game=KTIGER2; | |
| 3679 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3680 | state->f3_game=KTIGER2; | |
| 3663 | 3681 | tile_decode(machine); |
| 3664 | 3682 | } |
| 3665 | 3683 | |
| 3666 | 3684 | static DRIVER_INIT( bubsymph ) |
| 3667 | 3685 | { |
| 3668 | f3_game=BUBSYMPH; | |
| 3686 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3687 | state->f3_game=BUBSYMPH; | |
| 3669 | 3688 | tile_decode(machine); |
| 3670 | 3689 | } |
| 3671 | 3690 | |
| r10886 | r10887 | |
| 3695 | 3714 | |
| 3696 | 3715 | static DRIVER_INIT( bubsympb ) |
| 3697 | 3716 | { |
| 3698 | f3_game=BUBSYMPH; | |
| 3717 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3718 | state->f3_game=BUBSYMPH; | |
| 3699 | 3719 | //tile_decode(machine); |
| 3700 | 3720 | |
| 3701 | 3721 | /* expand gfx rom */ |
| r10886 | r10887 | |
| 3724 | 3744 | |
| 3725 | 3745 | static DRIVER_INIT( bubblem ) |
| 3726 | 3746 | { |
| 3727 | f3_game=BUBBLEM; | |
| 3747 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3748 | state->f3_game=BUBBLEM; | |
| 3728 | 3749 | tile_decode(machine); |
| 3729 | 3750 | } |
| 3730 | 3751 | |
| 3731 | 3752 | static DRIVER_INIT( cleopatr ) |
| 3732 | 3753 | { |
| 3733 | f3_game=CLEOPATR; | |
| 3754 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3755 | state->f3_game=CLEOPATR; | |
| 3734 | 3756 | tile_decode(machine); |
| 3735 | 3757 | } |
| 3736 | 3758 | |
| 3737 | 3759 | static DRIVER_INIT( popnpop ) |
| 3738 | 3760 | { |
| 3739 | f3_game=POPNPOP; | |
| 3761 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3762 | state->f3_game=POPNPOP; | |
| 3740 | 3763 | tile_decode(machine); |
| 3741 | 3764 | } |
| 3742 | 3765 | |
| 3743 | 3766 | static DRIVER_INIT( landmakr ) |
| 3744 | 3767 | { |
| 3745 | f3_game=LANDMAKR; | |
| 3768 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3769 | state->f3_game=LANDMAKR; | |
| 3746 | 3770 | tile_decode(machine); |
| 3747 | 3771 | } |
| 3748 | 3772 | |
| 3749 | 3773 | static DRIVER_INIT( landmkrp ) |
| 3750 | 3774 | { |
| 3775 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3751 | 3776 | UINT32 *RAM = (UINT32 *)machine->region("maincpu")->base(); |
| 3752 | 3777 | |
| 3753 | 3778 | /* For some reason the least significant byte in the last 2 long words of |
| r10886 | r10887 | |
| 3757 | 3782 | RAM[0x1ffff8/4]=0xffffffff; /* From 0xffffff03 */ |
| 3758 | 3783 | RAM[0x1ffffc/4]=0xffff0003; /* From 0xffff00ff */ |
| 3759 | 3784 | |
| 3760 | f3_game=LANDMAKR; | |
| 3785 | state->f3_game=LANDMAKR; | |
| 3761 | 3786 | tile_decode(machine); |
| 3762 | 3787 | } |
| 3763 | 3788 | |
| 3764 | 3789 | static DRIVER_INIT( pbobble3 ) |
| 3765 | 3790 | { |
| 3766 | f3_game=PBOBBLE3; | |
| 3791 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3792 | state->f3_game=PBOBBLE3; | |
| 3767 | 3793 | tile_decode(machine); |
| 3768 | 3794 | } |
| 3769 | 3795 | |
| 3770 | 3796 | static DRIVER_INIT( pbobble4 ) |
| 3771 | 3797 | { |
| 3772 | f3_game=PBOBBLE4; | |
| 3798 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3799 | state->f3_game=PBOBBLE4; | |
| 3773 | 3800 | tile_decode(machine); |
| 3774 | 3801 | } |
| 3775 | 3802 | |
| 3776 | 3803 | static DRIVER_INIT( quizhuhu ) |
| 3777 | 3804 | { |
| 3778 | f3_game=QUIZHUHU; | |
| 3805 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3806 | state->f3_game=QUIZHUHU; | |
| 3779 | 3807 | tile_decode(machine); |
| 3780 | 3808 | } |
| 3781 | 3809 | |
| 3782 | 3810 | static DRIVER_INIT( pbobble2 ) |
| 3783 | 3811 | { |
| 3784 | f3_game=PBOBBLE2; | |
| 3812 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3813 | state->f3_game=PBOBBLE2; | |
| 3785 | 3814 | tile_decode(machine); |
| 3786 | 3815 | } |
| 3787 | 3816 | |
| 3788 | 3817 | static DRIVER_INIT( pbobbl2p ) |
| 3789 | 3818 | { |
| 3819 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3790 | 3820 | // has 040092: beq $30000; (2+) |
| 3791 | 3821 | // which eventually causes the game to crash |
| 3792 | 3822 | // -- protection check?? or some kind of checksum fail? |
| r10886 | r10887 | |
| 3797 | 3827 | ROM[0x40090/4]=0x00004e71|(ROM[0x40090/4]&0xffff0000); |
| 3798 | 3828 | ROM[0x40094/4]=0x4e714e71; |
| 3799 | 3829 | |
| 3800 | f3_game=PBOBBLE2; | |
| 3830 | state->f3_game=PBOBBLE2; | |
| 3801 | 3831 | tile_decode(machine); |
| 3802 | 3832 | } |
| 3803 | 3833 | |
| r10886 | r10887 | |
| 3805 | 3835 | |
| 3806 | 3836 | static DRIVER_INIT( pbobbl2x ) |
| 3807 | 3837 | { |
| 3808 | f3_game=PBOBBLE2; | |
| 3838 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3839 | state->f3_game=PBOBBLE2; | |
| 3809 | 3840 | tile_decode(machine); |
| 3810 | 3841 | } |
| 3811 | 3842 | |
| 3812 | 3843 | static DRIVER_INIT( hthero95 ) |
| 3813 | 3844 | { |
| 3814 | f3_game=HTHERO95; | |
| 3845 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3846 | state->f3_game=HTHERO95; | |
| 3815 | 3847 | tile_decode(machine); |
| 3816 | 3848 | } |
| 3817 | 3849 | |
| 3818 | 3850 | static DRIVER_INIT( kirameki ) |
| 3819 | 3851 | { |
| 3820 | f3_game=KIRAMEKI; | |
| 3852 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3853 | state->f3_game=KIRAMEKI; | |
| 3821 | 3854 | tile_decode(machine); |
| 3822 | 3855 | } |
| 3823 | 3856 | |
| 3824 | 3857 | static DRIVER_INIT( puchicar ) |
| 3825 | 3858 | { |
| 3826 | f3_game=PUCHICAR; | |
| 3859 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3860 | state->f3_game=PUCHICAR; | |
| 3827 | 3861 | tile_decode(machine); |
| 3828 | 3862 | } |
| 3829 | 3863 | |
| 3830 | 3864 | static DRIVER_INIT( twinqix ) |
| 3831 | 3865 | { |
| 3832 | f3_game=TWINQIX; | |
| 3866 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3867 | state->f3_game=TWINQIX; | |
| 3833 | 3868 | tile_decode(machine); |
| 3834 | 3869 | } |
| 3835 | 3870 | |
| 3836 | 3871 | static DRIVER_INIT( arkretrn ) |
| 3837 | 3872 | { |
| 3838 | f3_game=ARKRETRN; | |
| 3873 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3874 | state->f3_game=ARKRETRN; | |
| 3839 | 3875 | tile_decode(machine); |
| 3840 | 3876 | } |
| 3841 | 3877 | |
| 3842 | 3878 | static DRIVER_INIT( intcup94 ) |
| 3843 | 3879 | { |
| 3844 | f3_game=SCFINALS; | |
| 3880 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3881 | state->f3_game=SCFINALS; | |
| 3845 | 3882 | tile_decode(machine); |
| 3846 | 3883 | } |
| 3847 | 3884 | |
| 3848 | 3885 | static DRIVER_INIT( recalh ) |
| 3849 | 3886 | { |
| 3850 | f3_game=RECALH; | |
| 3887 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3888 | state->f3_game=RECALH; | |
| 3851 | 3889 | tile_decode(machine); |
| 3852 | 3890 | } |
| 3853 | 3891 | |
| 3854 | 3892 | static DRIVER_INIT( commandw ) |
| 3855 | 3893 | { |
| 3856 | f3_game=COMMANDW; | |
| 3894 | taito_f3_state *state = machine->driver_data<taito_f3_state>(); | |
| 3895 | state->f3_game=COMMANDW; | |
| 3857 | 3896 | tile_decode(machine); |
| 3858 | 3897 | } |
| 3859 | 3898 |
| r10886 | r10887 | |
|---|---|---|
| 130 | 130 | #include "includes/megasys1.h" |
| 131 | 131 | |
| 132 | 132 | |
| 133 | /* Variables only used here: */ | |
| 134 | ||
| 135 | static UINT16 ip_select, ip_select_values[5]; | |
| 136 | static UINT8 megasys1_ignore_oki_status = 0; /* used in MACHINE_RESET */ | |
| 137 | ||
| 138 | ||
| 139 | 133 | static MACHINE_RESET( megasys1 ) |
| 140 | 134 | { |
| 141 | megasys1_ignore_oki_status = 1; /* ignore oki status due 'protection' */ | |
| 142 | ip_select = 0; /* reset protection */ | |
| 135 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 136 | state->ignore_oki_status = 1; /* ignore oki status due 'protection' */ | |
| 137 | state->ip_select = 0; /* reset protection */ | |
| 143 | 138 | } |
| 144 | 139 | |
| 145 | 140 | static MACHINE_RESET( megasys1_hachoo ) |
| 146 | 141 | { |
| 147 | megasys1_ignore_oki_status = 0; /* strangely hachoo need real oki status */ | |
| 148 | ip_select = 0; /* reset protection */ | |
| 142 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 143 | state->ignore_oki_status = 0; /* strangely hachoo need real oki status */ | |
| 144 | state->ip_select = 0; /* reset protection */ | |
| 149 | 145 | } |
| 150 | 146 | |
| 151 | 147 | |
| r10886 | r10887 | |
| 180 | 176 | AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P2") |
| 181 | 177 | AM_RANGE(0x080006, 0x080007) AM_READ_PORT("DSW") |
| 182 | 178 | AM_RANGE(0x080008, 0x080009) AM_READ(soundlatch2_word_r) /* from sound cpu */ |
| 183 | AM_RANGE(0x084000, 0x0843ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE( | |
| 179 | AM_RANGE(0x084000, 0x0843ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE_MEMBER( | |
| 184 | 180 | AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE_GENERIC(paletteram) |
| 185 | AM_RANGE(0x08e000, 0x08ffff) AM_RAM AM_BASE(&megasys1_objectram) | |
| 186 | AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(&megasys1_scrollram[0]) | |
| 187 | AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(&megasys1_scrollram[1]) | |
| 188 | AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2]) | |
| 189 | AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&megasys1_ram) | |
| 181 | AM_RANGE(0x08e000, 0x08ffff) AM_RAM AM_BASE_MEMBER(megasys1_state, objectram) | |
| 182 | AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE_MEMBER(megasys1_state, scrollram[0]) | |
| 183 | AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE_MEMBER(megasys1_state, scrollram[1]) | |
| 184 | AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE_MEMBER(megasys1_state, scrollram[2]) | |
| 185 | AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE_MEMBER(megasys1_state, ram) | |
| 190 | 186 | ADDRESS_MAP_END |
| 191 | 187 | |
| 192 | 188 | |
| r10886 | r10887 | |
| 218 | 214 | |
| 219 | 215 | static READ16_HANDLER( ip_select_r ) |
| 220 | 216 | { |
| 217 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 221 | 218 | int i; |
| 222 | 219 | |
| 223 | 220 | // Coins P1 P2 DSW1 DSW2 |
| r10886 | r10887 | |
| 230 | 227 | |
| 231 | 228 | |
| 232 | 229 | /* f(x) = ((x*x)>>4)&0xFF ; f(f($D)) == 6 */ |
| 233 | if ((ip_select & 0xF0) == 0xF0) return 0x000D; | |
| 230 | if ((state->ip_select & 0xF0) == 0xF0) return 0x000D; | |
| 234 | 231 | |
| 235 | for (i = 0; i < 5; i++) if (ip_select == ip_select_values[i]) break; | |
| 232 | for (i = 0; i < 5; i++) if (state->ip_select == state->ip_select_values[i]) break; | |
| 236 | 233 | |
| 237 | 234 | switch (i) |
| 238 | 235 | { |
| r10886 | r10887 | |
| 247 | 244 | |
| 248 | 245 | static WRITE16_HANDLER( ip_select_w ) |
| 249 | 246 | { |
| 250 | COMBINE_DATA(&ip_select); | |
| 247 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 248 | COMBINE_DATA(&state->ip_select); | |
| 251 | 249 | cputag_set_input_line(space->machine, "maincpu", 2, HOLD_LINE); |
| 252 | 250 | } |
| 253 | 251 | |
| r10886 | r10887 | |
| 255 | 253 | static ADDRESS_MAP_START( megasys1B_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 256 | 254 | ADDRESS_MAP_GLOBAL_MASK(0xfffff) |
| 257 | 255 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 258 | AM_RANGE(0x044000, 0x0443ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE( | |
| 256 | AM_RANGE(0x044000, 0x0443ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE_MEMBER( | |
| 259 | 257 | AM_RANGE(0x048000, 0x0487ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE_GENERIC(paletteram) |
| 260 | AM_RANGE(0x04e000, 0x04ffff) AM_RAM AM_BASE(&megasys1_objectram) | |
| 261 | AM_RANGE(0x050000, 0x053fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(&megasys1_scrollram[0]) | |
| 262 | AM_RANGE(0x054000, 0x057fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(&megasys1_scrollram[1]) | |
| 263 | AM_RANGE(0x058000, 0x05bfff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2]) | |
| 264 | AM_RANGE(0x060000, 0x07ffff) AM_RAM AM_BASE(&megasys1_ram) | |
| 258 | AM_RANGE(0x04e000, 0x04ffff) AM_RAM AM_BASE_MEMBER(megasys1_state, objectram) | |
| 259 | AM_RANGE(0x050000, 0x053fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE_MEMBER(megasys1_state, scrollram[0]) | |
| 260 | AM_RANGE(0x054000, 0x057fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE_MEMBER(megasys1_state, scrollram[1]) | |
| 261 | AM_RANGE(0x058000, 0x05bfff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE_MEMBER(megasys1_state, scrollram[2]) | |
| 262 | AM_RANGE(0x060000, 0x07ffff) AM_RAM AM_BASE_MEMBER(megasys1_state, ram) | |
| 265 | 263 | AM_RANGE(0x080000, 0x0bffff) AM_ROM |
| 266 | 264 | AM_RANGE(0x0e0000, 0x0e0001) AM_READWRITE(ip_select_r,ip_select_w) |
| 267 | 265 | ADDRESS_MAP_END |
| r10886 | r10887 | |
| 278 | 276 | static ADDRESS_MAP_START( megasys1C_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 279 | 277 | ADDRESS_MAP_GLOBAL_MASK(0x1fffff) |
| 280 | 278 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 281 | AM_RANGE(0x0c0000, 0x0cffff) AM_READWRITE(megasys1_vregs_C_r,megasys1_vregs_C_w) AM_BASE(&megasys1_vregs) | |
| 282 | AM_RANGE(0x0d2000, 0x0d3fff) AM_RAM AM_BASE(&megasys1_objectram) | |
| 283 | AM_RANGE(0x0e0000, 0x0e3fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(&megasys1_scrollram[0]) | |
| 284 | AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(&megasys1_scrollram[1]) | |
| 285 | AM_RANGE(0x0f0000, 0x0f3fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2]) | |
| 279 | AM_RANGE(0x0c0000, 0x0cffff) AM_READWRITE(megasys1_vregs_C_r,megasys1_vregs_C_w) AM_BASE_MEMBER(megasys1_state, vregs) | |
| 280 | AM_RANGE(0x0d2000, 0x0d3fff) AM_RAM AM_BASE_MEMBER(megasys1_state, objectram) | |
| 281 | AM_RANGE(0x0e0000, 0x0e3fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE_MEMBER(megasys1_state, scrollram[0]) | |
| 282 | AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE_MEMBER(megasys1_state, scrollram[1]) | |
| 283 | AM_RANGE(0x0f0000, 0x0f3fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE_MEMBER(megasys1_state, scrollram[2]) | |
| 286 | 284 | AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE_GENERIC(paletteram) |
| 287 | 285 | AM_RANGE(0x0d8000, 0x0d8001) AM_READWRITE(ip_select_r,ip_select_w) |
| 288 | AM_RANGE(0x1f0000, 0x1fffff) AM_RAM AM_BASE( | |
| 286 | AM_RANGE(0x1f0000, 0x1fffff) AM_RAM AM_BASE_MEMBER( | |
| 289 | 287 | ADDRESS_MAP_END |
| 290 | 288 | |
| 291 | 289 | |
| r10886 | r10887 | |
| 300 | 298 | |
| 301 | 299 | static ADDRESS_MAP_START( megasys1D_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 302 | 300 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 303 | AM_RANGE(0x0c0000, 0x0c9fff) AM_RAM_WRITE(megasys1_vregs_D_w) AM_BASE(&megasys1_vregs) | |
| 304 | AM_RANGE(0x0ca000, 0x0cbfff) AM_RAM AM_BASE(&megasys1_objectram) | |
| 305 | AM_RANGE(0x0d0000, 0x0d3fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(&megasys1_scrollram[1]) | |
| 306 | AM_RANGE(0x0d4000, 0x0d7fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2]) | |
| 301 | AM_RANGE(0x0c0000, 0x0c9fff) AM_RAM_WRITE(megasys1_vregs_D_w) AM_BASE_MEMBER(megasys1_state, vregs) | |
| 302 | AM_RANGE(0x0ca000, 0x0cbfff) AM_RAM AM_BASE_MEMBER(megasys1_state, objectram) | |
| 303 | AM_RANGE(0x0d0000, 0x0d3fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE_MEMBER(megasys1_state, scrollram[1]) | |
| 304 | AM_RANGE(0x0d4000, 0x0d7fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE_MEMBER(megasys1_state, scrollram[2]) | |
| 307 | 305 | AM_RANGE(0x0d8000, 0x0d87ff) AM_MIRROR(0x3000) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE_GENERIC(paletteram) |
| 308 | 306 | AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("DSW") |
| 309 | AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE( | |
| 307 | AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE_MEMBER( | |
| 310 | 308 | AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("SYSTEM") |
| 311 | 309 | AM_RANGE(0x0f8000, 0x0f8001) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) |
| 312 | 310 | // AM_RANGE(0x100000, 0x100001) // protection |
| 313 | AM_RANGE(0x1f0000, 0x1fffff) AM_RAM AM_BASE( | |
| 311 | AM_RANGE(0x1f0000, 0x1fffff) AM_RAM AM_BASE_MEMBER( | |
| 314 | 312 | ADDRESS_MAP_END |
| 315 | 313 | |
| 316 | 314 | |
| r10886 | r10887 | |
| 380 | 378 | |
| 381 | 379 | static READ8_DEVICE_HANDLER( oki_status_r ) |
| 382 | 380 | { |
| 383 | if (megasys1_ignore_oki_status == 1) | |
| 381 | megasys1_state *state = device->machine->driver_data<megasys1_state>(); | |
| 382 | if (state->ignore_oki_status == 1) | |
| 384 | 383 | return 0; |
| 385 | 384 | else |
| 386 | 385 | return downcast<okim6295_device *>(device)->read_status(); |
| r10886 | r10887 | |
| 1358 | 1357 | * |
| 1359 | 1358 | *************************************/ |
| 1360 | 1359 | |
| 1361 | static UINT16 protection_val; | |
| 1362 | 1360 | |
| 1363 | 1361 | /* Read the input ports, through a protection device */ |
| 1364 | 1362 | static READ16_HANDLER( protection_peekaboo_r ) |
| 1365 | 1363 | { |
| 1366 | switch (protection_val) | |
| 1364 | megasys1_state *state = space->machine->driver_data<megasys1_state>(); | |
| 1365 | switch (state->protection_val) | |
| 1367 | 1366 | { |
| 1368 | 1367 | case 0x02: return 0x03; |
| 1369 | 1368 | case 0x51: return input_port_read(space->machine, "P1"); |
| 1370 | 1369 | case 0x52: return input_port_read(space->machine, "P2"); |
| 1371 | default: return protection_val; | |
| 1370 | default: return state->protection_val; | |
| 1372 | 1371 | } |
| 1373 | 1372 | } |
| 1374 | 1373 | |
| 1375 | 1374 | static WRITE16_HANDLER( protection_peekaboo_w ) |
| 1376 | 1375 | { |
| 1377 | stat | |
| 1376 | megasys1_state | |
| 1378 | 1377 | |
| 1379 | COMBINE_DATA(&protection_val); | |
| 1378 | COMBINE_DATA(&state->protection_val); | |
| 1380 | 1379 | |
| 1381 | if ((protection_val & 0x90) == 0x90) | |
| 1380 | if ((state->protection_val & 0x90) == 0x90) | |
| 1382 | 1381 | { |
| 1383 | 1382 | UINT8 *RAM = space->machine->region("oki1")->base(); |
| 1384 | int new_bank = (protection_val & 0x7) % 7; | |
| 1383 | int new_bank = (state->protection_val & 0x7) % 7; | |
| 1385 | 1384 | |
| 1386 | if (bank != new_bank) | |
| 1385 | if (state->bank != new_bank) | |
| 1387 | 1386 | { |
| 1388 | 1387 | memcpy(&RAM[0x20000],&RAM[0x40000 + 0x20000*new_bank],0x20000); |
| 1389 | bank = new_bank; | |
| 1388 | state->bank = new_bank; | |
| 1390 | 1389 | } |
| 1391 | 1390 | } |
| 1392 | 1391 | |
| r10886 | r10887 | |
| 3618 | 3617 | |
| 3619 | 3618 | static DRIVER_INIT( 64street ) |
| 3620 | 3619 | { |
| 3620 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3621 | 3621 | // UINT16 *RAM = (UINT16 *) machine->region("maincpu")->base(); |
| 3622 | 3622 | // RAM[0x006b8/2] = 0x6004; // d8001 test |
| 3623 | 3623 | // RAM[0x10EDE/2] = 0x6012; // watchdog |
| 3624 | 3624 | |
| 3625 | ip_select_values[0] = 0x57; | |
| 3626 | ip_select_values[1] = 0x53; | |
| 3627 | ip_select_values[2] = 0x54; | |
| 3628 | ip_select_values[3] = 0x55; | |
| 3629 | ip_select_values[4] = 0x56; | |
| 3625 | state->ip_select_values[0] = 0x57; | |
| 3626 | state->ip_select_values[1] = 0x53; | |
| 3627 | state->ip_select_values[2] = 0x54; | |
| 3628 | state->ip_select_values[3] = 0x55; | |
| 3629 | state->ip_select_values[4] = 0x56; | |
| 3630 | 3630 | } |
| 3631 | 3631 | |
| 3632 | 3632 | static DRIVER_INIT( astyanax ) |
| r10886 | r10887 | |
| 3641 | 3641 | |
| 3642 | 3642 | static DRIVER_INIT( avspirit ) |
| 3643 | 3643 | { |
| 3644 | ip_select_values[0] = 0x37; | |
| 3645 | ip_select_values[1] = 0x35; | |
| 3646 | ip_select_values[2] = 0x36; | |
| 3647 | ip_select_values[3] = 0x33; | |
| 3648 | ip_select_values[4] = 0x34; | |
| 3644 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3645 | state->ip_select_values[0] = 0x37; | |
| 3646 | state->ip_select_values[1] = 0x35; | |
| 3647 | state->ip_select_values[2] = 0x36; | |
| 3648 | state->ip_select_values[3] = 0x33; | |
| 3649 | state->ip_select_values[4] = 0x34; | |
| 3649 | 3650 | |
| 3650 | 3651 | /* kludge: avspirit has 0x10000 bytes of RAM while edf has 0x20000. The */ |
| 3651 | 3652 | /* following is needed to make vh_start() pick the correct address */ |
| 3652 | 3653 | /* for spriteram16. */ |
| 3653 | | |
| 3654 | | |
| 3654 | 3655 | } |
| 3655 | 3656 | |
| 3656 | 3657 | static DRIVER_INIT( bigstrik ) |
| 3657 | 3658 | { |
| 3658 | ip_select_values[0] = 0x58; | |
| 3659 | ip_select_values[1] = 0x54; | |
| 3660 | ip_select_values[2] = 0x55; | |
| 3661 | ip_select_values[3] = 0x56; | |
| 3662 | ip_select_values[4] = 0x57; | |
| 3659 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3660 | state->ip_select_values[0] = 0x58; | |
| 3661 | state->ip_select_values[1] = 0x54; | |
| 3662 | state->ip_select_values[2] = 0x55; | |
| 3663 | state->ip_select_values[3] = 0x56; | |
| 3664 | state->ip_select_values[4] = 0x57; | |
| 3663 | 3665 | } |
| 3664 | 3666 | |
| 3665 | 3667 | static DRIVER_INIT( chimerab ) |
| 3666 | 3668 | { |
| 3669 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3667 | 3670 | /* same as cybattlr */ |
| 3668 | ip_select_values[0] = 0x56; | |
| 3669 | ip_select_values[1] = 0x52; | |
| 3670 | ip_select_values[2] = 0x53; | |
| 3671 | ip_select_values[3] = 0x54; | |
| 3672 | ip_select_values[4] = 0x55; | |
| 3671 | state->ip_select_values[0] = 0x56; | |
| 3672 | state->ip_select_values[1] = 0x52; | |
| 3673 | state->ip_select_values[2] = 0x53; | |
| 3674 | state->ip_select_values[3] = 0x54; | |
| 3675 | state->ip_select_values[4] = 0x55; | |
| 3673 | 3676 | } |
| 3674 | 3677 | |
| 3675 | 3678 | static DRIVER_INIT( cybattlr ) |
| 3676 | 3679 | { |
| 3677 | ip_select_values[0] = 0x56; | |
| 3678 | ip_select_values[1] = 0x52; | |
| 3679 | ip_select_values[2] = 0x53; | |
| 3680 | ip_select_values[3] = 0x54; | |
| 3681 | ip_select_values[4] = 0x55; | |
| 3680 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3681 | state->ip_select_values[0] = 0x56; | |
| 3682 | state->ip_select_values[1] = 0x52; | |
| 3683 | state->ip_select_values[2] = 0x53; | |
| 3684 | state->ip_select_values[3] = 0x54; | |
| 3685 | state->ip_select_values[4] = 0x55; | |
| 3682 | 3686 | } |
| 3683 | 3687 | |
| 3684 | 3688 | static DRIVER_INIT( edf ) |
| 3685 | 3689 | { |
| 3686 | ip_select_values[0] = 0x20; | |
| 3687 | ip_select_values[1] = 0x21; | |
| 3688 | ip_select_values[2] = 0x22; | |
| 3689 | ip_select_values[3] = 0x23; | |
| 3690 | ip_select_values[4] = 0x24; | |
| 3690 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3691 | state->ip_select_values[0] = 0x20; | |
| 3692 | state->ip_select_values[1] = 0x21; | |
| 3693 | state->ip_select_values[2] = 0x22; | |
| 3694 | state->ip_select_values[3] = 0x23; | |
| 3695 | state->ip_select_values[4] = 0x24; | |
| 3691 | 3696 | } |
| 3692 | 3697 | |
| 3693 | 3698 | static READ16_HANDLER( edfbl_input_r ) |
| r10886 | r10887 | |
| 3713 | 3718 | |
| 3714 | 3719 | static DRIVER_INIT( hayaosi1 ) |
| 3715 | 3720 | { |
| 3716 | ip_select_values[0] = 0x51; | |
| 3717 | ip_select_values[1] = 0x52; | |
| 3718 | ip_select_values[2] = 0x53; | |
| 3719 | ip_select_values[3] = 0x54; | |
| 3720 | ip_select_values[4] = 0x55; | |
| 3721 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3722 | state->ip_select_values[0] = 0x51; | |
| 3723 | state->ip_select_values[1] = 0x52; | |
| 3724 | state->ip_select_values[2] = 0x53; | |
| 3725 | state->ip_select_values[3] = 0x54; | |
| 3726 | state->ip_select_values[4] = 0x55; | |
| 3721 | 3727 | } |
| 3722 | 3728 | |
| 3723 | 3729 | static DRIVER_INIT( iganinju ) |
| r10886 | r10887 | |
| 3837 | 3843 | |
| 3838 | 3844 | static DRIVER_INIT( monkelf ) |
| 3839 | 3845 | { |
| 3846 | megasys1_state *state = machine->driver_data<megasys1_state>(); | |
| 3840 | 3847 | UINT16 *ROM = (UINT16*)machine->region("maincpu")->base(); |
| 3841 | 3848 | ROM[0x00744/2] = 0x4e71; |
| 3842 | 3849 | |
| 3843 | 3850 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe0000, 0xe000f, 0, 0, monkelf_input_r); |
| 3844 | 3851 | |
| 3845 | | |
| 3852 | | |
| 3846 | 3853 | |
| 3847 | 3854 | } |
| 3848 | 3855 | |
| r10886 | r10887 | |
| 3866 | 3873 | GAME( 1989, hachoo, 0, system_A_hachoo, hachoo, hachoo, ROT0, "Jaleco", "Hachoo!", 0 ) |
| 3867 | 3874 | GAME( 1989, jitsupro, 0, system_A, jitsupro, jitsupro, ROT0, "Jaleco", "Jitsuryoku!! Pro Yakyuu (Japan)", 0 ) |
| 3868 | 3875 | GAME( 1989, plusalph, 0, system_A, plusalph, plusalph, ROT270, "Jaleco", "Plus Alpha", 0 ) |
| 3869 | GAME( 1989, stdragon, 0, system_A, stdragon, stdragon, ROT0, "Jaleco", "Saint Dragon", 0 ) | |
| 3876 | GAME( 1989, stdragon, 0, system_A, stdragon, stdragon, ROT0, "Jaleco", "Tensei Ryuu Saint Dragon", 0 ) | |
| 3870 | 3877 | GAME( 1990, rodland, 0, system_A, rodland, rodland, ROT0, "Jaleco", "Rod-Land (World)", 0 ) |
| 3871 | 3878 | GAME( 1990, rodlandj, rodland, system_A, rodland, rodlandj, ROT0, "Jaleco", "Rod-Land (Japan)", 0 ) |
| 3872 | 3879 | GAME( 1990, rodlandjb,rodland, system_A, rodland, 0, ROT0, "bootleg","Rod-Land (Japan bootleg)", 0 ) |
| r10886 | r10887 | |
|---|---|---|
| 200 | 200 | AM_RANGE(0x0800, 0x0fff) AM_RAM |
| 201 | 201 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(bwing_videoram_w) AM_BASE_MEMBER(bwing_state, videoram) |
| 202 | 202 | AM_RANGE(0x1400, 0x17ff) AM_RAM |
| 203 | AM_RANGE(0x1800, 0x19ff) AM_RAM_WRITE(bwing_spriteram_w) AM_BASE_ | |
| 203 | AM_RANGE(0x1800, 0x19ff) AM_RAM_WRITE(bwing_spriteram_w) AM_BASE_MEMBER | |
| 204 | 204 | AM_RANGE(0x1a00, 0x1aff) AM_RAM_WRITE(bwing_paletteram_w) AM_BASE_MEMBER(bwing_state, paletteram) |
| 205 | 205 | AM_RANGE(0x1b00, 0x1b07) AM_RAM_WRITE(bwing_scrollreg_w) |
| 206 | 206 | AM_RANGE(0x1c00, 0x1c07) AM_RAM_WRITE(bwp1_ctrl_w) |
| r10886 | r10887 | |
|---|---|---|
| 29 | 29 | #define NUM_PENS (16) |
| 30 | 30 | #define RAM_PALETTE_SIZE (1024) |
| 31 | 31 | |
| 32 | static pen_t pens[NUM_PENS]; | |
| 33 | 32 | |
| 34 | static UINT8 *ram_attr; | |
| 35 | static UINT8 *ram_video; | |
| 36 | static UINT8 *ram_palette; | |
| 37 | static UINT8 *backup_ram; | |
| 33 | class slotcarn_state : public driver_device | |
| 34 | { | |
| 35 | public: | |
| 36 | slotcarn_state(running_machine &machine, const driver_device_config_base &config) | |
| 37 | : driver_device(machine, config) { } | |
| 38 | 38 | |
| 39 | pen_t pens[NUM_PENS]; | |
| 40 | UINT8 *ram_attr; | |
| 41 | UINT8 *ram_video; | |
| 42 | UINT8 *ram_palette; | |
| 43 | UINT8 *backup_ram; | |
| 44 | }; | |
| 45 | ||
| 46 | ||
| 39 | 47 | /* |
| 40 | 48 | |
| 41 | 49 | b800-b803 = PPI (9b) III mode0 all. |
| r10886 | r10887 | |
| 48 | 56 | |
| 49 | 57 | static READ8_HANDLER( palette_r ) |
| 50 | 58 | { |
| 59 | slotcarn_state *state = space->machine->driver_data<slotcarn_state>(); | |
| 51 | 60 | int co; |
| 52 | 61 | |
| 53 | co = ((ram_attr[offset] & 0x7F) << 3) | (offset & 0x07); | |
| 54 | return ram_palette[co]; | |
| 62 | co = ((state->ram_attr[offset] & 0x7F) << 3) | (offset & 0x07); | |
| 63 | return state->ram_palette[co]; | |
| 55 | 64 | } |
| 56 | 65 | |
| 57 | 66 | static WRITE8_HANDLER( palette_w ) |
| 58 | 67 | { |
| 68 | slotcarn_state *state = space->machine->driver_data<slotcarn_state>(); | |
| 59 | 69 | int co; |
| 60 | 70 | |
| 61 | 71 | space->machine->primary_screen->update_now(); |
| 62 | 72 | data &= 0x0f; |
| 63 | 73 | |
| 64 | co = ((ram_attr[offset] & 0x7F) << 3) | (offset & 0x07); | |
| 65 | ram_palette[co] = data; | |
| 74 | co = ((state->ram_attr[offset] & 0x7F) << 3) | (offset & 0x07); | |
| 75 | state->ram_palette[co] = data; | |
| 66 | 76 | |
| 67 | 77 | } |
| 68 | 78 | |
| 69 | 79 | |
| 70 | 80 | static MC6845_BEGIN_UPDATE( begin_update ) |
| 71 | 81 | { |
| 82 | slotcarn_state *state = device->machine->driver_data<slotcarn_state>(); | |
| 72 | 83 | int i; |
| 73 | 84 | int dim, bit0, bit1, bit2; |
| 74 | 85 | |
| r10886 | r10887 | |
| 78 | 89 | bit0 = BIT(i,0); |
| 79 | 90 | bit1 = BIT(i,1); |
| 80 | 91 | bit2 = BIT(i,2); |
| 81 | pens[i] = MAKE_RGB(dim*bit0, dim*bit1, dim*bit2); | |
| 92 | state->pens[i] = MAKE_RGB(dim*bit0, dim*bit1, dim*bit2); | |
| 82 | 93 | } |
| 83 | 94 | |
| 84 | return pens; | |
| 95 | return state->pens; | |
| 85 | 96 | } |
| 86 | 97 | |
| 87 | 98 | |
| 88 | 99 | static MC6845_UPDATE_ROW( update_row ) |
| 89 | 100 | { |
| 101 | slotcarn_state *state = device->machine->driver_data<slotcarn_state>(); | |
| 90 | 102 | int extra_video_bank_bit = 0; // not used? |
| 91 | 103 | int lscnblk = 0; // not used? |
| 92 | 104 | |
| r10886 | r10887 | |
| 105 | 117 | for (cx = 0; cx < x_count; cx++) |
| 106 | 118 | { |
| 107 | 119 | int i; |
| 108 | int attr = ram_attr[ma & 0x7ff]; | |
| 120 | int attr = state->ram_attr[ma & 0x7ff]; | |
| 109 | 121 | int region = (attr & 0x40) >> 6; |
| 110 | int addr = ((ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f); | |
| 122 | int addr = ((state->ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f); | |
| 111 | 123 | int colour = (attr & 0x7f) << 3; |
| 112 | 124 | UINT8 *data; |
| 113 | 125 | |
| r10886 | r10887 | |
| 127 | 139 | else |
| 128 | 140 | col |= 0x03; |
| 129 | 141 | |
| 130 | col = ram_palette[col & 0x3ff]; | |
| 142 | col = state->ram_palette[col & 0x3ff]; | |
| 131 | 143 | *BITMAP_ADDR32(bitmap, y, x) = pens[col ? col : (lscnblk ? 8 : 0)]; |
| 132 | 144 | |
| 133 | 145 | x++; |
| r10886 | r10887 | |
| 169 | 181 | |
| 170 | 182 | static ADDRESS_MAP_START( slotcarn_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 171 | 183 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 172 | AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE( | |
| 184 | AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE_MEMBER(slotcarn_state, backup_ram) | |
| 173 | 185 | AM_RANGE(0x6800, 0x6fff) AM_RAM // spielbud |
| 174 | 186 | AM_RANGE(0x7000, 0xafff) AM_ROM // spielbud |
| 175 | 187 | |
| r10886 | r10887 | |
| 189 | 201 | AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w) |
| 190 | 202 | AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w) |
| 191 | 203 | |
| 192 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&ram_attr) | |
| 193 | AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(&ram_video) | |
| 204 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(slotcarn_state, ram_attr) | |
| 205 | AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(slotcarn_state, ram_video) | |
| 194 | 206 | AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w) |
| 195 | 207 | ADDRESS_MAP_END |
| 196 | 208 | |
| r10886 | r10887 | |
| 534 | 546 | |
| 535 | 547 | static MACHINE_START(merit) |
| 536 | 548 | { |
| 537 | ram_palette = auto_alloc_array(machine, UINT8, RAM_PALETTE_SIZE); | |
| 538 | state_save_register_global_pointer(machine, ram_palette, RAM_PALETTE_SIZE); | |
| 549 | slotcarn_state *state = machine->driver_data<slotcarn_state>(); | |
| 550 | state->ram_palette = auto_alloc_array(machine, UINT8, RAM_PALETTE_SIZE); | |
| 551 | state_save_register_global_pointer(machine, state->ram_palette, RAM_PALETTE_SIZE); | |
| 539 | 552 | } |
| 540 | 553 | |
| 541 | 554 | |
| r10886 | r10887 | |
| 591 | 604 | * Machine Driver * |
| 592 | 605 | ***********************************/ |
| 593 | 606 | |
| 594 | static MACHINE_CONFIG_START( slotcarn, | |
| 607 | static MACHINE_CONFIG_START( slotcarn, slotcarn | |
| 595 | 608 | |
| 596 | 609 | /* basic machine hardware */ |
| 597 | 610 | MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) // 2.5 Mhz? |
| r10886 | r10887 | |
|---|---|---|
| 716 | 716 | ROM_LOAD( "b73_01.1b", 0x140000, 0x010000, CRC(3a8a4489) SHA1(a01d7300015f90ce6dd571ad93e7a58270a99e47) ) |
| 717 | 717 | ROM_LOAD( "b73_02.1c", 0x160000, 0x010000, CRC(025c536c) SHA1(075e95cc39e792049ae656404e7f7440df064391) ) |
| 718 | 718 | ROM_LOAD( "b73_03.1d", 0x180000, 0x010000, CRC(ec6020cf) SHA1(2973aa2dc3deb2f27c9f1bad07a7664bad95b3f2) ) |
| 719 | /* 0x190000, 0x010000 no data */ | |
| 719 | 720 | ROM_LOAD( "b73_04.1f", 0x1a0000, 0x010000, CRC(f7badbb2) SHA1(d824ab4aba94d7ca02401f4f6f34213143c282ec) ) |
| 721 | /* 0x1b0000, 0x010000 no data */ | |
| 720 | 722 | ROM_LOAD( "b73_05.1h", 0x1c0000, 0x010000, CRC(b8e829d2) SHA1(31102358500d7b58173d4f18647decf5db744416) ) |
| 721 | 723 | |
| 722 | 724 | ROM_REGION( 0x80000, "gfx2", 0 ) |
| r10886 | r10887 | |
| 736 | 738 | ROM_REGION( 0x1000, "mermaid", 0 ) |
| 737 | 739 | ROM_LOAD( "mermaid.bin", 0x0000, 0x0e00, CRC(88c5dd27) SHA1(5043fed7fd192891be7e4096f2c5daaae1538bc4) ) |
| 738 | 740 | |
| 739 | ROM_REGION( 0x200000, "gfx1", 0 ) | |
| 741 | ROM_REGION( 0x200000, "gfx1", 0 ) /* note, the rom ordering on this is different to the other Japan set */ | |
| 740 | 742 | ROM_LOAD( "b73_08.2f", 0x000000, 0x080000, CRC(f83dd808) SHA1(09d5f1e86fad3a0d2d3ac1845103d3f2833c6793) ) |
| 741 | 743 | ROM_LOAD( "b73_07.2c", 0x100000, 0x010000, CRC(5cffa42c) SHA1(687e047345039479b35d5099e56dbc1d57284ed9) ) |
| 742 | 744 | ROM_LOAD( "b73_06.2b", 0x110000, 0x010000, CRC(a98e4aea) SHA1(560fef03ad818894c9c7578c6282d55b646e8129) ) |
| r10886 | r10887 | |
| 750 | 752 | ROM_LOAD( "b73_09.2p", 0x000000, 0x080000, CRC(537c647f) SHA1(941c0f4e251bc68e53d62e70b033a3a6c145bb7e) ) |
| 751 | 753 | ROM_END |
| 752 | 754 | |
| 753 | ROM_START( hvyunito ) | |
| 755 | ROM_START( hvyunitjo ) | |
| 754 | 756 | ROM_REGION( 0x20000, "master", 0 ) |
| 755 | 757 | ROM_LOAD( "b73_13.5c", 0x00000, 0x20000, CRC(e2874601) SHA1(7f7f3287113b8622eb365d04135d2d9c35d70554) ) |
| 756 | 758 | |
| r10886 | r10887 | |
| 770 | 772 | ROM_LOAD( "b73_01.1b", 0x140000, 0x010000, CRC(3a8a4489) SHA1(a01d7300015f90ce6dd571ad93e7a58270a99e47) ) |
| 771 | 773 | ROM_LOAD( "b73_02.1c", 0x160000, 0x010000, CRC(025c536c) SHA1(075e95cc39e792049ae656404e7f7440df064391) ) |
| 772 | 774 | ROM_LOAD( "b73_03.1d", 0x180000, 0x010000, CRC(ec6020cf) SHA1(2973aa2dc3deb2f27c9f1bad07a7664bad95b3f2) ) |
| 775 | /* 0x190000, 0x010000 no data */ | |
| 773 | 776 | ROM_LOAD( "b73_04.1f", 0x1a0000, 0x010000, CRC(f7badbb2) SHA1(d824ab4aba94d7ca02401f4f6f34213143c282ec) ) |
| 777 | /* 0x1b0000, 0x010000 no data */ | |
| 774 | 778 | ROM_LOAD( "b73_05.1h", 0x1c0000, 0x010000, CRC(b8e829d2) SHA1(31102358500d7b58173d4f18647decf5db744416) ) |
| 775 | 779 | |
| 776 | 780 | ROM_REGION( 0x80000, "gfx2", 0 ) |
| 777 | 781 | ROM_LOAD( "b73_09.2p", 0x000000, 0x080000, CRC(537c647f) SHA1(941c0f4e251bc68e53d62e70b033a3a6c145bb7e) ) |
| 778 | 782 | ROM_END |
| 779 | 783 | |
| 784 | ROM_START( hvyunitu ) | |
| 785 | ROM_REGION( 0x20000, "master", 0 ) | |
| 786 | ROM_LOAD( "b73_34.5c", 0x00000, 0x20000, CRC(05c30a90) SHA1(97cc0ded2896e0945d790247c284e5058c28c735) ) | |
| 780 | 787 | |
| 788 | ROM_REGION( 0x10000, "slave", 0 ) | |
| 789 | ROM_LOAD( "b73_35.6p", 0x00000, 0x10000, CRC(aed1669d) SHA1(d0539261d6128fa2d58b529e8383b6d1f3ccac77) ) | |
| 790 | ||
| 791 | ROM_REGION( 0x10000, "soundcpu", 0 ) | |
| 792 | ROM_LOAD( "b73_12.7e", 0x000000, 0x010000, CRC(d1d24fab) SHA1(ed0312535d0b136d79aa885b9e6eea19ebde6409) ) | |
| 793 | ||
| 794 | ROM_REGION( 0x1000, "mermaid", 0 ) | |
| 795 | ROM_LOAD( "mermaid.bin", 0x0000, 0x0e00, CRC(88c5dd27) SHA1(5043fed7fd192891be7e4096f2c5daaae1538bc4) ) | |
| 796 | ||
| 797 | ROM_REGION( 0x200000, "gfx1", 0 ) | |
| 798 | ROM_LOAD( "b73_08.2f", 0x000000, 0x080000, CRC(f83dd808) SHA1(09d5f1e86fad3a0d2d3ac1845103d3f2833c6793) ) | |
| 799 | ROM_LOAD( "b73_28.2c", 0x100000, 0x020000, CRC(a02e08d6) SHA1(72764d4e8474aaac0674fd1c20278a706da7ade2) ) | |
| 800 | ROM_LOAD( "b73_27.2b", 0x120000, 0x020000, CRC(8708f97c) SHA1(ccddc7f2fa53c5e35345c2db0520f515c512b723) ) | |
| 801 | ROM_LOAD( "b73_25.0b", 0x140000, 0x020000, CRC(2f13f81e) SHA1(9d9c1869bf582a0bc0581cdf5b65237124b9e456) ) /* the data in first half of this actually differs slightly to the other sets, a 0x22 fill is replaced by 0xff on empty tiles */ | |
| 802 | ROM_LOAD( "b73_26.0c", 0x160000, 0x010000, CRC(b8e829d2) SHA1(31102358500d7b58173d4f18647decf5db744416) ) /* == b73_05.1h, despite the different label */ | |
| 803 | ||
| 804 | ROM_REGION( 0x80000, "gfx2", 0 ) | |
| 805 | ROM_LOAD( "b73_09.2p", 0x000000, 0x080000, CRC(537c647f) SHA1(941c0f4e251bc68e53d62e70b033a3a6c145bb7e) ) | |
| 806 | ROM_END | |
| 807 | ||
| 808 | ||
| 781 | 809 | /************************************* |
| 782 | 810 | * |
| 783 | 811 | * Game driver(s) |
| r10886 | r10887 | |
| 786 | 814 | |
| 787 | 815 | GAME( 1988, hvyunit, 0, hvyunit, hvyunit, 0, ROT0, "Kaneko / Taito", "Heavy Unit (World)", GAME_NO_COCKTAIL ) |
| 788 | 816 | GAME( 1988, hvyunitj, hvyunit, hvyunit, hvyunitj, 0, ROT0, "Kaneko / Taito", "Heavy Unit (Japan, Newer)", GAME_NO_COCKTAIL ) |
| 789 | GAME( 1988, hvyunito, hvyunit, hvyunit, hvyunitj, 0, ROT0, "Kaneko / Taito", "Heavy Unit (Japan, Older)", GAME_NO_COCKTAIL ) | |
| 817 | GAME( 1988, hvyunitjo,hvyunit, hvyunit, hvyunitj, 0, ROT0, "Kaneko / Taito", "Heavy Unit (Japan, Older)", GAME_NO_COCKTAIL ) | |
| 818 | GAME( 1988, hvyunitu, hvyunit, hvyunit, hvyunitj, 0, ROT0, "Kaneko / Taito", "Heavy Unit -U.S.A. Version- (US)", GAME_NO_COCKTAIL ) |
| r10886 | r10887 | |
|---|---|---|
| 244 | 244 | { |
| 245 | 245 | 0x82,0xc7,0x00,0x2c,0x6c,0x00,0x9f,0xc7,0x00,0x29,0x69,0x00,0x8b,0xc7,0x00 |
| 246 | 246 | }; |
| 247 | static int prot_count; | |
| 248 | 247 | |
| 249 | 248 | int res; |
| 250 | 249 | |
| r10886 | r10887 | |
| 252 | 251 | else if (cpu_get_pc(space->cpu)==0x8ce) res = (state->mainram[0x9064/2])|0x60; /* Task Force Harrier */ |
| 253 | 252 | else |
| 254 | 253 | { |
| 255 | res = to_main[prot_count++]; | |
| 256 | if (prot_count > sizeof(to_main)) | |
| 257 | prot_count = 0; | |
| 254 | res = to_main[state->prot_count++]; | |
| 255 | if (state->prot_count > sizeof(to_main)) | |
| 256 | state->prot_count = 0; | |
| 258 | 257 | } |
| 259 | 258 | |
| 260 | 259 | return res << 8; |
| r10886 | r10887 | |
| 736 | 735 | static void mcu_run(running_machine *machine, UINT8 dsw_setting) |
| 737 | 736 | { |
| 738 | 737 | nmk16_state *state = machine->driver_data<nmk16_state>(); |
| 739 | static UINT8 input_pressed; | |
| 740 | 738 | UINT16 coin_input; |
| 741 | 739 | UINT8 dsw[2]; |
| 742 | static UINT8 start_helper = 0; | |
| 743 | static UINT8 coin_count[2],coin_count_frac[2]; | |
| 744 | 740 | UINT8 i; |
| 745 | 741 | |
| 746 | 742 | /*Accept the start button but needs some m68k processing first,otherwise you can't start a play with 1 credit inserted*/ |
| 747 | if(start_helper & 1 && state->mainram[0x9000/2] & 0x0200) /*start 1 */ | |
| 743 | if(state->start_helper & 1 && state->mainram[0x9000/2] & 0x0200) /*start 1 */ | |
| 748 | 744 | { |
| 749 | 745 | state->mainram[0xef00/2]--; |
| 750 | start_helper = start_helper & 2; | |
| 746 | state->start_helper = state->start_helper & 2; | |
| 751 | 747 | } |
| 752 | if(start_helper & 2 && state->mainram[0x9000/2] & 0x0100) /*start 2*/ | |
| 748 | if(state->start_helper & 2 && state->mainram[0x9000/2] & 0x0100) /*start 2*/ | |
| 753 | 749 | { |
| 754 | 750 | state->mainram[0xef00/2]--; |
| 755 | start_helper = start_helper & 1; | |
| 751 | state->start_helper = state->start_helper & 1; | |
| 756 | 752 | } |
| 757 | 753 | |
| 758 | 754 | /*needed because of the uncompatibility of the dsw settings.*/ |
| r10886 | r10887 | |
| 765 | 761 | switch(dsw[i] & 7) |
| 766 | 762 | { |
| 767 | 763 | case 0: state->mainram[0x9000/2]|=0x4000; break; //free play |
| 768 | case 1: coin_count_frac[i] = 1; coin_count[i] = 4; break; | |
| 769 | case 2: coin_count_frac[i] = 1; coin_count[i] = 3; break; | |
| 770 | case 3: coin_count_frac[i] = 1; coin_count[i] = 2; break; | |
| 771 | case 4: coin_count_frac[i] = 4; coin_count[i] = 1; break; | |
| 772 | case 5: coin_count_frac[i] = 3; coin_count[i] = 1; break; | |
| 773 | case 6: coin_count_frac[i] = 2; coin_count[i] = 1; break; | |
| 774 | case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; | |
| 764 | case 1: state->coin_count_frac[i] = 1; state->coin_count[i] = 4; break; | |
| 765 | case 2: state->coin_count_frac[i] = 1; state->coin_count[i] = 3; break; | |
| 766 | case 3: state->coin_count_frac[i] = 1; state->coin_count[i] = 2; break; | |
| 767 | case 4: state->coin_count_frac[i] = 4; state->coin_count[i] = 1; break; | |
| 768 | case 5: state->coin_count_frac[i] = 3; state->coin_count[i] = 1; break; | |
| 769 | case 6: state->coin_count_frac[i] = 2; state->coin_count[i] = 1; break; | |
| 770 | case 7: state->coin_count_frac[i] = 1; state->coin_count[i] = 1; break; | |
| 775 | 771 | } |
| 776 | 772 | } |
| 777 | 773 | } |
| r10886 | r10887 | |
| 784 | 780 | switch(dsw[i] & 7) |
| 785 | 781 | { |
| 786 | 782 | case 0: state->mainram[0x9000/2]|=0x4000; break; //free play |
| 787 | case 1: coin_count_frac[i] = 4; coin_count[i] = 1; break; | |
| 788 | case 2: coin_count_frac[i] = 3; coin_count[i] = 1; break; | |
| 789 | case 3: coin_count_frac[i] = 2; coin_count[i] = 1; break; | |
| 790 | case 4: coin_count_frac[i] = 1; coin_count[i] = 4; break; | |
| 791 | case 5: coin_count_frac[i] = 1; coin_count[i] = 3; break; | |
| 792 | case 6: coin_count_frac[i] = 1; coin_count[i] = 2; break; | |
| 793 | case 7: coin_count_frac[i] = 1; coin_count[i] = 1; break; | |
| 783 | case 1: state->coin_count_frac[i] = 4; state->coin_count[i] = 1; break; | |
| 784 | case 2: state->coin_count_frac[i] = 3; state->coin_count[i] = 1; break; | |
| 785 | case 3: state->coin_count_frac[i] = 2; state->coin_count[i] = 1; break; | |
| 786 | case 4: state->coin_count_frac[i] = 1; state->coin_count[i] = 4; break; | |
| 787 | case 5: state->coin_count_frac[i] = 1; state->coin_count[i] = 3; break; | |
| 788 | case 6: state->coin_count_frac[i] = 1; state->coin_count[i] = 2; break; | |
| 789 | case 7: state->coin_count_frac[i] = 1; state->coin_count[i] = 1; break; | |
| 794 | 790 | } |
| 795 | 791 | } |
| 796 | 792 | } |
| r10886 | r10887 | |
| 800 | 796 | |
| 801 | 797 | if(coin_input & 0x01)//coin 1 |
| 802 | 798 | { |
| 803 | if((input_pressed & 0x01) == 0) | |
| 799 | if((state->input_pressed & 0x01) == 0) | |
| 804 | 800 | { |
| 805 | if(coin_count_frac[0] != 1) | |
| 801 | if(state->coin_count_frac[0] != 1) | |
| 806 | 802 | { |
| 807 | state->mainram[0xef02/2]+=coin_count[0]; | |
| 808 | if(coin_count_frac[0] == state->mainram[0xef02/2]) | |
| 803 | state->mainram[0xef02/2]+=state->coin_count[0]; | |
| 804 | if(state->coin_count_frac[0] == state->mainram[0xef02/2]) | |
| 809 | 805 | { |
| 810 | state->mainram[0xef00/2]+=coin_count[0]; | |
| 806 | state->mainram[0xef00/2]+=state->coin_count[0]; | |
| 811 | 807 | state->mainram[0xef02/2] = 0; |
| 812 | 808 | } |
| 813 | 809 | } |
| 814 | 810 | else |
| 815 | state->mainram[0xef00/2]+=coin_count[0]; | |
| 811 | state->mainram[0xef00/2]+=state->coin_count[0]; | |
| 816 | 812 | } |
| 817 | input_pressed = (input_pressed & 0xfe) | 1; | |
| 813 | state->input_pressed = (state->input_pressed & 0xfe) | 1; | |
| 818 | 814 | } |
| 819 | 815 | else |
| 820 | input_pressed = (input_pressed & 0xfe); | |
| 816 | state->input_pressed = (state->input_pressed & 0xfe); | |
| 821 | 817 | |
| 822 | 818 | if(coin_input & 0x02)//coin 2 |
| 823 | 819 | { |
| 824 | if((input_pressed & 0x02) == 0) | |
| 820 | if((state->input_pressed & 0x02) == 0) | |
| 825 | 821 | { |
| 826 | if(coin_count_frac[1] != 1) | |
| 822 | if(state->coin_count_frac[1] != 1) | |
| 827 | 823 | { |
| 828 | state->mainram[0xef02/2]+=coin_count[1]; | |
| 829 | if(coin_count_frac[1] == state->mainram[0xef02/2]) | |
| 824 | state->mainram[0xef02/2]+=state->coin_count[1]; | |
| 825 | if(state->coin_count_frac[1] == state->mainram[0xef02/2]) | |
| 830 | 826 | { |
| 831 | state->mainram[0xef00/2]+=coin_count[1]; | |
| 827 | state->mainram[0xef00/2]+=state->coin_count[1]; | |
| 832 | 828 | state->mainram[0xef02/2] = 0; |
| 833 | 829 | } |
| 834 | 830 | } |
| 835 | 831 | else |
| 836 | state->mainram[0xef00/2]+=coin_count[1]; | |
| 832 | state->mainram[0xef00/2]+=state->coin_count[1]; | |
| 837 | 833 | } |
| 838 | input_pressed = (input_pressed & 0xfd) | 2; | |
| 834 | state->input_pressed = (state->input_pressed & 0xfd) | 2; | |
| 839 | 835 | } |
| 840 | 836 | else |
| 841 | input_pressed = (input_pressed & 0xfd); | |
| 837 | state->input_pressed = (state->input_pressed & 0xfd); | |
| 842 | 838 | |
| 843 | 839 | if(coin_input & 0x04)//service 1 |
| 844 | 840 | { |
| 845 | if((input_pressed & 0x04) == 0) | |
| 841 | if((state->input_pressed & 0x04) == 0) | |
| 846 | 842 | state->mainram[0xef00/2]++; |
| 847 | input_pressed = (input_pressed & 0xfb) | 4; | |
| 843 | state->input_pressed = (state->input_pressed & 0xfb) | 4; | |
| 848 | 844 | } |
| 849 | 845 | else |
| 850 | input_pressed = (input_pressed & 0xfb); | |
| 846 | state->input_pressed = (state->input_pressed & 0xfb); | |
| 851 | 847 | |
| 852 | 848 | /*The 0x9000 ram address is the status */ |
| 853 | 849 | if(state->mainram[0xef00/2] > 0 && state->mainram[0x9000/2] & 0x8000) //enable start button |
| 854 | 850 | { |
| 855 | 851 | if(coin_input & 0x08)//start 1 |
| 856 | 852 | { |
| 857 | if((input_pressed & 0x08) == 0 && (!(state->mainram[0x9000/2] & 0x0200))) //start 1 | |
| 858 | start_helper = 1; | |
| 853 | if((state->input_pressed & 0x08) == 0 && (!(state->mainram[0x9000/2] & 0x0200))) //start 1 | |
| 854 | state->start_helper = 1; | |
| 859 | 855 | |
| 860 | input_pressed = (input_pressed & 0xf7) | 8; | |
| 856 | state->input_pressed = (state->input_pressed & 0xf7) | 8; | |
| 861 | 857 | } |
| 862 | 858 | else |
| 863 | input_pressed = (input_pressed & 0xf7); | |
| 859 | state->input_pressed = (state->input_pressed & 0xf7); | |
| 864 | 860 | |
| 865 | 861 | if(coin_input & 0x10)//start 2 |
| 866 | 862 | { |
| 867 | 863 | /*Decrease two coins to let two players play with one start 2 button and two credits inserted at the insert coin screen.*/ |
| 868 | if((input_pressed & 0x10) == 0 && (!(state->mainram[0x9000/2] & 0x0100))) // start 2 | |
| 869 | start_helper = (state->mainram[0x9000/2] == 0x8000) ? (3) : (2); | |
| 864 | if((state->input_pressed & 0x10) == 0 && (!(state->mainram[0x9000/2] & 0x0100))) // start 2 | |
| 865 | state->start_helper = (state->mainram[0x9000/2] == 0x8000) ? (3) : (2); | |
| 870 | 866 | |
| 871 | input_pressed = (input_pressed & 0xef) | 0x10; | |
| 867 | state->input_pressed = (state->input_pressed & 0xef) | 0x10; | |
| 872 | 868 | } |
| 873 | 869 | else |
| 874 | input_pressed = (input_pressed & 0xef); | |
| 870 | state->input_pressed = (state->input_pressed & 0xef); | |
| 875 | 871 | } |
| 876 | 872 | } |
| 877 | 873 |
| r10886 | r10887 | |
|---|---|---|
| 152 | 152 | #include "machine/nvram.h" |
| 153 | 153 | |
| 154 | 154 | |
| 155 | class miniboy7_state : public driver_device | |
| 156 | { | |
| 157 | public: | |
| 158 | miniboy7_state(running_machine &machine, const driver_device_config_base &config) | |
| 159 | : driver_device(machine, config) { } | |
| 160 | ||
| 161 | UINT8 *videoram; | |
| 162 | UINT8 *colorram; | |
| 163 | tilemap_t *bg_tilemap; | |
| 164 | }; | |
| 165 | ||
| 166 | ||
| 155 | 167 | /*********************************** |
| 156 | 168 | * Video Hardware * |
| 157 | 169 | ***********************************/ |
| 158 | 170 | |
| 159 | static UINT8 *videoram; | |
| 160 | static UINT8 *colorram; | |
| 161 | static tilemap_t *bg_tilemap; | |
| 162 | ||
| 163 | 171 | static WRITE8_HANDLER( miniboy7_videoram_w ) |
| 164 | 172 | { |
| 165 | videoram[offset] = data; | |
| 166 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 173 | miniboy7_state *state = space->machine->driver_data<miniboy7_state>(); | |
| 174 | state->videoram[offset] = data; | |
| 175 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 167 | 176 | } |
| 168 | 177 | |
| 169 | 178 | static WRITE8_HANDLER( miniboy7_colorram_w ) |
| 170 | 179 | { |
| 171 | colorram[offset] = data; | |
| 172 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 180 | miniboy7_state *state = space->machine->driver_data<miniboy7_state>(); | |
| 181 | state->colorram[offset] = data; | |
| 182 | tilemap_mark_tile_dirty(state->bg_tilemap, offset); | |
| 173 | 183 | } |
| 174 | 184 | |
| 175 | 185 | static TILE_GET_INFO( get_bg_tile_info ) |
| 176 | 186 | { |
| 187 | miniboy7_state *state = machine->driver_data<miniboy7_state>(); | |
| 177 | 188 | /* - bits - |
| 178 | 189 | 7654 3210 |
| 179 | 190 | --xx xx-- tiles color?. |
| 180 | 191 | ---- --x- tiles bank. |
| 181 | 192 | xx-- ---x seems unused. */ |
| 182 | 193 | |
| 183 | int attr = colorram[tile_index]; | |
| 184 | int code = videoram[tile_index]; | |
| 194 | int attr = state->colorram[tile_index]; | |
| 195 | int code = state->videoram[tile_index]; | |
| 185 | 196 | int bank = (attr & 0x02) >> 1; /* bit 1 switch the gfx banks */ |
| 186 | 197 | int color = (attr & 0x3c); /* bits 2-3-4-5 for color? */ |
| 187 | 198 | |
| r10886 | r10887 | |
| 193 | 204 | |
| 194 | 205 | static VIDEO_START( miniboy7 ) |
| 195 | 206 | { |
| 196 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 37, 37); | |
| 207 | miniboy7_state *state = machine->driver_data<miniboy7_state>(); | |
| 208 | state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 37, 37); | |
| 197 | 209 | } |
| 198 | 210 | |
| 199 | 211 | static SCREEN_UPDATE( miniboy7 ) |
| 200 | 212 | { |
| 201 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 213 | miniboy7_state *state = screen->machine->driver_data<miniboy7_state>(); | |
| 214 | tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); | |
| 202 | 215 | return 0; |
| 203 | 216 | } |
| 204 | 217 | |
| r10886 | r10887 | |
| 255 | 268 | |
| 256 | 269 | static ADDRESS_MAP_START( miniboy7_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 257 | 270 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") /* battery backed RAM? */ |
| 258 | AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(miniboy7_videoram_w) AM_BASE(&videoram) | |
| 259 | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(miniboy7_colorram_w) AM_BASE(&colorram) | |
| 271 | AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(miniboy7_videoram_w) AM_BASE_MEMBER(miniboy7_state, videoram) | |
| 272 | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(miniboy7_colorram_w) AM_BASE_MEMBER(miniboy7_state, colorram) | |
| 260 | 273 | AM_RANGE(0x1800, 0x25ff) AM_RAM /* looks like videoram */ |
| 261 | 274 | AM_RANGE(0x2600, 0x27ff) AM_RAM |
| 262 | 275 | AM_RANGE(0x2800, 0x2800) AM_DEVWRITE("crtc", mc6845_address_w) |
| r10886 | r10887 | |
| 429 | 442 | * Machine Drivers * |
| 430 | 443 | ***********************************/ |
| 431 | 444 | |
| 432 | static MACHINE_CONFIG_START( miniboy7, | |
| 445 | static MACHINE_CONFIG_START( miniboy7, m | |
| 433 | 446 | |
| 434 | 447 | /* basic machine hardware */ |
| 435 | 448 | MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/16) /* guess */ |
| r10886 | r10887 | |
|---|---|---|
| 34 | 34 | if (r&bit) { |
| 35 | 35 | SEC; |
| 36 | 36 | PC+=SIGNED(t); |
| 37 | ||
| 38 | if (t==0xfd) | |
| 39 | { | |
| 40 | /* speed up busy loops */ | |
| 41 | if(cpustate->iCount > 0) | |
| 42 | cpustate->iCount = 0; | |
| 43 | } | |
| 44 | 37 | } |
| 45 | 38 | } |
| 46 | 39 | |
| r10886 | r10887 | |
| 56 | 49 | if (!(r&bit)) { |
| 57 | 50 | CLC; |
| 58 | 51 | PC+=SIGNED(t); |
| 59 | ||
| 60 | if (t==0xfd) | |
| 61 | { | |
| 62 | /* speed up busy loops */ | |
| 63 | if(cpustate->iCount > 0) | |
| 64 | cpustate->iCount = 0; | |
| 65 | } | |
| 66 | 52 | } |
| 67 | 53 | } |
| 68 | 54 | |
| r10886 | r10887 | |
| 88 | 74 | UINT8 t; |
| 89 | 75 | IMMBYTE(t); |
| 90 | 76 | PC+=SIGNED(t); |
| 91 | if (t==0xfe) | |
| 92 | { | |
| 93 | /* speed up busy loops */ | |
| 94 | if(cpustate->iCount > 0) | |
| 95 | cpustate->iCount = 0; | |
| 96 | } | |
| 97 | 77 | } |
| 98 | 78 | |
| 99 | 79 | /* $21 BRN relative ---- */ |
| r10886 | r10887 | |
|---|---|---|
| 664 | 664 | case 0x85: EA=X+SIGNED(B); break; |
| 665 | 665 | case 0x86: EA=X+SIGNED(A); break; |
| 666 | 666 | case 0x87: EA=0; break; /* ILLEGAL*/ |
| 667 | case 0x88: IMMBYTE(EA); EA=X+SIGNED(EA); break; | |
| 667 | case 0x88: IMMBYTE(EA); EA=X+SIGNED(EA); break; | |
| 668 | 668 | case 0x89: IMMWORD(EAP); EA+=X; break; |
| 669 | 669 | case 0x8a: EA=0; break; /* IIError*/ |
| 670 | 670 | case 0x8b: EA=X+D; break; |
| r10886 | r10887 | |
|---|---|---|
| 195 | 195 | { |
| 196 | 196 | IMMWORD(EAP); |
| 197 | 197 | PC += EA; |
| 198 | ||
| 199 | if ( EA == 0xfffd ) /* EHC 980508 speed up busy loop */ | |
| 200 | if ( m68_state->icount > 0) | |
| 201 | m68_state->icount = 0; | |
| 202 | 198 | } |
| 203 | 199 | |
| 204 | 200 | /* $17 LBSR relative ----- */ |
| r10886 | r10887 | |
| 372 | 368 | UINT8 t; |
| 373 | 369 | IMMBYTE(t); |
| 374 | 370 | PC += SIGNED(t); |
| 375 | /* JB 970823 - speed up busy loops */ | |
| 376 | if( t == 0xfe ) | |
| 377 | if( m68_state->icount > 0 ) m68_state->icount = 0; | |
| 378 | 371 | } |
| 379 | 372 | |
| 380 | 373 | /* $21 BRN relative ----- */ |
| r10886 | r10887 | |
|---|---|---|
| 271 | 271 | { |
| 272 | 272 | IMMWORD(EAP); |
| 273 | 273 | PC += EA; |
| 274 | ||
| 275 | if ( EA == 0xfffd ) /* EHC 980508 speed up busy loop */ | |
| 276 | if ( m68_state->icount > 0) | |
| 277 | m68_state->icount = 0; | |
| 278 | 274 | } |
| 279 | 275 | |
| 280 | 276 | /* $17 LBSR relative ----- */ |
| r10886 | r10887 | |
| 479 | 475 | UINT8 t; |
| 480 | 476 | IMMBYTE(t); |
| 481 | 477 | PC += SIGNED(t); |
| 482 | /* JB 970823 - speed up busy loops */ | |
| 483 | if( t == 0xfe ) | |
| 484 | if( m68_state->icount > 0 ) m68_state->icount = 0; | |
| 485 | 478 | } |
| 486 | 479 | |
| 487 | 480 | /* $21 BRN relative ----- */ |
| r10886 | r10887 | |
|---|---|---|
| 35 | 35 | UINT8 FF2; // Flip-flop 2 |
| 36 | 36 | |
| 37 | 37 | legacy_cpu_device *device; |
| 38 | | |
| 38 | | |
| 39 | 39 | direct_read_data *direct; |
| 40 | const address_space *data; | |
| 41 | const address_space *io; | |
| 40 | address_space *data; | |
| 41 | address_space *io; | |
| 42 | 42 | |
| 43 | 43 | int icount; |
| 44 | 44 | }; |
| r10886 | r10887 | |
|---|---|---|
| 230 | 230 | UINT8 t; |
| 231 | 231 | IMMBYTE(t); |
| 232 | 232 | PC+=SIGNED(t); |
| 233 | /* speed up busy loops */ | |
| 234 | if (t==0xfe) EAT_CYCLES; | |
| 235 | 233 | } |
| 236 | 234 | |
| 237 | 235 | /* $21 BRN relative ----- */ |
| r10886 | r10887 | |
|---|---|---|
| 191 | 191 | { |
| 192 | 192 | IMMWORD(cpustate, cpustate->ea); |
| 193 | 193 | PC += EA; |
| 194 | ||
| 195 | /* EHC 980508 speed up busy loop */ | |
| 196 | if( EA == 0xfffd && cpustate->icount > 0 ) | |
| 197 | cpustate->icount = 0; | |
| 198 | 194 | } |
| 199 | 195 | |
| 200 | 196 | /* $17 LBSR relative ----- */ |
| r10886 | r10887 | |
| 301 | 297 | UINT8 t; |
| 302 | 298 | IMMBYTE(cpustate, t); |
| 303 | 299 | PC += SIGNED(t); |
| 304 | /* JB 970823 - speed up busy loops */ | |
| 305 | if( t == 0xfe && cpustate->icount > 0 ) | |
| 306 | cpustate->icount = 0; | |
| 307 | 300 | } |
| 308 | 301 | |
| 309 | 302 | /* $21 BRN relative ----- */ |
| r10886 | r10887 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | /* Some aliases */ |
| 89 | 89 | |
| 90 | #define RES_NET_VIN_MB7051 RES_NET_VIN_TTL_OUT | |
| 90 | 91 | #define RES_NET_VIN_MB7052 RES_NET_VIN_TTL_OUT |
| 91 | 92 | #define RES_NET_VIN_MB7053 RES_NET_VIN_TTL_OUT |
| 92 | 93 | #define RES_NET_VIN_28S42 RES_NET_VIN_TTL_OUT |
| r10886 | r10887 | |
|---|---|---|
| 232 | 232 | { |
| 233 | 233 | STATIC_INVALID = 0, // invalid - should never be used |
| 234 | 234 | STATIC_BANK1 = 1, // first memory bank |
| 235 | STATIC_BANKMAX = 122, // last memory bank | |
| 236 | STATIC_RAM, // RAM - reads/writes map to dynamic banks | |
| 237 | STATIC_ROM, // ROM - reads = RAM; writes = UNMAP | |
| 235 | STATIC_BANKMAX = 124, // last memory bank | |
| 238 | 236 | STATIC_NOP, // NOP - reads = unmapped value; writes = no-op |
| 239 | 237 | STATIC_UNMAP, // unmapped - same as NOP except we log errors |
| 240 | 238 | STATIC_WATCHPOINT, // watchpoint - used internally |
| r10886 | r10887 | |
| 1073 | 1071 | const handler_entry_read &handler = m_read.handler_read(entry); |
| 1074 | 1072 | |
| 1075 | 1073 | // 8-bit case: RAM/ROM |
| 1076 | if (entry > | |
| 1074 | if (entry > | |
| 1077 | 1075 | return NULL; |
| 1078 | 1076 | return handler.ramptr(handler.byteoffset(byteaddress)); |
| 1079 | 1077 | } |
| r10886 | r10887 | |
| 1087 | 1085 | const handler_entry_write &handler = m_write.handler_write(entry); |
| 1088 | 1086 | |
| 1089 | 1087 | // 8-bit case: RAM/ROM |
| 1090 | if (entry > | |
| 1088 | if (entry > | |
| 1091 | 1089 | return NULL; |
| 1092 | 1090 | return handler.ramptr(handler.byteoffset(byteaddress)); |
| 1093 | 1091 | } |
| r10886 | r10887 | |
| 1107 | 1105 | // either read directly from RAM, or call the delegate |
| 1108 | 1106 | offset = handler.byteoffset(byteaddress); |
| 1109 | 1107 | _NativeType result; |
| 1110 | if (entry < STATIC_ | |
| 1108 | if (entry <= STATIC_BANKMAX) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset)); | |
| 1111 | 1109 | else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, mask); |
| 1112 | 1110 | else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset >> 1, mask); |
| 1113 | 1111 | else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset >> 2, mask); |
| r10886 | r10887 | |
| 1132 | 1130 | // either read directly from RAM, or call the delegate |
| 1133 | 1131 | offset = handler.byteoffset(byteaddress); |
| 1134 | 1132 | _NativeType result; |
| 1135 | if (entry < STATIC_ | |
| 1133 | if (entry <= STATIC_BANKMAX) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset)); | |
| 1136 | 1134 | else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, 0xff); |
| 1137 | 1135 | else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset >> 1, 0xffff); |
| 1138 | 1136 | else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset >> 2, 0xffffffff); |
| r10886 | r10887 | |
| 1154 | 1152 | |
| 1155 | 1153 | // either write directly to RAM, or call the delegate |
| 1156 | 1154 | offset = handler.byteoffset(byteaddress); |
| 1157 | if (entry < STATIC_ | |
| 1155 | if (entry <= STATIC_BANKMAX) | |
| 1158 | 1156 | { |
| 1159 | 1157 | _NativeType *dest = reinterpret_cast<_NativeType *>(handler.ramptr(offset)); |
| 1160 | 1158 | *dest = (*dest & ~mask) | (data & mask); |
| r10886 | r10887 | |
| 1179 | 1177 | |
| 1180 | 1178 | // either write directly to RAM, or call the delegate |
| 1181 | 1179 | offset = handler.byteoffset(byteaddress); |
| 1182 | if (entry < STATIC_ | |
| 1180 | if (entry <= STATIC_BANKMAX) *reinterpret_cast<_NativeType *>(handler.ramptr(offset)) = data; | |
| 1183 | 1181 | else if (sizeof(_NativeType) == 1) handler.write8(*this, offset, data, 0xff); |
| 1184 | 1182 | else if (sizeof(_NativeType) == 2) handler.write16(*this, offset >> 1, data, 0xffff); |
| 1185 | 1183 | else if (sizeof(_NativeType) == 4) handler.write32(*this, offset >> 2, data, 0xffffffff); |
| r10886 | r10887 | |
| 3183 | 3181 | throw emu_fatalerror("Out of handler entries in address table"); |
| 3184 | 3182 | } |
| 3185 | 3183 | |
| 3186 | // configure the entry to our parameters | |
| 3184 | // configure the entry to our parameters (but not for static non-banked cases) | |
| 3187 | 3185 | handler_entry &curentry = handler(entry); |
| 3188 | curentry.configure(bytestart, byteend, bytemask); | |
| 3186 | if (entry <= STATIC_BANKMAX || entry >= STATIC_COUNT) | |
| 3187 | curentry.configure(bytestart, byteend, bytemask); | |
| 3189 | 3188 | |
| 3190 | 3189 | // populate it |
| 3191 | 3190 | populate_range_mirrored(bytestart, byteend, bytemirror, entry); |
| r10886 | r10887 | |
| 3931 | 3930 | direct_range *range = find_range(overrideaddress, m_entry); |
| 3932 | 3931 | |
| 3933 | 3932 | // if we don't map to a bank, return FALSE |
| 3934 | if (m_entry < STATIC_BANK1 || m_entry > | |
| 3933 | if (m_entry < STATIC_BANK1 || m_entry > | |
| 3935 | 3934 | { |
| 3936 | 3935 | // ensure future updates to land here as well until we get back into a bank |
| 3937 | 3936 | m_byteend = 0; |
| r10886 | r10887 | |
|---|---|---|
| 351 | 351 | int spacenum() const { return m_spacenum; } |
| 352 | 352 | address_map *map() const { return m_map; } |
| 353 | 353 | |
| 354 | direct_read_data &direct() const { return | |
| 354 | direct_read_data &direct() const { return | |
| 355 | 355 | |
| 356 | 356 | int data_width() const { return m_config.data_width(); } |
| 357 | 357 | int addr_width() const { return m_config.addr_width(); } |
| r10886 | r10887 | |
| 620 | 620 | |
| 621 | 621 | // wrappers for dynamic read handler installation |
| 622 | 622 | #define memory_install_read8_handler(space, start, end, mask, mirror, rhandler) \ |
| 623 | | |
| 623 | | |
| 624 | 624 | #define memory_install_read16_handler(space, start, end, mask, mirror, rhandler) \ |
| 625 | | |
| 625 | | |
| 626 | 626 | #define memory_install_read32_handler(space, start, end, mask, mirror, rhandler) \ |
| 627 | | |
| 627 | | |
| 628 | 628 | #define memory_install_read64_handler(space, start, end, mask, mirror, rhandler) \ |
| 629 | | |
| 629 | | |
| 630 | 630 | |
| 631 | 631 | #define memory_install_read8_device_handler(space, device, start, end, mask, mirror, rhandler) \ |
| 632 | | |
| 632 | | |
| 633 | 633 | #define memory_install_read16_device_handler(space, device, start, end, mask, mirror, rhandler) \ |
| 634 | | |
| 634 | | |
| 635 | 635 | #define memory_install_read32_device_handler(space, device, start, end, mask, mirror, rhandler) \ |
| 636 | | |
| 636 | | |
| 637 | 637 | #define memory_install_read64_device_handler(space, device, start, end, mask, mirror, rhandler) \ |
| 638 | | |
| 638 | | |
| 639 | 639 | |
| 640 | 640 | #define memory_install_read_port(space, start, end, mask, mirror, rtag) \ |
| 641 | | |
| 641 | | |
| 642 | 642 | #define memory_install_read_bank(space, start, end, mask, mirror, rtag) \ |
| 643 | | |
| 643 | | |
| 644 | 644 | #define memory_install_rom(space, start, end, mask, mirror, baseptr) \ |
| 645 | | |
| 645 | | |
| 646 | 646 | #define memory_unmap_read(space, start, end, mask, mirror) \ |
| 647 | | |
| 647 | | |
| 648 | 648 | #define memory_nop_read(space, start, end, mask, mirror) \ |
| 649 | | |
| 649 | | |
| 650 | 650 | |
| 651 | 651 | // wrappers for dynamic write handler installation |
| 652 | 652 | #define memory_install_write8_handler(space, start, end, mask, mirror, whandler) \ |
| 653 | | |
| 653 | | |
| 654 | 654 | #define memory_install_write16_handler(space, start, end, mask, mirror, whandler) \ |
| 655 | | |
| 655 | | |
| 656 | 656 | #define memory_install_write32_handler(space, start, end, mask, mirror, whandler) \ |
| 657 | | |
| 657 | | |
| 658 | 658 | #define memory_install_write64_handler(space, start, end, mask, mirror, whandler) \ |
| 659 | | |
| 659 | | |
| 660 | 660 | |
| 661 | 661 | #define memory_install_write8_device_handler(space, device, start, end, mask, mirror, whandler) \ |
| 662 | | |
| 662 | | |
| 663 | 663 | #define memory_install_write16_device_handler(space, device, start, end, mask, mirror, whandler) \ |
| 664 | | |
| 664 | | |
| 665 | 665 | #define memory_install_write32_device_handler(space, device, start, end, mask, mirror, whandler) \ |
| 666 | | |
| 666 | | |
| 667 | 667 | #define memory_install_write64_device_handler(space, device, start, end, mask, mirror, whandler) \ |
| 668 | | |
| 668 | | |
| 669 | 669 | |
| 670 | 670 | #define memory_install_write_port(space, start, end, mask, mirror, wtag) \ |
| 671 | | |
| 671 | | |
| 672 | 672 | #define memory_install_write_bank(space, start, end, mask, mirror, wtag) \ |
| 673 | | |
| 673 | | |
| 674 | 674 | #define memory_install_writeonly(space, start, end, mask, mirror, baseptr) \ |
| 675 | | |
| 675 | | |
| 676 | 676 | #define memory_unmap_write(space, start, end, mask, mirror) \ |
| 677 | | |
| 677 | | |
| 678 | 678 | #define memory_nop_write(space, start, end, mask, mirror) \ |
| 679 | | |
| 679 | | |
| 680 | 680 | |
| 681 | 681 | // wrappers for dynamic read/write handler installation |
| 682 | 682 | #define memory_install_readwrite8_handler(space, start, end, mask, mirror, rhandler, whandler) \ |
| 683 | | |
| 683 | | |
| 684 | 684 | #define memory_install_readwrite16_handler(space, start, end, mask, mirror, rhandler, whandler) \ |
| 685 | | |
| 685 | | |
| 686 | 686 | #define memory_install_readwrite32_handler(space, start, end, mask, mirror, rhandler, whandler) \ |
| 687 | | |
| 687 | | |
| 688 | 688 | #define memory_install_readwrite64_handler(space, start, end, mask, mirror, rhandler, whandler) \ |
| 689 | | |
| 689 | | |
| 690 | 690 | |
| 691 | 691 | #define memory_install_readwrite8_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \ |
| 692 | | |
| 692 | | |
| 693 | 693 | #define memory_install_readwrite16_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \ |
| 694 | | |
| 694 | | |
| 695 | 695 | #define memory_install_readwrite32_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \ |
| 696 | | |
| 696 | | |
| 697 | 697 | #define memory_install_readwrite64_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \ |
| 698 | | |
| 698 | | |
| 699 | 699 | |
| 700 | 700 | #define memory_install_readwrite_port(space, start, end, mask, mirror, rtag, wtag) \ |
| 701 | | |
| 701 | | |
| 702 | 702 | #define memory_install_readwrite_bank(space, start, end, mask, mirror, tag) \ |
| 703 | | |
| 703 | | |
| 704 | 704 | #define memory_install_ram(space, start, end, mask, mirror, baseptr) \ |
| 705 | | |
| 705 | | |
| 706 | 706 | #define memory_unmap_readwrite(space, start, end, mask, mirror) \ |
| 707 | | |
| 707 | | |
| 708 | 708 | #define memory_nop_readwrite(space, start, end, mask, mirror) \ |
| 709 | | |
| 709 | | |
| 710 | 710 | |
| 711 | 711 | |
| 712 | 712 |
| r10886 | r10887 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | DEVICE_START( s3c2400 ) |
| 47 | 47 | { |
| 48 | | |
| 48 | | |
| 49 | 49 | DEVICE_START_CALL(s3c24xx); |
| 50 | 50 | memory_install_readwrite32_device_handler( space, device, 0x14000000, 0x1400003b, 0, 0, s3c24xx_memcon_r, s3c24xx_memcon_w); |
| 51 | 51 | memory_install_readwrite32_device_handler( space, device, 0x14200000, 0x1420005b, 0, 0, s3c24xx_usb_host_r, s3c24xx_usb_host_w); |
| r10886 | r10887 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | DEVICE_START( s3c2410 ) |
| 47 | 47 | { |
| 48 | | |
| 48 | | |
| 49 | 49 | DEVICE_START_CALL(s3c24xx); |
| 50 | 50 | memory_install_readwrite32_device_handler( space, device, 0x48000000, 0x4800003b, 0, 0, s3c24xx_memcon_r, s3c24xx_memcon_w); |
| 51 | 51 | memory_install_readwrite32_device_handler( space, device, 0x49000000, 0x4900005b, 0, 0, s3c24xx_usb_host_r, s3c24xx_usb_host_w); |
| r10886 | r10887 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | DEVICE_START( s3c2440 ) |
| 47 | 47 | { |
| 48 | | |
| 48 | | |
| 49 | 49 | memory_install_readwrite32_device_handler( space, device, 0x48000000, 0x4800003b, 0, 0, s3c24xx_memcon_r, s3c24xx_memcon_w); |
| 50 | 50 | memory_install_readwrite32_device_handler( space, device, 0x49000000, 0x4900005b, 0, 0, s3c24xx_usb_host_r, s3c24xx_usb_host_w); |
| 51 | 51 | memory_install_readwrite32_device_handler( space, device, 0x4a000000, 0x4a00001f, 0, 0, s3c24xx_irq_r, s3c24xx_irq_w); |
| r10886 | r10887 | |
|---|---|---|
| 767 | 767 | |
| 768 | 768 | void vixen_state::machine_reset() |
| 769 | 769 | { |
| 770 | | |
| 770 | | |
| 771 | 771 | |
| 772 | 772 | memory_install_read_bank(program, 0x0000, 0xefff, 0xfff, 0, "bank1"); |
| 773 | 773 | memory_install_write_bank(program, 0x0000, 0xefff, 0xfff, 0, "bank2"); |
| r10886 | r10887 | |
| 870 | 870 | { |
| 871 | 871 | if (state->m_reset) |
| 872 | 872 | { |
| 873 | | |
| 873 | | |
| 874 | 874 | |
| 875 | 875 | memory_install_read_bank(program, 0x0000, 0xefff, 0, 0, "bank1"); |
| 876 | 876 | memory_install_write_bank(program, 0x0000, 0xefff, 0, 0, "bank2"); |
| Previous | 15994 Revisions | Next |