| Previous | 15994 Revisions | Next |
| r5956 Sunday 4th October, 2009 at 12:04:16 UTC by Nathan Woods |
|---|
| Updated to MAME 0.134u2 core |
| [docs] | messnew.txt |
| [src/emu] | devtempl.h drawgfx.h driver.h inptport.h input.c mame.c mconfig.h memory.c memory.h profiler.c profiler.h ui.c ui.h uigfx.c uimenu.c |
| [src/emu/cpu/arm] | arm.h armdasm.c |
| [src/emu/cpu/arm7] | arm7core.h arm7dasm.c |
| [src/emu/cpu/dsp56k] | dsp56k.c dsp56ops.c dsp56pcu.c |
| [src/emu/cpu/h83002] | h8_16.c h8_8.c |
| [src/emu/cpu/i960] | i960.c i960dis.c i960dis.h |
| [src/emu/cpu/m68000] | m68000.h m68k_in.c m68kcpu.c m68kcpu.h m68kdasm.c m68kmake.c |
| [src/emu/cpu/sh2] | sh2.h sh2comn.c sh2comn.h sh2dasm.c |
| [src/emu/cpu/sh4] | sh4.h sh4dasm.c |
| [src/emu/cpu/v60] | v60.h v60d.c |
| [src/emu/cpu/z180] | z180.h z180ops.h |
| [src/emu/debug] | debugcmd.c debugcon.c debugcon.h debugcpu.c express.c express.h |
| [src/emu/machine] | laserdsc.h |
| [src/emu/sound] | disc_dev.c disc_inp.c disc_mth.c disc_sys.c disc_wav.c discrete.c discrete.h tms5220.c |
| [src/mame] | mame.mak mamedriv.c tiny.c |
| [src/mame/audio] | dkong.c firetrk.c galaxian.c m79amb.c madalien.c mario.c mw8080bw.c polepos.c redbaron.c scramble.c skyraid.c snes.c snk6502.c sprint8.c* starshp1.c taito_en.c taito_en.h tank8.c |
| [src/mame/drivers] | 39in1.c aristmk5.c asuka.c bublbobl.c cloud9.c cps1.c galaxold.c galdrvr.c galpanic.c gottlieb.c jangou.c konamim2.c ksys573.c kyugo.c leland.c lucky74.c megadriv.c megadriv.h megaplay.c megatech.c midtunit.c mpu4.c mpu4drvr.c multfish.c mw8080bw.c namcoic.c namcona1.c namconb1.c namcos22.c naomi.c othello.c* photon2.c plygonet.c rallyx.c segae.c segag80r.c segamsys.c* segamsys.h* seicross.c seta.c sfbonus.c skyraid.c snk.c snowbros.c sprint8.c suprnova.c targeth.c timeplt.c twin16.c twinkle.c warpwarp.c zaccaria.c zaxxon.c |
| [src/mame/includes] | archimds.h balsente.h bublbobl.h bzone.h cloud9.h cps1.h dkong.h galaxold.h kaneko16.h kyugo.h mcr.h mw8080bw.h namcoic.h namcona1.h namconb1.h namcos2.h namcos22.h segas24.h snes.h snk.h sprint8.h system16.h taito_f2.h |
| [src/mame/machine] | archimds.c balsente.c bublbobl.c cx4data.c cx4fn.c cx4oam.c cx4ops.c galaxold.c namcos2.c scramble.c segas24.c snescx4.c snescx4.h snesdsp3.c snesdsp4.c snesdsp4.h snesst10.c system16.c |
| [src/mame/video] | cps1.c dkong.c galaxold.c galpani2.c genesis.c lucky74.c mcr3.c plygonet.c segasyse.c system16.c taito_f2.c |
| [src/mess] | filemngr.c |
| [src/mess/devices] | cassette.c |
| [src/mess/drivers] | a310.c oric.c |
| [src/osd/windows] | vconv.c |
| [src/tools] | srcclean.c |
| r5955 | r5956 | |
|---|---|---|
| 268 | 268 | /* Pitch */ |
| 269 | 269 | DISCRETE_INPUT_DATA(GAL_INP_PITCH) |
| 270 | 270 | |
| 271 | DISCRETE_TASK_START(0) | |
| 272 | ||
| 273 | /************************************************/ | |
| 274 | /* NOISE */ | |
| 275 | /************************************************/ | |
| 276 | ||
| 277 | /* since only a sample of the LFSR is latched @V2 we let the lfsr | |
| 278 | * run at a lower speed | |
| 279 | */ | |
| 280 | DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr) | |
| 281 | DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0) /* 2V signal */ | |
| 282 | DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,NODE_151,NODE_150) | |
| 283 | DISCRETE_TASK_END() | |
| 284 | ||
| 271 | 285 | /* Group Background and pitch */ |
| 272 | DISCRETE_TASK_START() | |
| 286 | DISCRETE_TASK_START(1) | |
| 273 | 287 | |
| 274 | 288 | /************************************************/ |
| 275 | 289 | /* Background */ |
| r5955 | r5956 | |
| 280 | 294 | // Next is mult/add opamp circuit |
| 281 | 295 | DISCRETE_MULTADD(NODE_110, NODE_105, GAL_R33/RES_3_PARALLEL(GAL_R31,GAL_R32,GAL_R33), |
| 282 | 296 | -5.0*GAL_R33/GAL_R31) |
| 283 | DISCRETE_CLAMP(NODE_111, | |
| 297 | DISCRETE_CLAMP(NODE_111, | |
| 284 | 298 | // The three 555 |
| 285 | 299 | DISCRETE_555_ASTABLE_CV(NODE_115, GAL_INP_FS1, GAL_R22, GAL_R23, GAL_C17, NODE_111, &galaxian_555_vco_desc) |
| 286 | 300 | DISCRETE_555_ASTABLE_CV(NODE_116, GAL_INP_FS2, GAL_R25, GAL_R26, GAL_C18, NODE_111, &galaxian_555_vco_desc) |
| r5955 | r5956 | |
| 310 | 324 | /* End of this task */ |
| 311 | 325 | DISCRETE_TASK_END() |
| 312 | 326 | |
| 313 | | |
| 327 | DISCRETE_TASK_START(1) | |
| 314 | 328 | |
| 315 | DISCRETE_TASK_START() | |
| 316 | ||
| 317 | 329 | /************************************************/ |
| 318 | 330 | /* HIT */ |
| 319 | 331 | /************************************************/ |
| 320 | 332 | |
| 321 | /* NOISE */ | |
| 322 | /* since only a sample of the LFSR is latched @V2 we let the lfsr | |
| 323 | * run at a lower speed | |
| 324 | */ | |
| 325 | DISCRETE_LFSR_NOISE(NODE_150, 1, 1, RNG_RATE/100, 1.0, 0, 0.5, &galaxian_lfsr) | |
| 326 | DISCRETE_SQUAREWFIX(NODE_151,1,60*264/2,1.0,50,0.5,0) /* 2V signal */ | |
| 327 | DISCRETE_LOGIC_DFLIPFLOP(NODE_152,1,1,NODE_151,NODE_150) | |
| 328 | ||
| 329 | ||
| 330 | 333 | /* Not 100% correct - switching causes high impedance input for node_157 |
| 331 | 334 | * this is not emulated */ |
| 332 | 335 | DISCRETE_RCDISC5(NODE_155, NODE_152, GAL_INP_HIT, (GAL_R35 + GAL_R36), GAL_C21) |
| 333 | 336 | DISCRETE_OP_AMP_FILTER(NODE_157, 1, NODE_155, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &galaxian_bandpass_desc) |
| 337 | DISCRETE_TASK_END() | |
| 334 | 338 | |
| 339 | DISCRETE_TASK_START(1) | |
| 335 | 340 | /************************************************/ |
| 336 | 341 | /* FIRE */ |
| 337 | 342 | /************************************************/ |
| r5955 | r5956 | |
| 361 | 366 | /* FINAL MIX */ |
| 362 | 367 | /************************************************/ |
| 363 | 368 | |
| 364 | DISCRETE_MIXER5(NODE_279, 1, NODE_SUB(133,0), NODE_SUB(133,2), NODE_SUB(133,2), NODE_SUB(133,3), NODE_120, &galaxian_mixerpre_desc) | |
| 365 | DISCRETE_MIXER3(NODE_280, 1, NODE_279, NODE_157, NODE_182, &galaxian_mixer_desc) | |
| 366 | DISCRETE_OUTPUT(NODE_280, 32767.0/5.0*5) | |
| 369 | DISCRETE_TASK_START(2) | |
| 370 | DISCRETE_MIXER5(NODE_279, 1, NODE_SUB(133,0), NODE_SUB(133,2), NODE_SUB(133,2), NODE_SUB(133,3), NODE_120, &galaxian_mixerpre_desc) | |
| 371 | DISCRETE_MIXER3(NODE_280, 1, NODE_279, NODE_157, NODE_182, &galaxian_mixer_desc) | |
| 372 | DISCRETE_OUTPUT(NODE_280, 32767.0/5.0*5) | |
| 373 | DISCRETE_TASK_END() | |
| 367 | 374 | |
| 368 | 375 | DISCRETE_SOUND_END |
| 369 | 376 |
| r5955 | r5956 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | enum { TIMER_SINGLESHOT, TIMER_PULSE }; |
| 19 | 19 | |
| 20 | READ16_HANDLER(f3_68000_share_r) | |
| 20 | static READ16_HANDLER(f3_68000_share_r) | |
| 21 | 21 | { |
| 22 | 22 | if ((offset&3)==0) return (f3_shared_ram[offset/4]&0xff000000)>>16; |
| 23 | 23 | if ((offset&3)==1) return (f3_shared_ram[offset/4]&0x00ff0000)>>8; |
| r5955 | r5956 | |
| 25 | 25 | return (f3_shared_ram[offset/4]&0x000000ff)<<8; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | WRITE16_HANDLER(f3_68000_share_w) | |
| 28 | static WRITE16_HANDLER(f3_68000_share_w) | |
| 29 | 29 | { |
| 30 | 30 | if ((offset&3)==0) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0x00ffffff)|((data&0xff00)<<16); |
| 31 | 31 | else if ((offset&3)==1) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xff00ffff)|((data&0xff00)<<8); |
| r5955 | r5956 | |
| 33 | 33 | else f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xffffff00)|((data&0xff00)>>8); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | WRITE16_HANDLER( f3_es5505_bank_w ) | |
| 36 | static WRITE16_HANDLER( f3_es5505_bank_w ) | |
| 37 | 37 | { |
| 38 | 38 | UINT32 max_banks_this_game=(memory_region_length(space->machine, "ensoniq.0")/0x200000)-1; |
| 39 | 39 | |
| r5955 | r5956 | |
| 50 | 50 | es5505_voice_bank_w(devtag_get_device(space->machine, "ensoniq"),offset,data<<20); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | WRITE16_HANDLER( f3_volume_w ) | |
| 53 | static WRITE16_HANDLER( f3_volume_w ) | |
| 54 | 54 | { |
| 55 | 55 | static UINT16 channel[8],last_l,last_r; |
| 56 | 56 | static int latch; |
| r5955 | r5956 | |
| 84 | 84 | timer_68681 = timer_alloc(machine, taito_en_timer_callback, NULL); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | READ16_HANDLER(f3_68681_r) | |
| 87 | static READ16_HANDLER(f3_68681_r) | |
| 88 | 88 | { |
| 89 | 89 | if (offset == 0x05) |
| 90 | 90 | { |
| r5955 | r5956 | |
| 106 | 106 | return 0xff; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | WRITE16_HANDLER(f3_68681_w) | |
| 109 | static WRITE16_HANDLER(f3_68681_w) | |
| 110 | 110 | { |
| 111 | 111 | switch (offset) { |
| 112 | 112 | case 0x04: /* ACR */ |
| r5955 | r5956 | |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | READ16_HANDLER(es5510_dsp_r) | |
| 169 | static READ16_HANDLER(es5510_dsp_r) | |
| 170 | 170 | { |
| 171 | 171 | // logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(space->cpu),offset,es5510_dsp_ram[offset]); |
| 172 | 172 | // if (es_tmp) return es5510_dsp_ram[offset]; |
| r5955 | r5956 | |
| 190 | 190 | return es5510_dsp_ram[offset]; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | WRITE16_HANDLER(es5510_dsp_w) | |
| 193 | static WRITE16_HANDLER(es5510_dsp_w) | |
| 194 | 194 | { |
| 195 | 195 | UINT8 *snd_mem = (UINT8 *)memory_region(space->machine, "ensoniq.0"); |
| 196 | 196 |
| r5955 | r5956 | |
|---|---|---|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | #define FIRETRUCK_HSYNC 15750.0 | |
| 71 | #define FIRETRUCK_HSYNC 15750.0 /* not checked */ | |
| 72 | 72 | #define FIRETRUCK_1V FIRETRUCK_HSYNC/2 |
| 73 | 73 | #define FIRETRUCK_2V FIRETRUCK_1V/2 |
| 74 | 74 | #define FIRETRUCK_8V FIRETRUCK_1V/8 |
| r5955 | r5956 | |
|---|---|---|
| 1 | 1 | #include "cpu/m68000/m68000.h" |
| 2 | 2 | #include "sound/es5506.h" |
| 3 | 3 | |
| 4 | READ16_HANDLER(f3_68000_share_r); | |
| 5 | WRITE16_HANDLER(f3_68000_share_w); | |
| 6 | READ16_HANDLER(f3_68681_r); | |
| 7 | WRITE16_HANDLER(f3_68681_w); | |
| 8 | READ16_HANDLER(es5510_dsp_r); | |
| 9 | WRITE16_HANDLER(es5510_dsp_w); | |
| 10 | WRITE16_HANDLER(f3_volume_w); | |
| 11 | WRITE16_HANDLER(f3_es5505_bank_w); | |
| 12 | 4 | void f3_68681_reset(running_machine *machine); |
| 13 | 5 | |
| 14 | 6 | void taito_f3_soundsystem_reset(running_machine *machine); |
| r5955 | r5956 | |
|---|---|---|
| 94 | 94 | TTL7474_update(device->machine, 2); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | #ifdef UNUSED_FUNCTION | |
| 97 | 98 | WRITE8_HANDLER( froggrmc_sh_irqtrigger_w ) |
| 98 | 99 | { |
| 99 | 100 | /* the complement of bit 0 is connected to the flip-flop's clock */ |
| 100 | 101 | TTL7474_clock_w(2, ~data & 0x01); |
| 101 | 102 | TTL7474_update(space->machine, 2); |
| 102 | 103 | } |
| 104 | #endif | |
| 103 | 105 | |
| 104 | 106 | static IRQ_CALLBACK(scramble_sh_irq_callback) |
| 105 | 107 | { |
| r5955 | r5956 | |
|---|---|---|
| 113 | 113 | {0}, {0}, 0, 0, 0, 0, 0, 1 |
| 114 | 114 | }; |
| 115 | 115 | |
| 116 | static const discrete_566_desc starshp1_566_a9 = | |
| 117 | { | |
| 118 | DISC_566_OUT_TRIANGLE, | |
| 119 | 5, /* B+ */ | |
| 120 | -10, /* B- */ | |
| 121 | NODE_41 /* charge voltage */ | |
| 122 | }; | |
| 123 | ||
| 124 | 116 | static const discrete_mixer_desc starshp1_555_b10_mix_r = |
| 125 | 117 | { |
| 126 | 118 | DISC_MIXER_IS_RESISTOR, |
| r5955 | r5956 | |
| 252 | 244 | STARSHP1_MOTOR_SPEED, /* IC A9, pin 5 */ |
| 253 | 245 | RES_2_PARALLEL(STARSHP1_R54, STARSHP1_R55), |
| 254 | 246 | STARSHP1_C34, |
| 255 | &starshp1_566_a9) | |
| 247 | 5, -10, NODE_41, /* VPOS,VNEG,VCHARGE */ | |
| 248 | DISC_566_OUT_TRIANGLE) | |
| 256 | 249 | DISCRETE_MULTIPLY( STARSHP1_MOTOR_SND, |
| 257 | 250 | NODE_42, |
| 258 | 251 | STARSHP1_MOLVL_GAIN) |
| r5955 | r5956 | |
|---|---|---|
| 111 | 111 | #define M79AMB_C41 CAP_U(0.1) |
| 112 | 112 | #define M79AMB_C42 CAP_U(15) |
| 113 | 113 | |
| 114 | static const discrete_566_desc m79amb_566_desc = {DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE, 12, 0, DEFAULT_566_CHARGE}; | |
| 115 | 114 | |
| 116 | 115 | static const discrete_mixer_desc m79amb_final_mix = |
| 117 | 116 | { |
| r5955 | r5956 | |
| 230 | 229 | DISCRETE_TRANSFORM4(NODE_51, 12.0 / M79AMB_R36, NODE_50, M79AMB_R37, RES_3_PARALLEL(M79AMB_R36, M79AMB_R35, M79AMB_R37), "012/+3*") |
| 231 | 230 | DISCRETE_566(NODE_52, /* IC U3, pin 4 */ |
| 232 | 231 | NODE_51, /* IC U3, pin 5 */ |
| 233 | M79AMB_R39, M79AMB_C21, &m79amb_566_desc) | |
| 232 | M79AMB_R39, M79AMB_C21, | |
| 233 | 12, 0, 12, /* VPOS,VNEG,VCHARGE */ | |
| 234 | DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) | |
| 234 | 235 | DISCRETE_CRFILTER(NODE_53, |
| 235 | 236 | M79AMB_MC_CONTROL_EN, /* Q13 */ |
| 236 | 237 | NODE_52, M79AMB_R41 + M79AMB_R42 + M79AMB_R43, M79AMB_C22) |
| r5955 | r5956 | |
| 241 | 242 | ************************************************/ |
| 242 | 243 | DISCRETE_566(NODE_60, /* IC U4, pin 4 */ |
| 243 | 244 | 12.0 * RES_VOLTAGE_DIVIDER(M79AMB_R44, M79AMB_R45), /* IC U5, pin 5 */ |
| 244 | M79AMB_R46, M79AMB_C25, &m79amb_566_desc) | |
| 245 | M79AMB_R46, M79AMB_C25, | |
| 246 | 12, 0, 12, /* VPOS,VNEG,VCHARGE */ | |
| 247 | DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) | |
| 245 | 248 | DISCRETE_ONOFF(NODE_61, |
| 246 | 249 | M79AMB_TANK_TRUCK_JEEP_EN, /* Q16, Q17 */ |
| 247 | 250 | NODE_60) |
| r5955 | r5956 | |
| 266 | 269 | DISCRETE_TRANSFORM3(NODE_71, 12, NODE_70, RES_VOLTAGE_DIVIDER(M79AMB_R51, M79AMB_R52), "01-2*1+") |
| 267 | 270 | DISCRETE_566(NODE_72, /* IC U5, pin 4 */ |
| 268 | 271 | NODE_71, /* IC U5, pin 5 */ |
| 269 | M79AMB_R54, M79AMB_C30, &m79amb_566_desc) | |
| 272 | M79AMB_R54, M79AMB_C30, | |
| 273 | 12, 0, 12, /* VPOS,VNEG,VCHARGE */ | |
| 274 | DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) | |
| 270 | 275 | DISCRETE_CRFILTER(NODE_73, |
| 271 | 276 | M79AMB_WHISTLE_A_EN, /* Q16, Q17 */ |
| 272 | 277 | NODE_72, M79AMB_R57 + M79AMB_R58 + M79AMB_R59, M79AMB_C31) |
| r5955 | r5956 | |
| 285 | 290 | DISCRETE_TRANSFORM3(NODE_81, 12, NODE_80, RES_VOLTAGE_DIVIDER(M79AMB_R61, M79AMB_R62), "01-2*1+") |
| 286 | 291 | DISCRETE_566(NODE_82, /* IC U5, pin 4 */ |
| 287 | 292 | NODE_81, /* IC U5, pin 5 */ |
| 288 | M79AMB_R64, M79AMB_C34, &m79amb_566_desc) | |
| 293 | M79AMB_R64, M79AMB_C34, | |
| 294 | 12, 0, 12, /* VPOS,VNEG,VCHARGE */ | |
| 295 | DISC_566_OUT_DC | DISC_566_OUT_TRIANGLE) | |
| 289 | 296 | DISCRETE_CRFILTER(NODE_83, |
| 290 | 297 | M79AMB_WHISTLE_B_EN, /* Q19, Q20*/ |
| 291 | 298 | NODE_82, M79AMB_R67 + M79AMB_R68 + M79AMB_R69, M79AMB_C35) |
| r5955 | r5956 | |
|---|---|---|
| 189 | 189 | int v /* Voice to process envelope for*/ |
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | static STREAM_UPDATE( snes_sh_update ); | |
| 193 | ||
| 192 | 194 | /* Privately shared functions (for internal library use only) */ |
| 193 | 195 | |
| 194 | 196 | /***** DSP_Reset *****/ |
| r5955 | r5956 | |
| 1179 | 1181 | } |
| 1180 | 1182 | |
| 1181 | 1183 | |
| 1182 | STREAM_UPDATE( snes_sh_update ) | |
| 1184 | static STREAM_UPDATE( snes_sh_update ) | |
| 1183 | 1185 | { |
| 1184 | 1186 | int i; |
| 1185 | 1187 | short mix[2]; |
| r5955 | r5956 | |
|---|---|---|
| 55 | 55 | rb_input_select = data & 1; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | #ifdef UNUSED_FUNCTION | |
| 58 | 59 | WRITE8_DEVICE_HANDLER( redbaron_pokey_w ) |
| 59 | 60 | { |
| 60 | 61 | if( latch & 0x20 ) |
| 61 | 62 | pokey_w(device, offset, data); |
| 62 | 63 | } |
| 64 | #endif | |
| 63 | 65 | |
| 64 | 66 | static STREAM_UPDATE( redbaron_sound_update ) |
| 65 | 67 | { |
| r5955 | r5956 | |
|---|---|---|
| 361 | 361 | /* This is not the perfect way to discharge, but it is good enough for now */ |
| 362 | 362 | /* it does not take into acount that there is no discharge when noise is low */ |
| 363 | 363 | DISCRETE_RCDISC2(NODE_10, FANTASY_BOMB_EN, 0, RES_K(10) + RES_K(33), DEFAULT_TTL_V_LOGIC_1 - 0.5, RES_K(1), CAP_U(1)) |
| 364 | DISCRETE_CLAMP(FANTASY_NOISE_LOGIC, | |
| 364 | DISCRETE_CLAMP(FANTASY_NOISE_LOGIC, | |
| 365 | 365 | DISCRETE_SWITCH(NODE_11, 1, FANTASY_NOISE_LOGIC, 0, NODE_10) |
| 366 | 366 | |
| 367 | 367 | DISCRETE_OP_AMP_FILTER(NODE_20, 1, NODE_11, 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &fantasy_filter) |
| r5955 | r5956 | |
|---|---|---|
| 361 | 361 | DISCRETE_INPUT_NOT(DS_DISCHARGE_INV) |
| 362 | 362 | //DISCRETE_INPUT_DATA(DS_DAC) |
| 363 | 363 | |
| 364 | /* Mixing - DAC */ | |
| 365 | DISCRETE_ADJUSTMENT_TAG(DS_ADJ_DAC, 0, 1, DISC_LINADJ, "VR2") | |
| 366 | ||
| 367 | 364 | /************************************************/ |
| 368 | 365 | /* Stomp */ |
| 369 | 366 | /************************************************/ |
| 370 | 367 | /* Noise */ |
| 371 | DISCRETE_TASK_START() | |
| 368 | DISCRETE_TASK_START(1) | |
| 372 | 369 | DISCRETE_LFSR_NOISE(NODE_11, 1, 1, CLOCK_2VF, 1.0, 0, 0.5, &dkong_lfsr) |
| 373 | 370 | DISCRETE_COUNTER(NODE_12, 1, 0, NODE_11, 7, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE) /* LS161, IC 3J */ |
| 374 | 371 | DISCRETE_TRANSFORM3(NODE_13,NODE_12,3,DK_SUP_V,"01>2*") |
| r5955 | r5956 | |
| 391 | 388 | /************************************************/ |
| 392 | 389 | /* tt */ |
| 393 | 390 | /* 4049B Inverter Oscillator build from 3 inverters */ |
| 394 | DISCRETE_TASK_START() | |
| 391 | DISCRETE_TASK_START(1) | |
| 395 | 392 | DISCRETE_INVERTER_OSC(NODE_25,1,0,DK_R38,DK_R39,DK_C26,0,&dkong_inverter_osc_desc_jump) |
| 396 | 393 | |
| 397 | 394 | #if DK_USE_CUSTOM |
| r5955 | r5956 | |
| 423 | 420 | /************************************************/ |
| 424 | 421 | /* Walk */ |
| 425 | 422 | /************************************************/ |
| 426 | DISCRETE_TASK_START() | |
| 423 | DISCRETE_TASK_START(1) | |
| 427 | 424 | DISCRETE_INVERTER_OSC(NODE_51,1,0,DK_R47,DK_R48,DK_C30,0,&dkong_inverter_osc_desc_walk) |
| 428 | 425 | |
| 429 | 426 | #if DK_USE_CUSTOM |
| r5955 | r5956 | |
| 450 | 447 | /* DAC */ |
| 451 | 448 | /************************************************/ |
| 452 | 449 | |
| 453 | DISCRETE_TASK_START() | |
| 450 | DISCRETE_TASK_START(1) | |
| 454 | 451 | /* Buffer DAC first to input stream 0 */ |
| 455 | 452 | DISCRETE_INPUT_BUFFER(DS_DAC, 0) |
| 456 | 453 | //DISCRETE_INPUT_DATA(DS_DAC) |
| r5955 | r5956 | |
| 480 | 477 | /* Amplifier */ |
| 481 | 478 | /************************************************/ |
| 482 | 479 | |
| 480 | DISCRETE_TASK_START(2) | |
| 481 | /* Mixing - DAC */ | |
| 482 | DISCRETE_ADJUSTMENT_TAG(DS_ADJ_DAC, 0, 1, DISC_LINADJ, "VR2") | |
| 483 | ||
| 483 | 484 | DISCRETE_MIXER4(NODE_288, 1, DS_OUT_SOUND0, DS_OUT_SOUND1, DS_OUT_DAC, DS_OUT_SOUND2, &dkong_mixer_desc) |
| 484 | 485 | |
| 485 | 486 | /* Amplifier: internal amplifier */ |
| r5955 | r5956 | |
| 497 | 498 | //DISCRETE_CSVLOG2(NODE_296, NODE_288) |
| 498 | 499 | //DISCRETE_WAVELOG1(NODE_296, 32767.0/5.0 * 3.41) |
| 499 | 500 | #endif |
| 501 | DISCRETE_TASK_END() | |
| 500 | 502 | |
| 501 | 503 | DISCRETE_SOUND_END |
| 502 | 504 | |
| r5955 | r5956 | |
| 876 | 878 | /* SOUND0 / SOUND7 */ |
| 877 | 879 | /************************************************/ |
| 878 | 880 | |
| 879 | DISCRETE_TASK_START() | |
| 881 | DISCRETE_TASK_START(1) | |
| 880 | 882 | DISCRETE_LOGIC_INVERT(DS_SOUND7,DS_SOUND7_INV) |
| 881 | 883 | DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT) |
| 882 | 884 | |
| r5955 | r5956 | |
| 909 | 911 | /* SOUND1 */ |
| 910 | 912 | /************************************************/ |
| 911 | 913 | |
| 912 | DISCRETE_TASK_START() | |
| 914 | DISCRETE_TASK_START(1) | |
| 913 | 915 | DISCRETE_LS123(NODE_10, DS_SOUND1_INV, JR_R9, JR_C15) |
| 914 | 916 | DISCRETE_TRANSFORM2(NODE_11,NODE_104,TTL_HIGH,"0!1*") |
| 915 | 917 | DISCRETE_LOGIC_INVERT(NODE_12,NODE_10) |
| r5955 | r5956 | |
| 927 | 929 | /* SOUND2 */ |
| 928 | 930 | /************************************************/ |
| 929 | 931 | |
| 930 | DISCRETE_TASK_START() | |
| 932 | DISCRETE_TASK_START(1) | |
| 931 | 933 | DISCRETE_74LS624(NODE_20, 0, 0.98*DK_SUP_V, JR_C20, DISC_LS624_OUT_COUNT_F) |
| 932 | 934 | DISCRETE_LFSR_NOISE(NODE_21, 1, 1, NODE_20, 1.0, 0, 0.5, &dkongjr_lfsr) |
| 933 | 935 | DISCRETE_LS123_INV(NODE_25, DS_SOUND2_INV, JR_R17, JR_C27) |
| r5955 | r5956 | |
| 943 | 945 | /* SOUND9 */ |
| 944 | 946 | /************************************************/ |
| 945 | 947 | |
| 946 | DISCRETE_TASK_START() | |
| 948 | DISCRETE_TASK_START(1) | |
| 947 | 949 | DISCRETE_LOGIC_INVERT(DS_SOUND9,DS_SOUND9_INV) |
| 948 | 950 | DISCRETE_RCFILTER(NODE_90, 1, DS_SOUND9_INV, JR_R14, JR_C26) |
| 949 | 951 | DISCRETE_MULTIPLY(NODE_91, NODE_90, TTL_HIGH) |
| r5955 | r5956 | |
| 956 | 958 | /* DAC */ |
| 957 | 959 | /************************************************/ |
| 958 | 960 | |
| 959 | DISCRETE_TASK_START() | |
| 961 | DISCRETE_TASK_START(1) | |
| 960 | 962 | DISCRETE_INPUT_BUFFER(DS_DAC, 0) |
| 961 | 963 | /* Signal decay circuit Q7, R20, C32 */ |
| 962 | 964 | DISCRETE_RCDISC(NODE_170, DS_DISCHARGE_INV, 1, JR_R20, JR_C32) |
| r5955 | r5956 | |
| 978 | 980 | /* Amplifier */ |
| 979 | 981 | /************************************************/ |
| 980 | 982 | |
| 983 | DISCRETE_TASK_START(2) | |
| 981 | 984 | DISCRETE_MIXER5(NODE_288, 1, DS_OUT_SOUND9, DS_OUT_SOUND0, DS_OUT_SOUND2, DS_OUT_SOUND1, DS_OUT_DAC, &dkongjr_mixer_desc) |
| 982 | 985 | |
| 983 | 986 | /* Amplifier: internal amplifier |
| r5955 | r5956 | |
| 985 | 988 | */ |
| 986 | 989 | DISCRETE_CRFILTER(NODE_295,1,NODE_288, 1000, JR_C13) |
| 987 | 990 | DISCRETE_OUTPUT(NODE_295, 32767.0/5.0 * 10) |
| 991 | DISCRETE_TASK_END() | |
| 988 | 992 | |
| 989 | 993 | DISCRETE_SOUND_END |
| 990 | 994 |
| r5955 | r5956 | |
|---|---|---|
| 28 | 28 | #define SKYRAID_R12 RES_K(1) |
| 29 | 29 | #define SKYRAID_R13 RES_K(10) |
| 30 | 30 | #define SKYRAID_R14 RES_K(100) |
| 31 | #define SKYRAID_R16 RES_ | |
| 31 | #define SKYRAID_R16 RES_K(10) | |
| 32 | 32 | #define SKYRAID_R18 RES_K(10) |
| 33 | 33 | #define SKYRAID_R19 RES_K(10) |
| 34 | 34 | #define SKYRAID_R20 RES_K(47) |
| r5955 | r5956 | |
| 86 | 86 | 0, 12, -5, /* vRef, vP, vN */ |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | static const discrete_566_desc skyraid_566_desc = | |
| 90 | { | |
| 91 | DISC_566_OUT_LOGIC, | |
| 92 | 5, /* v_pos */ | |
| 93 | -5, /* v_neg */ | |
| 94 | 5 /* v_charge */ | |
| 95 | }; | |
| 96 | ||
| 97 | 89 | static const discrete_dac_r1_ladder skyraid_plane_dac = |
| 98 | 90 | { |
| 99 | 91 | 2, {SKYRAID_R28, SKYRAID_R27}, |
| r5955 | r5956 | |
| 343 | 335 | DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &skyraid_explosion_filter) /* TYPE,INFO */ |
| 344 | 336 | /* IC E10, pin 14 gain and clipping */ |
| 345 | 337 | DISCRETE_GAIN(NODE_23, NODE_22, SKYRAID_R119 / SKYRAID_R121 + 1) |
| 346 | DISCRETE_CLAMP(SKYRAID_EXPLOSION_SND, | |
| 338 | DISCRETE_CLAMP(SKYRAID_EXPLOSION_SND, | |
| 347 | 339 | |
| 348 | 340 | /************************************************ |
| 349 | 341 | * Jet, Plane sound |
| r5955 | r5956 | |
| 354 | 346 | RES_2_PARALLEL(SKYRAID_R25, SKYRAID_R24), SKYRAID_C49) |
| 355 | 347 | DISCRETE_566(NODE_31, /* IC J6, pin 3 */ |
| 356 | 348 | NODE_30, /* VMOD */ |
| 357 | SKYRAID_R18, SKYRAID_C48, &skyraid_566_desc) | |
| 349 | SKYRAID_R18, SKYRAID_C48, | |
| 350 | 5, -5, 5, /* VPOS,VNEG,VCHARGE */ | |
| 351 | DISC_566_OUT_COUNT_R) | |
| 358 | 352 | DISCRETE_LOGIC_SHIFT(NODE_32, /* IC H7, J7 output */ |
| 359 | 353 | SKYRAID_NOISE, /* IC H7, J7 pins 1 & 2 */ |
| 360 | 354 | 1, NODE_31, 16, /* RESET, CLK, SIZE */ |
| 361 | DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON | |
| 355 | DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_BY_COUNT | |
| 362 | 356 | /* move bits together for ease of use */ |
| 363 | 357 | DISCRETE_TRANSFORM4(NODE_33, NODE_32, 1, 1 << 14, 2, "01&02/3&|") |
| 364 | 358 | DISCRETE_DAC_R1(SKYRAID_PLANE_SND, |
| r5955 | r5956 | |
| 373 | 367 | DISCRETE_CUSTOM5(NODE_40, SKYRAID_MISSILE_EN, SKYRAID_R12, SKYRAID_R14, SKYRAID_R13, SKYRAID_C44, &skyraid_missle_custom_charge) |
| 374 | 368 | DISCRETE_566(NODE_41, /* IC K6, pin 3 */ |
| 375 | 369 | NODE_40, /* VMOD */ |
| 376 | SKYRAID_R16, SKYRAID_C45, &skyraid_566_desc) | |
| 370 | SKYRAID_R16, SKYRAID_C45, | |
| 371 | 5, -5, SKYRAID_MISSLE_CHARGE_PLUS, /* VPOS,VNEG,VCHARGE */ | |
| 372 | DISC_566_OUT_COUNT_R) | |
| 377 | 373 | DISCRETE_LOGIC_SHIFT(NODE_42, /* IC K7, L7 output */ |
| 378 | 374 | SKYRAID_NOISE, /* IC K7, L7 pins 1 & 2 */ |
| 379 | 375 | 1, NODE_41, 16, /* RESET, CLK, SIZE */ |
| 380 | DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_ON | |
| 376 | DISC_LOGIC_SHIFT__RESET_L | DISC_LOGIC_SHIFT__LEFT | DISC_CLK_BY_COUNT | |
| 381 | 377 | DISCRETE_BIT_DECODE(SKYRAID_MSL_A_SND, NODE_42, 0, DEFAULT_TTL_V_LOGIC_1) /* IC K7, pin 3 */ |
| 382 | 378 | DISCRETE_BIT_DECODE(SKYRAID_MSL_B_SND, NODE_42, 15, DEFAULT_TTL_V_LOGIC_1) /* IC L7, pin 13 */ |
| 383 | 379 | |
| r5955 | r5956 | |
| 401 | 397 | SKYRAID_C93) |
| 402 | 398 | /* IC E10, pin 1 gain and clipping */ |
| 403 | 399 | DISCRETE_GAIN(NODE_94, NODE_93, - SKYRAID_R118 / (SKYRAID_R122 + RES_5_PARALLEL(SKYRAID_R120, SKYRAID_R32, SKYRAID_R29, SKYRAID_R30, SKYRAID_R31))) |
| 404 | DISCRETE_CLAMP(NODE_95, 1, NODE_94, -5, 12.0 - 1.5, 0) | |
| 405 | DISCRETE_OUTPUT(NODE_95, 32700.0/12) | |
| 400 | DISCRETE_CLAMP(NODE_95, NODE_94, -5, 12.0 - 1.5) | |
| 401 | DISCRETE_OUTPUT(NODE_95, 32700.0/8) | |
| 406 | 402 | DISCRETE_SOUND_END |
| 407 | 403 | |
| 408 | 404 |
| r0 | r5956 | |
|---|---|---|
| 1 | /************************************************************************ | |
| 2 | * sprint8 Sound System Analog emulation | |
| 3 | * Sept 2009, Derrick Renaud | |
| 4 | ************************************************************************/ | |
| 5 | ||
| 6 | #include "driver.h" | |
| 7 | #include "sprint8.h" | |
| 8 | ||
| 9 | ||
| 10 | /* Discrete Sound Input Nodes */ | |
| 11 | #define SPRINT8_CRASH_EN NODE_01 | |
| 12 | #define SPRINT8_SCREECH_EN NODE_02 | |
| 13 | #define SPRINT8_ATTRACT_EN NODE_03 | |
| 14 | #define SPRINT8_MOTOR1_EN NODE_04 | |
| 15 | #define SPRINT8_MOTOR2_EN NODE_05 | |
| 16 | #define SPRINT8_MOTOR3_EN NODE_06 | |
| 17 | #define SPRINT8_MOTOR4_EN NODE_07 | |
| 18 | #define SPRINT8_MOTOR5_EN NODE_08 | |
| 19 | #define SPRINT8_MOTOR6_EN NODE_09 | |
| 20 | #define SPRINT8_MOTOR7_EN NODE_10 | |
| 21 | #define SPRINT8_MOTOR8_EN NODE_11 | |
| 22 | ||
| 23 | /* Discrete Sound Output Nodes */ | |
| 24 | #define SPRINT8_NOISE NODE_12 | |
| 25 | #define SPRINT8_MOTOR1_SND NODE_13 | |
| 26 | #define SPRINT8_MOTOR2_SND NODE_14 | |
| 27 | #define SPRINT8_MOTOR3_SND NODE_15 | |
| 28 | #define SPRINT8_MOTOR4_SND NODE_16 | |
| 29 | #define SPRINT8_MOTOR5_SND NODE_17 | |
| 30 | #define SPRINT8_MOTOR6_SND NODE_18 | |
| 31 | #define SPRINT8_MOTOR7_SND NODE_19 | |
| 32 | #define SPRINT8_MOTOR8_SND NODE_20 | |
| 33 | #define SPRINT8_CRASH_SCREECH_SND NODE_21 | |
| 34 | #define SPRINT8_AUDIO_1_2 NODE_22 | |
| 35 | #define SPRINT8_AUDIO_3_7 NODE_23 | |
| 36 | #define SPRINT8_AUDIO_5_6 NODE_24 | |
| 37 | #define SPRINT8_AUDIO_4_8 NODE_25 | |
| 38 | ||
| 39 | /* Adjusters */ | |
| 40 | #define SPRINT8_R132_POT NODE_29 | |
| 41 | ||
| 42 | ||
| 43 | /* Parts List - Resistors */ | |
| 44 | #define SPRINT8_R1 RES_K(47) | |
| 45 | #define SPRINT8_R3 RES_K(47) | |
| 46 | #define SPRINT8_R4 RES_K(47) | |
| 47 | #define SPRINT8_R19 RES_K(1) | |
| 48 | #define SPRINT8_R20 RES_K(1) | |
| 49 | #define SPRINT8_R27 RES_K(18) | |
| 50 | #define SPRINT8_R28 820 | |
| 51 | #define SPRINT8_R29 RES_K(330) | |
| 52 | #define SPRINT8_R39 RES_K(120) | |
| 53 | #define SPRINT8_R40 RES_K(22) | |
| 54 | #define SPRINT8_R41 RES_K(150) | |
| 55 | #define SPRINT8_R89 RES_K(22) | |
| 56 | #define SPRINT8_R91 RES_K(47) | |
| 57 | #define SPRINT8_R93 RES_K(2.2) | |
| 58 | #define SPRINT8_R96 RES_K(47) | |
| 59 | #define SPRINT8_R97 RES_K(2.2) | |
| 60 | #define SPRINT8_R99 RES_K(27) | |
| 61 | #define SPRINT8_R100 RES_K(1) | |
| 62 | #define SPRINT8_R101 RES_K(2.2) | |
| 63 | #define SPRINT8_R132 RES_K(100) | |
| 64 | #define SPRINT8_R145 RES_K(3.3) | |
| 65 | #define SPRINT8_R146 RES_K(7.5) | |
| 66 | #define SPRINT8_R147 100 | |
| 67 | #define SPRINT8_R148 RES_K(1) | |
| 68 | #define SPRINT8_R149 RES_K(22) | |
| 69 | ||
| 70 | /* Parts List - Capacitors */ | |
| 71 | #define SPRINT8_C8 CAP_U(.01) | |
| 72 | #define SPRINT8_C17 CAP_U(.001) | |
| 73 | #define SPRINT8_C18 CAP_U(.047) | |
| 74 | #define SPRINT8_C19 CAP_U(.047) | |
| 75 | #define SPRINT8_C26 CAP_U(100) | |
| 76 | #define SPRINT8_C27 CAP_U(.22) | |
| 77 | #define SPRINT8_C28 CAP_U(.1) | |
| 78 | #define SPRINT8_C59 CAP_U(.1) | |
| 79 | #define SPRINT8_C63 CAP_U(.1) | |
| 80 | #define SPRINT8_C64 CAP_U(.1) | |
| 81 | #define SPRINT8_C89 CAP_U(.1) | |
| 82 | #define SPRINT8_C90 CAP_U(.1) | |
| 83 | ||
| 84 | #define SPRINT8_HSYNC 15750.0 /* not checked */ | |
| 85 | #define SPRINT8_1V SPRINT8_HSYNC/2 | |
| 86 | #define SPRINT8_2V SPRINT8_1V/2 | |
| 87 | ||
| 88 | ||
| 89 | static const discrete_lfsr_desc sprint8_lfsr = | |
| 90 | { | |
| 91 | DISC_CLK_IS_FREQ, | |
| 92 | 16, /* Bit Length */ | |
| 93 | 0, /* Reset Value */ | |
| 94 | 10, /* Use Bit 10 as XOR input 0 */ | |
| 95 | 15, /* Use Bit 15 as XOR input 1 */ | |
| 96 | DISC_LFSR_XNOR, /* Feedback stage1 is XNOR */ | |
| 97 | DISC_LFSR_OR, /* Feedback stage2 is just stage 1 output OR with external feed */ | |
| 98 | DISC_LFSR_REPLACE, /* Feedback stage3 replaces the shifted register contents */ | |
| 99 | 0x000001, /* Everything is shifted into the first bit only */ | |
| 100 | DISC_LFSR_FLAG_RESET_TYPE_L, /* Output is not inverted */ | |
| 101 | 12 /* Output bit */ | |
| 102 | }; | |
| 103 | ||
| 104 | static const discrete_555_desc sprint8_crash_555a_desc = | |
| 105 | { | |
| 106 | DISC_555_OUT_ENERGY, | |
| 107 | 5, DEFAULT_555_VALUES | |
| 108 | }; | |
| 109 | ||
| 110 | static const discrete_integrate_info sprint8_crash_integrate = | |
| 111 | { | |
| 112 | DISC_INTEGRATE_OP_AMP_1, | |
| 113 | SPRINT8_R99, SPRINT8_R97, SPRINT8_R96, SPRINT8_C59, /*r1, r2, r3, c, */ | |
| 114 | 5, 5, /* v1, vP*/ | |
| 115 | 0, 0, 0 /* no functions */ | |
| 116 | }; | |
| 117 | ||
| 118 | static const discrete_555_desc sprint8_motor_555a_desc = | |
| 119 | { | |
| 120 | DISC_555_OUT_COUNT_F_X, | |
| 121 | 5, DEFAULT_555_VALUES | |
| 122 | }; | |
| 123 | ||
| 124 | static const discrete_555_desc sprint8_motor_555m_desc = | |
| 125 | { | |
| 126 | DISC_555_OUT_ENERGY | DISC_555_TRIGGER_IS_COUNT, | |
| 127 | 5, DEFAULT_555_VALUES | |
| 128 | }; | |
| 129 | ||
| 130 | static const discrete_op_amp_filt_info sprint8_motor_filter = | |
| 131 | { | |
| 132 | SPRINT8_R27, 0, SPRINT8_R28 + RES_2_PARALLEL(SPRINT8_R19, SPRINT8_R20), 0, SPRINT8_R29, /* r1, r2, r3, r4, rF, */ | |
| 133 | SPRINT8_C18, SPRINT8_C19, 0, /* c1, c2, c3, */ | |
| 134 | 5.0 * RES_VOLTAGE_DIVIDER(SPRINT8_R19, SPRINT8_R20), 5, 0 /* vRef, vP, vN */ | |
| 135 | }; | |
| 136 | ||
| 137 | static const discrete_mixer_desc sprint8_crash_screech_mixer = | |
| 138 | { | |
| 139 | DISC_MIXER_IS_RESISTOR, | |
| 140 | {SPRINT8_R149, SPRINT8_R91}, | |
| 141 | {0, NODE_80}, /* R93 switched in/out of circuit */ | |
| 142 | {0}, 0, 0, SPRINT8_C64, 0, 0, 1 /* c, rI, rF, cF, cAmp, vRef, gain */ | |
| 143 | }; | |
| 144 | ||
| 145 | static const discrete_mixer_desc sprint8_mixer = | |
| 146 | { | |
| 147 | DISC_MIXER_IS_RESISTOR, | |
| 148 | {SPRINT8_R1 + SPRINT8_R100, SPRINT8_R3, SPRINT8_R4}, | |
| 149 | {0}, {0}, 0, 0, 0, SPRINT8_C8, 0, 1 /* r_nodes, c, rI, rF, cF, cAmp, vRef, gain */ | |
| 150 | }; | |
| 151 | ||
| 152 | ||
| 153 | /************************************************ | |
| 154 | * Car Motor | |
| 155 | ************************************************/ | |
| 156 | /* The first (astable) 555 generates a quick falling pulse that triggers the second (monostable) 555. | |
| 157 | * This pulse is passed through C17 and pulled up with R40. This pulse is too fast to emulate so | |
| 158 | * we will just tell the monostable it was triggered once and ignore C17/R40. | |
| 159 | */ | |
| 160 | #define SPRINT8_MOTOR_CIRCUIT(_car) \ | |
| 161 | DISCRETE_RCFILTER(NODE_RELATIVE(NODE_30, _car - 1), 1, NODE_RELATIVE(SPRINT8_MOTOR1_EN, _car - 1), SPRINT8_R89, SPRINT8_C26) \ | |
| 162 | DISCRETE_ADDER2(NODE_RELATIVE(NODE_40, _car - 1), 1, NODE_RELATIVE(NODE_30, _car - 1), 0.7) /* add Q21 shift */ \ | |
| 163 | DISCRETE_555_ASTABLE_CV(NODE_RELATIVE(NODE_50, _car - 1), 1, SPRINT8_R39, 0, SPRINT8_C27, NODE_RELATIVE(NODE_40, _car - 1), &sprint8_motor_555a_desc) \ | |
| 164 | DISCRETE_555_MSTABLE(NODE_RELATIVE(NODE_60, _car - 1), 1, NODE_RELATIVE(NODE_50, _car - 1), SPRINT8_R41, SPRINT8_C28, &sprint8_motor_555m_desc) \ | |
| 165 | DISCRETE_OP_AMP_FILTER(NODE_RELATIVE(SPRINT8_MOTOR1_SND, _car - 1), 1, NODE_RELATIVE(NODE_60, _car - 1), 0, DISC_OP_AMP_FILTER_IS_BAND_PASS_1M, &sprint8_motor_filter) | |
| 166 | ||
| 167 | ||
| 168 | DISCRETE_SOUND_START( sprint8 ) | |
| 169 | /************************************************ | |
| 170 | * Input register mapping | |
| 171 | ************************************************/ | |
| 172 | DISCRETE_INPUT_LOGIC(SPRINT8_CRASH_EN) | |
| 173 | DISCRETE_INPUT_NOT (SPRINT8_SCREECH_EN) | |
| 174 | DISCRETE_INPUT_NOT (SPRINT8_ATTRACT_EN) | |
| 175 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR1_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 176 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR2_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 177 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR3_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 178 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR4_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 179 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR5_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 180 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR6_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 181 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR7_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 182 | DISCRETE_INPUTX_LOGIC(SPRINT8_MOTOR8_EN, DEFAULT_TTL_V_LOGIC_1, 0, 0) | |
| 183 | ||
| 184 | DISCRETE_TASK_START(0) | |
| 185 | DISCRETE_ADJUSTMENT_TAG(SPRINT8_R132_POT, 0, SPRINT8_R132, DISC_LINADJ, "R132") | |
| 186 | ||
| 187 | /************************************************ | |
| 188 | * Noise Generator, Crash, Screech | |
| 189 | ************************************************/ | |
| 190 | /* Address line A2 is used to XOR the feedback bits. | |
| 191 | * This can not easily be implemented, so I just set the | |
| 192 | * feedback as XNOR. */ | |
| 193 | DISCRETE_LFSR_NOISE(SPRINT8_NOISE, /* IC F7, pin 13 */ | |
| 194 | 1, /* ENAB */ | |
| 195 | SPRINT8_ATTRACT_EN, /* RESET */ | |
| 196 | SPRINT8_2V, 1, 0, 0.5, &sprint8_lfsr) /* CLK,AMPL,FEED,BIAS,LFSRTB */ | |
| 197 | ||
| 198 | DISCRETE_TASK_END() | |
| 199 | ||
| 200 | DISCRETE_TASK_START(1) | |
| 201 | DISCRETE_GAIN(NODE_70, SPRINT8_NOISE, DEFAULT_TTL_V_LOGIC_1 * RES_VOLTAGE_DIVIDER(SPRINT8_R148, SPRINT8_R147)) | |
| 202 | DISCRETE_CRFILTER_VREF(NODE_71, | |
| 203 | 1, /* ENAB */ | |
| 204 | NODE_70, /* IN0 */ | |
| 205 | RES_2_PARALLEL(SPRINT8_R148, SPRINT8_R147) + RES_2_PARALLEL(RES_K(5), RES_K(10)), | |
| 206 | SPRINT8_C90, | |
| 207 | 5.0 * RES_VOLTAGE_DIVIDER(RES_K(5), RES_K(10))) /* ref to 555 CV pin */ | |
| 208 | DISCRETE_555_ASTABLE_CV(NODE_72, | |
| 209 | SPRINT8_SCREECH_EN, /* RESET */ | |
| 210 | SPRINT8_R145, SPRINT8_R146, SPRINT8_C89, | |
| 211 | NODE_71, /* CTRLV */ | |
| 212 | &sprint8_crash_555a_desc) | |
| 213 | DISCRETE_INTEGRATE(NODE_73, SPRINT8_CRASH_EN, 0, &sprint8_crash_integrate) | |
| 214 | ||
| 215 | DISCRETE_SWITCH(NODE_80, | |
| 216 | 1, /* ENAB */ | |
| 217 | SPRINT8_NOISE, /* SWITCH */ | |
| 218 | SPRINT8_R93, 1) /* INP0,INP1*/ | |
| 219 | DISCRETE_SWITCH(NODE_74, /* effect of Q20 */ | |
| 220 | 1, /* ENAB */ | |
| 221 | SPRINT8_NOISE, /* SWITCH */ | |
| 222 | NODE_73, 0) /* INP0,INP1*/ | |
| 223 | DISCRETE_MIXER2(NODE_75, | |
| 224 | 1, /* ENAB */ | |
| 225 | NODE_72, | |
| 226 | NODE_74, | |
| 227 | &sprint8_crash_screech_mixer) | |
| 228 | ||
| 229 | DISCRETE_CRFILTER_VREF(NODE_76, | |
| 230 | 1, /* ENAB */ | |
| 231 | NODE_75, /* IN0 */ | |
| 232 | SPRINT8_R93 + SPRINT8_R91, SPRINT8_C63, | |
| 233 | 5) /* VREF */ | |
| 234 | /* IC E5, pin 14 gain. Does not simulate minor DC offset caused by R93. */ | |
| 235 | DISCRETE_TRANSFORM5(NODE_77, NODE_76, 5, SPRINT8_R132_POT, SPRINT8_R101, 1, "01-23/4+*1+") | |
| 236 | DISCRETE_CLAMP(SPRINT8_CRASH_SCREECH_SND, NODE_77, 0, 15.0 - 1.5) | |
| 237 | DISCRETE_TASK_END() | |
| 238 | ||
| 239 | /************************************************ | |
| 240 | * Car Motor | |
| 241 | ************************************************/ | |
| 242 | DISCRETE_TASK_START(1) | |
| 243 | SPRINT8_MOTOR_CIRCUIT(1) | |
| 244 | SPRINT8_MOTOR_CIRCUIT(2) | |
| 245 | DISCRETE_TASK_END() | |
| 246 | ||
| 247 | DISCRETE_TASK_START(1) | |
| 248 | SPRINT8_MOTOR_CIRCUIT(3) | |
| 249 | SPRINT8_MOTOR_CIRCUIT(7) | |
| 250 | DISCRETE_TASK_END() | |
| 251 | ||
| 252 | DISCRETE_TASK_START(1) | |
| 253 | SPRINT8_MOTOR_CIRCUIT(5) | |
| 254 | SPRINT8_MOTOR_CIRCUIT(6) | |
| 255 | DISCRETE_TASK_END() | |
| 256 | ||
| 257 | DISCRETE_TASK_START(1) | |
| 258 | SPRINT8_MOTOR_CIRCUIT(4) | |
| 259 | SPRINT8_MOTOR_CIRCUIT(8) | |
| 260 | DISCRETE_TASK_END() | |
| 261 | ||
| 262 | /************************************************ | |
| 263 | * Final Mix | |
| 264 | ************************************************/ | |
| 265 | DISCRETE_TASK_START(2) | |
| 266 | DISCRETE_MIXER3(SPRINT8_AUDIO_1_2, | |
| 267 | SPRINT8_ATTRACT_EN, /* ENAB */ | |
| 268 | SPRINT8_CRASH_SCREECH_SND, | |
| 269 | SPRINT8_MOTOR1_SND, | |
| 270 | SPRINT8_MOTOR2_SND, | |
| 271 | &sprint8_mixer) | |
| 272 | DISCRETE_MIXER3(SPRINT8_AUDIO_3_7, | |
| 273 | SPRINT8_ATTRACT_EN, /* ENAB */ | |
| 274 | SPRINT8_CRASH_SCREECH_SND, | |
| 275 | SPRINT8_MOTOR3_SND, | |
| 276 | SPRINT8_MOTOR7_SND, | |
| 277 | &sprint8_mixer) | |
| 278 | DISCRETE_MIXER3(SPRINT8_AUDIO_5_6, | |
| 279 | SPRINT8_ATTRACT_EN, /* ENAB */ | |
| 280 | SPRINT8_CRASH_SCREECH_SND, | |
| 281 | SPRINT8_MOTOR5_SND, | |
| 282 | SPRINT8_MOTOR6_SND, | |
| 283 | &sprint8_mixer) | |
| 284 | DISCRETE_MIXER3(SPRINT8_AUDIO_4_8, | |
| 285 | SPRINT8_ATTRACT_EN, /* ENAB */ | |
| 286 | SPRINT8_CRASH_SCREECH_SND, | |
| 287 | SPRINT8_MOTOR4_SND, | |
| 288 | SPRINT8_MOTOR8_SND, | |
| 289 | &sprint8_mixer) | |
| 290 | DISCRETE_OUTPUT(SPRINT8_AUDIO_1_2, 65500.0/8) | |
| 291 | DISCRETE_OUTPUT(SPRINT8_AUDIO_3_7, 65500.0/8) | |
| 292 | DISCRETE_OUTPUT(SPRINT8_AUDIO_5_6, 65500.0/8) | |
| 293 | DISCRETE_OUTPUT(SPRINT8_AUDIO_4_8, 65500.0/8) | |
| 294 | DISCRETE_TASK_END() | |
| 295 | DISCRETE_SOUND_END | |
| 296 | ||
| 297 | ||
| 298 | WRITE8_DEVICE_HANDLER( sprint8_crash_w ) | |
| 299 | { | |
| 300 | discrete_sound_w(device, SPRINT8_CRASH_EN, data & 0x01); | |
| 301 | } | |
| 302 | ||
| 303 | WRITE8_DEVICE_HANDLER( sprint8_screech_w ) | |
| 304 | { | |
| 305 | discrete_sound_w(device, SPRINT8_SCREECH_EN, data & 0x01); | |
| 306 | } | |
| 307 | ||
| 308 | WRITE8_DEVICE_HANDLER( sprint8_attract_w ) | |
| 309 | { | |
| 310 | discrete_sound_w(device, SPRINT8_ATTRACT_EN, data & 0x01); | |
| 311 | } | |
| 312 | ||
| 313 | WRITE8_DEVICE_HANDLER( sprint8_motor_w ) | |
| 314 | { | |
| 315 | discrete_sound_w(device, NODE_RELATIVE(SPRINT8_MOTOR1_EN, offset & 0x07), data & 0x01); | |
| 316 | } |
| r5955 | r5956 | |
|---|---|---|
| 187 | 187 | DISCRETE_TRANSFORM3(NODE_32, MADALIEN_8910_PSG_A, NODE_30, -RES_K(10)/RES_K(3.3), "01-2*1+") |
| 188 | 188 | // pin 1 |
| 189 | 189 | DISCRETE_SWITCH(NODE_33, 1, MADALIEN_8910_PORTA_3, NODE_31, NODE_32) |
| 190 | DISCRETE_CLAMP(NODE_34, | |
| 190 | DISCRETE_CLAMP(NODE_34, | |
| 191 | 191 | |
| 192 | 192 | // bottom op-amp |
| 193 | 193 | DISCRETE_ONOFF(NODE_40, MADALIEN_8910_PORTA_6, MADALIEN_8910_PSG_B) |
| r5955 | r5956 | |
| 230 | 230 | ************************************************/ |
| 231 | 231 | DISCRETE_CRFILTER(NODE_60, 1, MADALIEN_8910_PORTB_7, RES_K(100), CAP_U(4.7)) |
| 232 | 232 | // 2 diodes clamp it positive. |
| 233 | DISCRETE_CLAMP(NODE_62, | |
| 233 | DISCRETE_CLAMP(NODE_62, | |
| 234 | 234 | // the 0.047uF cap to ground just removes real world spikes. |
| 235 | 235 | // it does not have to be simulated. |
| 236 | 236 | DISCRETE_MIXER2(NODE_64, 1, NODE_62, 5, &madalien_555_1c_cv) |
| r5955 | r5956 | |
|---|---|---|
| 16 | 16 | /* FIXME: Capacitor aging - only in for calibration now */ |
| 17 | 17 | /* Adjustments are needed to bring this close to recordings */ |
| 18 | 18 | |
| 19 | #define CAP_AGE(c, f) ((c) * (f)) | |
| 20 | ||
| 21 | 19 | /* FIXME: Awaiting verification. VCO range inputs are shown */ |
| 22 | 20 | /* as connected to +5V on schematics. This does not match */ |
| 23 | 21 | /* recordings */ |
| r5955 | r5956 | |
| 132 | 130 | #define DISCRETE_LS123_INV(_N, _T, _R, _C) \ |
| 133 | 131 | DISCRETE_ONESHOTR(_N, 0, _T, TTL_HIGH, (0.25 * (_R) * (_C) * (1.0+700./(_R))), DISC_ONESHOT_RETRIG | DISC_ONESHOT_REDGE | DISC_OUT_ACTIVE_LOW) |
| 134 | 132 | |
| 133 | /* speed optimization */ | |
| 134 | /* pow(10, x) = exp(ln(10)*x) */ | |
| 135 | #define pow10(x) exp(2.30258509299404568401*(x)) | |
| 136 | ||
| 135 | 137 | /* The following formula was derived from figures 2 and 3 in LS624 datasheet. Coefficients |
| 136 | 138 | * where calculated using least square approximation. |
| 137 | 139 | * This approach gives a bit better results compared to the first approach. |
| 138 | 140 | */ |
| 139 | #define LS624_F(_C, _VI, _VR) pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \ | |
| 140 | - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925) | |
| 141 | //#define LS624_F(_C, _VI, _VR) pow10( -0.912029404 * log10(_C) + 0.243264328 * (_VI) | |
| 142 | // - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925) | |
| 143 | #define LS624_F(_in, _num) pow10(context->k1_##_num + 0.243264328 * (_in) + context->k2_##_num * (_in)) | |
| 141 | 144 | |
| 142 | 145 | /************************************************************************ |
| 143 | 146 | * |
| r5955 | r5956 | |
| 184 | 187 | double remain1; |
| 185 | 188 | double remain2; |
| 186 | 189 | double vc3; |
| 190 | double r1_c3; | |
| 191 | double k1_1; | |
| 192 | double k2_1; | |
| 193 | double k1_2; | |
| 194 | double k2_2; | |
| 195 | double exponent_c3; | |
| 196 | double dt_in1_at_0; | |
| 197 | double dt_in2_at_0; | |
| 187 | 198 | }; |
| 188 | 199 | |
| 189 | 200 | static DISCRETE_STEP( mario_custom_run ) |
| 190 | 201 | { |
| 191 | 202 | struct mario_custom_run_context *context = (struct mario_custom_run_context *)node->context; |
| 192 | 203 | |
| 193 | double t1 = 0.5 / LS624_F(MARIO_CUSTOM_C1, MARIO_CUSTOM_IN1, RUN_VCO_VOLTAGE); | |
| 194 | double t2 = 0.5 / LS624_F(MARIO_CUSTOM_C2, MARIO_CUSTOM_IN2, RUN_VCO_VOLTAGE); | |
| 195 | 204 | double sample_t = node->info->sample_time; |
| 196 | double vn, t; | |
| 205 | double vn, exponent, t = 0; | |
| 206 | int update_exponent = 0; | |
| 207 | double t1, t2; | |
| 197 | 208 | |
| 198 | //if (MARIO_CUSTOM_VOUT) | |
| 199 | // printf("%f %f %f %f\n", MARIO_CUSTOM_IN1, MARIO_CUSTOM_IN2, 0.5 / t1, 0.5 / t2); | |
| 209 | if (MARIO_CUSTOM_IN1 > 0.001) | |
| 210 | t1 = 0.5 / LS624_F(MARIO_CUSTOM_IN1, 1); | |
| 211 | else | |
| 212 | /* close enough to 0, so we can speed things up by no longer call pow() */ | |
| 213 | t1 = context->dt_in1_at_0; | |
| 214 | ||
| 215 | if (MARIO_CUSTOM_IN2 > 0.001) | |
| 216 | t2 = 0.5 / LS624_F(MARIO_CUSTOM_IN2, 2); | |
| 217 | else | |
| 218 | t2 = context->dt_in2_at_0; | |
| 219 | ||
| 200 | 220 | while (sample_t > 0.0f) |
| 201 | 221 | { |
| 202 | 222 | /* state before time advance */ |
| r5955 | r5956 | |
| 207 | 227 | if (context->remain1 < sample_t) |
| 208 | 228 | { |
| 209 | 229 | t = context->remain1; |
| 230 | update_exponent = 1; | |
| 210 | 231 | context->state1 ^= 1; |
| 211 | 232 | sample_t -= context->remain1; |
| 212 | 233 | context->remain2 -= context->remain1; |
| r5955 | r5956 | |
| 214 | 235 | } |
| 215 | 236 | else |
| 216 | 237 | { |
| 217 | t = sample_t; | |
| 218 | 238 | context->remain1 -= sample_t; |
| 219 | 239 | context->remain2 -= sample_t; |
| 220 | 240 | sample_t = 0.0f; |
| r5955 | r5956 | |
| 225 | 245 | if (context->remain2 < sample_t) |
| 226 | 246 | { |
| 227 | 247 | t = context->remain2; |
| 248 | update_exponent = 1; | |
| 228 | 249 | context->state2 ^= 1; |
| 229 | 250 | sample_t -= context->remain2; |
| 230 | 251 | context->remain1 -= context->remain2; |
| r5955 | r5956 | |
| 232 | 253 | } |
| 233 | 254 | else |
| 234 | 255 | { |
| 235 | t = sample_t; | |
| 236 | 256 | context->remain1 -= sample_t; |
| 237 | 257 | context->remain2 -= sample_t; |
| 238 | 258 | sample_t = 0.0f; |
| 239 | 259 | } |
| 240 | 260 | } |
| 241 | 261 | |
| 242 | context->vc3 += (vn - context->vc3) * (1.0 - exp(- t / (MARIO_CUSTOM_R1 * MARIO_CUSTOM_C3))); | |
| 262 | if (update_exponent) | |
| 263 | exponent = RC_CHARGE_EXP_DT(context->r1_c3, t); | |
| 264 | else | |
| 265 | exponent = context->exponent_c3; | |
| 266 | context->vc3 += (vn - context->vc3) * exponent; | |
| 243 | 267 | } |
| 244 | 268 | node->output[0] = context->vc3; |
| 245 | 269 | } |
| r5955 | r5956 | |
| 253 | 277 | context->state1 = 0; |
| 254 | 278 | context->state2 = 0; |
| 255 | 279 | context->vc3 = 0; |
| 280 | context->r1_c3 = MARIO_CUSTOM_R1 * MARIO_CUSTOM_C3; | |
| 256 | 281 | node->output[0] = 0; |
| 282 | ||
| 283 | /* precalculate some parts of the formulas for speed */ | |
| 284 | context->k1_1 = -0.912029404 * log10(MARIO_CUSTOM_C1) -0.091695877 * (RUN_VCO_VOLTAGE) - 3.207072925; | |
| 285 | context->k2_1 = -0.014110946 * (RUN_VCO_VOLTAGE); | |
| 286 | context->k1_2 = -0.912029404 * log10(MARIO_CUSTOM_C2) -0.091695877 * (RUN_VCO_VOLTAGE) - 3.207072925; | |
| 287 | context->k2_2 = -0.014110946 * (RUN_VCO_VOLTAGE); | |
| 288 | context->exponent_c3 = RC_CHARGE_EXP(context->r1_c3); | |
| 289 | ||
| 290 | context->dt_in1_at_0 = 0.5 / LS624_F(0, 1); | |
| 291 | context->dt_in2_at_0 = 0.5 / LS624_F(0, 2); | |
| 257 | 292 | } |
| 258 | 293 | |
| 259 | 294 | static const discrete_custom_info mario_custom_run_info = |
| r5955 | r5956 | |
| 269 | 304 | /************************************************/ |
| 270 | 305 | |
| 271 | 306 | /* DISCRETE_INPUT_DATA */ |
| 272 | DISCRETE_INPUT_PULSE(DS_SOUND0_INV, 1) | |
| 273 | DISCRETE_INPUT_PULSE(DS_SOUND1_INV, 1) | |
| 274 | 307 | DISCRETE_INPUT_NOT(DS_SOUND7_INV) |
| 275 | DISCRETE_INPUT_DATA(DS_DAC) | |
| 276 | 308 | |
| 277 | 309 | /************************************************/ |
| 278 | 310 | /* SOUND0 */ |
| 279 | 311 | /************************************************/ |
| 280 | 312 | |
| 281 | DISCRETE_LS123(NODE_10, DS_SOUND0_INV, MR_R17, CAP_AGE(MR_C14, 0.7)) | |
| 282 | DISCRETE_RCFILTER(NODE_11, 1, NODE_10, MR_R6, CAP_AGE(MR_C3, 0.5) ) | |
| 313 | DISCRETE_TASK_START(1) | |
| 314 | DISCRETE_INPUT_PULSE(DS_SOUND0_INV, 1) | |
| 315 | DISCRETE_LS123(NODE_10, DS_SOUND0_INV, MR_R17, MR_C14) | |
| 316 | DISCRETE_RCFILTER(NODE_11, 1, NODE_10, MR_R6, MR_C3 ) | |
| 283 | 317 | DISCRETE_CUSTOM7(NODE_12, NODE_10, NODE_11, NODE_11, MR_C6, MR_C17, |
| 284 | 318 | MR_MIXER_RPAR, MR_C31, &mario_custom_run_info) |
| 285 | 319 | DISCRETE_MULTIPLY(DS_OUT_SOUND0, NODE_12, MR_MIXER_RPAR / MR_R20) |
| 320 | DISCRETE_TASK_END() | |
| 286 | 321 | |
| 287 | 322 | /************************************************/ |
| 288 | 323 | /* SOUND1 */ |
| 289 | 324 | /************************************************/ |
| 290 | 325 | |
| 291 | DISCRETE_LS123(NODE_20, DS_SOUND1_INV, MR_R18, CAP_AGE(MR_C15, 0.7)) | |
| 292 | DISCRETE_RCFILTER(NODE_21, 1, NODE_20, MR_R7, CAP_AGE(MR_C4, 0.5) ) | |
| 326 | DISCRETE_TASK_START(1) | |
| 327 | DISCRETE_INPUT_PULSE(DS_SOUND1_INV, 1) | |
| 328 | DISCRETE_LS123(NODE_20, DS_SOUND1_INV, MR_R18, MR_C15) | |
| 329 | DISCRETE_RCFILTER(NODE_21, 1, NODE_20, MR_R7, MR_C4 ) | |
| 293 | 330 | DISCRETE_CUSTOM7(NODE_22, NODE_20, NODE_21, NODE_21, MR_C5, MR_C16, |
| 294 | 331 | MR_MIXER_RPAR, MR_C31, &mario_custom_run_info) |
| 295 | 332 | DISCRETE_MULTIPLY(DS_OUT_SOUND1, NODE_22, MR_MIXER_RPAR / MR_R19) |
| 333 | DISCRETE_TASK_END() | |
| 296 | 334 | |
| 297 | 335 | /************************************************/ |
| 298 | 336 | /* SOUND7 */ |
| 299 | 337 | /************************************************/ |
| 300 | 338 | |
| 339 | DISCRETE_TASK_START(1) | |
| 301 | 340 | DISCRETE_COUNTER(NODE_100,1,0,NODE_118,0xFFFF,DISC_COUNT_UP,0,DISC_CLK_BY_COUNT) |
| 302 | 341 | |
| 303 | 342 | DISCRETE_BIT_DECODE(NODE_102, NODE_100, 3, 1) //LS157 2B |
| 304 | 343 | DISCRETE_BIT_DECODE(NODE_104, NODE_100, 11, TTL_HIGH) //LS157 3B |
| 305 | 344 | |
| 306 | DISCRETE_LS123(NODE_110, DS_SOUND7_INV, MR_R61, | |
| 345 | DISCRETE_LS123(NODE_110, DS_SOUND7_INV, MR_R61, | |
| 307 | 346 | DISCRETE_TRANSFORM2(NODE_111, NODE_110, TTL_HIGH, "0!1*") |
| 308 | 347 | DISCRETE_RCFILTER(NODE_112, 1, NODE_111, MR_R65, MR_C44) |
| 309 | DISCRETE_74LS624(NODE_113, NODE_112, VSS, MR_C40, DISC_LS624_OUT_LOGIC) | |
| 348 | DISCRETE_74LS624(NODE_113, NODE_112, RUN_VCO_VOLTAGE /*VSS*/, MR_C40, DISC_LS624_OUT_LOGIC) | |
| 310 | 349 | |
| 311 | 350 | DISCRETE_LOGIC_XOR(NODE_115, NODE_102, NODE_113) |
| 312 | 351 | |
| 313 | 352 | DISCRETE_RCFILTER(NODE_117, 1, NODE_104, MR_R64, MR_C43) |
| 314 | DISCRETE_74LS624(NODE_118, NODE_117, VSS, MR_C39, DISC_LS624_OUT_COUNT_F) | |
| 353 | DISCRETE_74LS624(NODE_118, NODE_117, RUN_VCO_VOLTAGE /*VSS*/, MR_C39, DISC_LS624_OUT_COUNT_F) | |
| 315 | 354 | |
| 316 | 355 | DISCRETE_LOGIC_AND(NODE_120, NODE_115, NODE_110) |
| 317 | 356 | DISCRETE_MULTIPLY(NODE_121, NODE_120, TTL_HIGH * MR_MIXER_RPAR / MR_R41) |
| 318 | 357 | DISCRETE_RCFILTER(DS_OUT_SOUND7, 1, NODE_121, MR_MIXER_RPAR, MR_C31) |
| 358 | DISCRETE_TASK_END() | |
| 319 | 359 | |
| 320 | 360 | /************************************************/ |
| 321 | 361 | /* DAC */ |
| r5955 | r5956 | |
| 325 | 365 | * is a filter circuit. Simulation in LTSPICE shows, that the following is equivalent: |
| 326 | 366 | */ |
| 327 | 367 | |
| 368 | DISCRETE_TASK_START(1) | |
| 369 | DISCRETE_INPUT_BUFFER(DS_DAC, 0) | |
| 328 | 370 | DISCRETE_MULTIPLY(NODE_170, DS_DAC, TTL_HIGH/256.0) |
| 329 | 371 | DISCRETE_RCFILTER(NODE_171, 1, NODE_170, RES_K(750), CAP_P(200)) |
| 330 | 372 | |
| 331 | 373 | DISCRETE_MULTIPLY(NODE_172, NODE_171, MR_MIXER_RPAR / MR_R40) |
| 332 | 374 | DISCRETE_RCFILTER(DS_OUT_DAC, 1, NODE_172, MR_MIXER_RPAR, MR_C31) |
| 375 | DISCRETE_TASK_END() | |
| 333 | 376 | |
| 334 | 377 | |
| 335 | 378 | /************************************************/ |
| 336 | 379 | /* MIXER */ |
| 337 | 380 | /************************************************/ |
| 338 | 381 | |
| 382 | DISCRETE_TASK_START(2) | |
| 339 | 383 | DISCRETE_ADDER4(NODE_295, 1, DS_OUT_SOUND0, DS_OUT_SOUND1, DS_OUT_SOUND7, DS_OUT_DAC) |
| 340 | 384 | |
| 341 | 385 | /* Amplifier: internal amplifier |
| r5955 | r5956 | |
| 347 | 391 | DISCRETE_OUTPUT(NODE_297, 32767.0/5.0 * 10) |
| 348 | 392 | //DISCRETE_WAVELOG1(DS_OUT_SOUND0, 32767/5.0) |
| 349 | 393 | //DISCRETE_WAVELOG2(NODE_296, 32767/5.0 * 2, DS_SOUND7_INV, 10000) |
| 394 | DISCRETE_TASK_END() | |
| 350 | 395 | |
| 351 | 396 | DISCRETE_SOUND_END |
| 352 | 397 |
| r5955 | r5956 | |
|---|---|---|
| 336 | 336 | 0.5 /* overall filter GAIN */) |
| 337 | 337 | /* clamp to the maximum of the op-amp shifted by vRef */ |
| 338 | 338 | DISCRETE_CLAMP(POLEPOS_CHANL4_SND, |
| 339 | 1, /* ENAB */ | |
| 340 | 339 | NODE_54, /* IN0 */ |
| 341 | 340 | 0, /* MIN */ |
| 342 | 5.0 - OP_AMP_VP_RAIL_OFFSET - POLEPOS_VREF, /* MAX */ | |
| 343 | 0.0 - POLEPOS_VREF /* disabled CLAMP value */) | |
| 341 | 5.0 - OP_AMP_VP_RAIL_OFFSET - POLEPOS_VREF) /* MAX */ | |
| 344 | 342 | |
| 345 | 343 | /************************************************ |
| 346 | 344 | * Output |
| r5955 | r5956 | |
|---|---|---|
| 252 | 252 | 1.0 + 100.0/22, // max gain of E5 = 1 + r132/r101 |
| 253 | 253 | DISC_LINADJ, "CRASH") |
| 254 | 254 | DISCRETE_MULTIPLY(NODE_129, NODE_127, NODE_128 ) |
| 255 | DISCRETE_CLAMP(TANK8_CRASHEXPL, | |
| 255 | DISCRETE_CLAMP(TANK8_CRASHEXPL, | |
| 256 | 256 | |
| 257 | 257 | /************************************************/ |
| 258 | 258 | /* Combine all 10 sound sources. */ |
| r5955 | r5956 | |
|---|---|---|
| 64 | 64 | DISCRETE_OP_AMP_TRIG_VCA(MIDWAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, MIDWAY_TONE_EN, 0, 12, 0, &discrete_op_amp_tvca_info) |
| 65 | 65 | |
| 66 | 66 | |
| 67 | /* most common values based on clowns schematic */ | |
| 68 | static const discrete_op_amp_tvca_info midway_music_tvca_info = | |
| 69 | { | |
| 70 | RES_M(3.3), /* r502 */ | |
| 71 | RES_K(10) + RES_K(680), /* r505 + r506 */ | |
| 72 | 0, | |
| 73 | RES_K(680), /* r503 */ | |
| 74 | RES_K(10), /* r500 */ | |
| 75 | 0, | |
| 76 | RES_K(680), /* r501 */ | |
| 77 | 0, | |
| 78 | 0, | |
| 79 | 0, | |
| 80 | 0, | |
| 81 | CAP_U(.001), /* c500 */ | |
| 82 | 0, | |
| 83 | 0, | |
| 84 | 12, /* v1 */ | |
| 85 | 0, /* v2 */ | |
| 86 | 0, /* v3 */ | |
| 87 | 12, /* vP */ | |
| 88 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 89 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 90 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 91 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 92 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 93 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 94 | }; | |
| 95 | ||
| 96 | ||
| 67 | 97 | WRITE8_DEVICE_HANDLER( midway_tone_generator_lo_w ) |
| 68 | 98 | { |
| 69 | 99 | discrete_sound_w(device, MIDWAY_TONE_EN, (data >> 0) & 0x01); |
| r5955 | r5956 | |
| 974 | 1004 | DISCRETE_FILTER2(NODE_23, |
| 975 | 1005 | 1, /* ENAB */ |
| 976 | 1006 | NODE_21, /* INP0 */ |
| 977 | 35, /* FREQ */ | |
| 1007 | 35, /* FREQ */ | |
| 978 | 1008 | 1.0 / 8, /* DAMP */ |
| 979 | 1009 | DISC_FILTER_BANDPASS) |
| 980 | 1010 | DISCRETE_GAIN(NODE_24, |
| 981 | 1011 | NODE_23, /* IN0 */ |
| 982 | 1012 | 15) /* GAIN */ |
| 983 | 1013 | DISCRETE_CLAMP(CHECKMAT_BOOM_SND, /* IC Q2/3, pin 10 */ |
| 984 | 1, /* ENAB */ | |
| 985 | 1014 | NODE_24, /* IN0 */ |
| 986 | 1015 | 0 - 6, /* MIN */ |
| 987 | 12.0 - OP_AMP_NORTON_VBE -6,/* MAX */ | |
| 988 | 0) /* CLAMP */ | |
| 1016 | 12.0 - OP_AMP_NORTON_VBE -6)/* MAX */ | |
| 989 | 1017 | |
| 990 | 1018 | /************************************************ |
| 991 | 1019 | * Tone generator |
| r5955 | r5956 | |
| 1089 | 1117 | #define DESERTGU_MUSIC_ADJ NODE_15 |
| 1090 | 1118 | |
| 1091 | 1119 | |
| 1092 | static const discrete_op_amp_tvca_info desertgu_tone_music_info = | |
| 1093 | { | |
| 1094 | RES_M(3.3), /* r502 */ | |
| 1095 | RES_K(10) + RES_K(680), /* r505 + r506 */ | |
| 1096 | 0, | |
| 1097 | RES_K(680), /* r503 */ | |
| 1098 | RES_K(10), /* r500 */ | |
| 1099 | 0, | |
| 1100 | RES_K(680), /* r501 */ | |
| 1101 | 0, | |
| 1102 | 0, | |
| 1103 | 0, | |
| 1104 | 0, | |
| 1105 | CAP_U(.001), /* c500 */ | |
| 1106 | 0, 0, | |
| 1107 | 12, /* v1 */ | |
| 1108 | 0, /* v2 */ | |
| 1109 | 0, /* v3 */ | |
| 1110 | 12, /* vP */ | |
| 1111 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 1112 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1113 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 1114 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1115 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1116 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 1117 | }; | |
| 1118 | ||
| 1119 | ||
| 1120 | 1120 | static const discrete_op_amp_tvca_info desertgu_rifle_shot_tvca_info = |
| 1121 | 1121 | { |
| 1122 | 1122 | RES_M(2.7), |
| r5955 | r5956 | |
| 1227 | 1227 | /************************************************ |
| 1228 | 1228 | * Tone generator |
| 1229 | 1229 | ************************************************/ |
| 1230 | MIDWAY_TONE_GENERATOR(d | |
| 1230 | MIDWAY_TONE_GENERATOR(midway | |
| 1231 | 1231 | |
| 1232 | 1232 | /************************************************ |
| 1233 | 1233 | * Rifle shot sound |
| r5955 | r5956 | |
| 1359 | 1359 | }; |
| 1360 | 1360 | |
| 1361 | 1361 | |
| 1362 | static const discrete_op_amp_tvca_info dplay_music_tvca_info = | |
| 1363 | { | |
| 1364 | RES_M(3.3), | |
| 1365 | RES_K(10) + RES_K(680), | |
| 1366 | 0, | |
| 1367 | RES_K(680), | |
| 1368 | RES_K(10), | |
| 1369 | 0, | |
| 1370 | RES_K(680), | |
| 1371 | 0, | |
| 1372 | 0, | |
| 1373 | 0, | |
| 1374 | 0, | |
| 1375 | CAP_U(.001), | |
| 1376 | 0, | |
| 1377 | 0, | |
| 1378 | 12, /* v1 */ | |
| 1379 | 0, /* v2 */ | |
| 1380 | 0, /* v3 */ | |
| 1381 | 12, /* vP */ | |
| 1382 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 1383 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1384 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 1385 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1386 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1387 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 1388 | }; | |
| 1389 | ||
| 1390 | ||
| 1391 | 1362 | static const discrete_integrate_info dplay_siren_integrate_info = |
| 1392 | 1363 | { |
| 1393 | 1364 | DISC_INTEGRATE_OP_AMP_1 | DISC_OP_AMP_IS_NORTON, |
| r5955 | r5956 | |
| 1522 | 1493 | /************************************************ |
| 1523 | 1494 | * Music and Tone Generator |
| 1524 | 1495 | ************************************************/ |
| 1525 | MIDWAY_TONE_GENERATOR(d | |
| 1496 | MIDWAY_TONE_GENERATOR(midw | |
| 1526 | 1497 | |
| 1527 | DISCRETE_OP_AMP_TRIG_VCA(DPLAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, DPLAY_TONE_ON_EN, 0, 12, 0, &d | |
| 1498 | DISCRETE_OP_AMP_TRIG_VCA(DPLAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, DPLAY_TONE_ON_EN, 0, 12, 0, &midw | |
| 1528 | 1499 | |
| 1529 | 1500 | /************************************************ |
| 1530 | 1501 | * Siren |
| r5955 | r5956 | |
| 1811 | 1782 | #define CLOWNS_SB_MISS_SND NODE_09 |
| 1812 | 1783 | |
| 1813 | 1784 | /* nodes - adjusters */ |
| 1814 | #define CLOWNS_ | |
| 1785 | #define CLOWNS_R507 | |
| 1815 | 1786 | |
| 1816 | 1787 | |
| 1817 | static const discrete_op_amp_tvca_info clowns_music_tvca_info = | |
| 1818 | { | |
| 1819 | RES_M(3.3), /* r502 */ | |
| 1820 | RES_K(10) + RES_K(680), /* r505 + r506 */ | |
| 1821 | 0, | |
| 1822 | RES_K(680), /* r503 */ | |
| 1823 | RES_K(10), /* r500 */ | |
| 1824 | 0, | |
| 1825 | RES_K(680), /* r501 */ | |
| 1826 | 0, | |
| 1827 | 0, | |
| 1828 | 0, | |
| 1829 | 0, | |
| 1830 | CAP_U(.001), /* c500 */ | |
| 1831 | 0, | |
| 1832 | 0, | |
| 1833 | 12, /* v1 */ | |
| 1834 | 0, /* v2 */ | |
| 1835 | 0, /* v3 */ | |
| 1836 | 12, /* vP */ | |
| 1837 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 1838 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1839 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 1840 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1841 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 1842 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 1843 | }; | |
| 1844 | ||
| 1845 | ||
| 1846 | 1788 | static const discrete_op_amp_tvca_info clowns_pop_tvca_info = |
| 1847 | 1789 | { |
| 1848 | 1790 | RES_M(2.7), /* r304 */ |
| r5955 | r5956 | |
| 1924 | 1866 | { 0, |
| 1925 | 1867 | 0, |
| 1926 | 1868 | 0, |
| 1927 | CLOWNS_ | |
| 1869 | CLOWNS_R507 | |
| 1928 | 1870 | { 0, |
| 1929 | 1871 | CAP_U(0.022), |
| 1930 | 1872 | 0, |
| r5955 | r5956 | |
| 1952 | 1894 | /* The low value of the pot is set to 7000. A real 1M pot will never go to 0 anyways. */ |
| 1953 | 1895 | /* This will give the control more apparent volume range. */ |
| 1954 | 1896 | /* The music way overpowers the rest of the sounds anyways. */ |
| 1955 | DISCRETE_ADJUSTMENT_TAG(CLOWNS_ | |
| 1897 | DISCRETE_ADJUSTMENT_TAG(CLOWNS_R507 | |
| 1956 | 1898 | |
| 1957 | 1899 | /************************************************ |
| 1958 | 1900 | * Tone generator |
| 1959 | 1901 | ************************************************/ |
| 1960 | MIDWAY_TONE_GENERATOR( | |
| 1902 | MIDWAY_TONE_GENERATOR(midway_music_tvca_info) | |
| 1961 | 1903 | |
| 1962 | 1904 | /************************************************ |
| 1963 | 1905 | * Balloon hit sounds |
| r5955 | r5956 | |
| 2062 | 2004 | * |
| 2063 | 2005 | * Space Walk |
| 2064 | 2006 | * |
| 2007 | * Discrete sound emulation: Oct 2009, D.R. | |
| 2008 | * | |
| 2065 | 2009 | *************************************/ |
| 2066 | 2010 | |
| 2011 | /* Discrete Sound Input Nodes */ | |
| 2012 | #define SPACWALK_TARGET_HIT_BOTTOM_EN NODE_01 | |
| 2013 | #define SPACWALK_TARGET_HIT_MIDDLE_EN NODE_02 | |
| 2014 | #define SPACWALK_TARGET_HIT_TOP_EN NODE_03 | |
| 2015 | #define SPACWALK_SPRINGBOARD_HIT1_EN NODE_04 | |
| 2016 | #define SPACWALK_SPRINGBOARD_HIT2_EN NODE_05 | |
| 2017 | #define SPACWALK_SPRINGBOARD_MISS_EN NODE_06 | |
| 2018 | #define SPACWALK_SPACE_SHIP_EN NODE_07 | |
| 2019 | ||
| 2020 | /* Discrete Sound Output Nodes */ | |
| 2021 | #define SPACWALK_NOISE NODE_10 | |
| 2022 | #define SPACWALK_TARGET_HIT_SND NODE_11 | |
| 2023 | #define SPACWALK_SPRINGBOARD_HIT1_SND NODE_12 | |
| 2024 | #define SPACWALK_SPRINGBOARD_HIT2_SND NODE_13 | |
| 2025 | #define SPACWALK_SPRINGBOARD_MISS_SND NODE_14 | |
| 2026 | #define SPACWALK_SPACE_SHIP_SND NODE_15 | |
| 2027 | ||
| 2028 | /* Adjusters */ | |
| 2029 | #define SPACWALK_R507_POT NODE_19 | |
| 2030 | ||
| 2031 | /* Parts List - Resistors */ | |
| 2032 | #define SPACWALK_R200 RES_K(820) | |
| 2033 | #define SPACWALK_R201 RES_K(150) | |
| 2034 | #define SPACWALK_R202 RES_M(1) | |
| 2035 | #define SPACWALK_R203 RES_K(82) | |
| 2036 | #define SPACWALK_R204 RES_K(240) | |
| 2037 | #define SPACWALK_R205 RES_K(220) | |
| 2038 | #define SPACWALK_R206 RES_K(120) | |
| 2039 | #define SPACWALK_R207 RES_M(1) | |
| 2040 | #define SPACWALK_R208 RES_K(300) | |
| 2041 | #define SPACWALK_R210 RES_K(56) | |
| 2042 | #define SPACWALK_R211 RES_K(100) | |
| 2043 | #define SPACWALK_R213 RES_K(300) | |
| 2044 | #define SPACWALK_R214 RES_K(27) | |
| 2045 | #define SPACWALK_R215 RES_K(51) | |
| 2046 | #define SPACWALK_R216 RES_K(30) | |
| 2047 | #define SPACWALK_R300 RES_K(270) | |
| 2048 | #define SPACWALK_R301 RES_K(300) | |
| 2049 | #define SPACWALK_R302 RES_K(330) | |
| 2050 | #define SPACWALK_R303 RES_K(680) | |
| 2051 | #define SPACWALK_R304 RES_M(1) | |
| 2052 | #define SPACWALK_R305 RES_K(3680) | |
| 2053 | #define SPACWALK_R307 RES_K(20) | |
| 2054 | #define SPACWALK_R308 RES_K(20) /* not labeled but it's beside R307 */ | |
| 2055 | #define SPACWALK_R419 RES_K(2.7) | |
| 2056 | #define SPACWALK_R420 RES_K(20) | |
| 2057 | #define SPACWALK_R421 RES_K(11) | |
| 2058 | #define SPACWALK_R422 RES_K(75) | |
| 2059 | #define SPACWALK_R507 RES_M(1) | |
| 2060 | #define SPACWALK_RJ3 RES_K(1) | |
| 2061 | ||
| 2062 | /* Parts List - Capacitors */ | |
| 2063 | #define SPACWALK_C200 CAP_U(0.0022) | |
| 2064 | #define SPACWALK_C201 CAP_U(3.3) | |
| 2065 | #define SPACWALK_C203 CAP_U(0.0033) | |
| 2066 | #define SPACWALK_C204 CAP_U(0.0033) | |
| 2067 | #define SPACWALK_C300 CAP_U(2.2) | |
| 2068 | #define SPACWALK_C301 CAP_U(2.2) | |
| 2069 | #define SPACWALK_C302 CAP_U(2.2) | |
| 2070 | #define SPACWALK_C303 CAP_U(0.0047) | |
| 2071 | #define SPACWALK_C304 CAP_U(0.0047) /* not labeled but it's beside C303 */ | |
| 2072 | #define SPACWALK_C602 CAP_U(1) | |
| 2073 | ||
| 2074 | ||
| 2075 | static const discrete_op_amp_tvca_info spacwalk_hit_tvca_info = | |
| 2076 | { | |
| 2077 | SPACWALK_R304, SPACWALK_R303, 0, SPACWALK_R305, /* r1, r2, r3, r4 */ | |
| 2078 | SPACWALK_RJ3, 0, SPACWALK_R300, /* r5, r6, r7 */ | |
| 2079 | SPACWALK_RJ3, SPACWALK_R301, /* r8, r9 */ | |
| 2080 | SPACWALK_RJ3, SPACWALK_R302, /* r10, r11 */ | |
| 2081 | SPACWALK_C300, SPACWALK_C301, SPACWALK_C302, /* c1, c2, c3 */ | |
| 2082 | 5, 5, 5, 12, /* v1, v2, v3, vP */ | |
| 2083 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2084 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2085 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 2086 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2087 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 2088 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG2 | |
| 2089 | }; | |
| 2090 | ||
| 2091 | static const discrete_op_amp_osc_info spacwalk_sb_hit_vco = | |
| 2092 | { | |
| 2093 | DISC_OP_AMP_OSCILLATOR_VCO_3 | DISC_OP_AMP_IS_NORTON, | |
| 2094 | RES_K(330 + 150 + 30), SPACWALK_R203, SPACWALK_R201, SPACWALK_R204, /* r1, r2, r3, r4 */ | |
| 2095 | SPACWALK_R202, 0, SPACWALK_R200, 0, /* r5, r6, r7, r8*/ | |
| 2096 | SPACWALK_C200, 12 /* c, vP*/ | |
| 2097 | }; | |
| 2098 | ||
| 2099 | static const discrete_op_amp_tvca_info spacwalk_sb_hit_tvca_info = | |
| 2100 | { | |
| 2101 | SPACWALK_R207, SPACWALK_R205, 0, SPACWALK_R208, /* r1, r2, r3, r4 */ | |
| 2102 | SPACWALK_RJ3, 0, SPACWALK_R206, /* r5, r6, r7 */ | |
| 2103 | 0, 0, 0, 0 , /* r8, r9, r10, r11 */ | |
| 2104 | SPACWALK_C201, 0, 0, /* c1, c2, c3 */ | |
| 2105 | 5, 0, 0, 12, /* v1, v2, v3, vP */ | |
| 2106 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2107 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2108 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 2109 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2110 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2111 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 2112 | }; | |
| 2113 | ||
| 2114 | static const discrete_op_amp_osc_info spacwalk_spaceship_osc = | |
| 2115 | { | |
| 2116 | DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON, | |
| 2117 | RES_K(75), RES_M(1), RES_M(6.8), RES_M(2.4), 0, 0, 0, 0, /* r1, r2, r3, r4, r5, r6, r7, r8 */ | |
| 2118 | CAP_U(2.2), 12 /* c, vP */ | |
| 2119 | }; | |
| 2120 | ||
| 2121 | static const discrete_op_amp_osc_info spacwalk_spaceship_vco = | |
| 2122 | { | |
| 2123 | DISC_OP_AMP_OSCILLATOR_VCO_1 | DISC_OP_AMP_IS_NORTON | DISC_OP_AMP_OSCILLATOR_OUT_CAP, | |
| 2124 | RES_K(680), RES_K(300), RES_K(100), RES_K(150), RES_K(120), 0, 0, 0, /* r1, r2, r3, r4, r5, r6, r7, r8 */ | |
| 2125 | CAP_U(0.0012), 12 /* c, vP */ | |
| 2126 | }; | |
| 2127 | ||
| 2128 | static const discrete_mixer_desc spacwalk_mixer = | |
| 2129 | { | |
| 2130 | DISC_MIXER_IS_RESISTOR, | |
| 2131 | {SPACWALK_R422, SPACWALK_R422, RES_K(39 + 10 + 1), SPACWALK_R421, SPACWALK_R420, SPACWALK_R419}, | |
| 2132 | {0, 0, 0, 0, 0, SPACWALK_R507_POT}, /* r_nodes */ | |
| 2133 | {0}, 0, 0, 0, SPACWALK_C602, 0, 1 /* c, rI, rF, cF, cAmp, vRef, gain */ | |
| 2134 | }; | |
| 2135 | ||
| 2136 | ||
| 2137 | /************************************************ | |
| 2138 | * Springboard Hit Circuit 1 or 2 | |
| 2139 | ************************************************/ | |
| 2140 | #define SPACWALK_SPRINGBOARD_HIT_CIRCUIT(_num) \ | |
| 2141 | DISCRETE_RCFILTER(NODE_RELATIVE(NODE_29, _num), \ | |
| 2142 | 1, /* ENAB */ \ | |
| 2143 | SPACWALK_NOISE, /* IN0 */ \ | |
| 2144 | RES_K(330), CAP_U(.1)) \ | |
| 2145 | DISCRETE_RCFILTER(NODE_RELATIVE(NODE_31, _num), \ | |
| 2146 | 1, /* ENAB */ \ | |
| 2147 | NODE_RELATIVE(NODE_29, _num), /* IN0 */ \ | |
| 2148 | RES_K(330) + RES_K(150), CAP_U(.1)) \ | |
| 2149 | DISCRETE_OP_AMP_VCO1(NODE_RELATIVE(NODE_33, _num), /* IC M2-3, pin 5 */ \ | |
| 2150 | 1, /* ENAB */ \ | |
| 2151 | NODE_RELATIVE(NODE_31, _num), /* VMOD1 */ \ | |
| 2152 | &spacwalk_sb_hit_vco) \ | |
| 2153 | DISCRETE_OP_AMP_TRIG_VCA(NODE_RELATIVE(NODE_35, _num), /* IC M2-3, pin 9 */ \ | |
| 2154 | NODE_RELATIVE(SPACWALK_SPRINGBOARD_HIT1_EN, _num - 1), 0, 0, /* TRG0, TRG1, TRG2 */ \ | |
| 2155 | NODE_RELATIVE(NODE_33, _num), 0, /* IN0, IN1 */ \ | |
| 2156 | &spacwalk_sb_hit_tvca_info) \ | |
| 2157 | /* Wrong values. Untested */ \ | |
| 2158 | /* The rest of the circuit is a filter. */ \ | |
| 2159 | DISCRETE_FILTER2(NODE_RELATIVE(NODE_37, _num), \ | |
| 2160 | 1, /* ENAB */ \ | |
| 2161 | NODE_RELATIVE(NODE_35, _num), /* INP0 */ \ | |
| 2162 | 2000.0 - _num * 500, 1.0/.8, /* FREQ, DAMP */ \ | |
| 2163 | DISC_FILTER_LOWPASS) \ | |
| 2164 | /* The filter has a gain of 0.5 */ \ | |
| 2165 | DISCRETE_GAIN(NODE_RELATIVE(SPACWALK_SPRINGBOARD_HIT1_SND, _num - 1), \ | |
| 2166 | NODE_RELATIVE(NODE_37, _num), 0.5) | |
| 2167 | ||
| 2168 | static DISCRETE_SOUND_START(spacwalk) | |
| 2169 | ||
| 2170 | /************************************************ | |
| 2171 | * Input register mapping | |
| 2172 | ************************************************/ | |
| 2173 | DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_BOTTOM_EN) | |
| 2174 | DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_MIDDLE_EN) | |
| 2175 | DISCRETE_INPUT_LOGIC(SPACWALK_TARGET_HIT_TOP_EN) | |
| 2176 | DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_HIT1_EN) | |
| 2177 | DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_HIT2_EN) | |
| 2178 | DISCRETE_INPUT_LOGIC(SPACWALK_SPRINGBOARD_MISS_EN) | |
| 2179 | DISCRETE_INPUT_LOGIC(SPACWALK_SPACE_SHIP_EN) | |
| 2180 | ||
| 2181 | /* The low value of the pot is set to 7000. A real 1M pot will never go to 0 anyways. */ | |
| 2182 | /* This will give the control more apparent volume range. */ | |
| 2183 | /* The music way overpowers the rest of the sounds anyways. */ | |
| 2184 | DISCRETE_ADJUSTMENT_TAG(SPACWALK_R507_POT, SPACWALK_R507, 7000, DISC_LOGADJ, "R507") | |
| 2185 | ||
| 2186 | /************************************************ | |
| 2187 | * Tone generator | |
| 2188 | ************************************************/ | |
| 2189 | MIDWAY_TONE_GENERATOR(midway_music_tvca_info) | |
| 2190 | ||
| 2191 | /************************************************ | |
| 2192 | * Target hit sounds | |
| 2193 | * The LFSR is the same as boothill | |
| 2194 | ************************************************/ | |
| 2195 | /* Noise clock was breadboarded and measured at 7700Hz */ | |
| 2196 | DISCRETE_LFSR_NOISE(SPACWALK_NOISE, /* IC L4, pin 10 */ | |
| 2197 | 1, 1, /* ENAB, RESET */ | |
| 2198 | 7700, 12.0, 0, 12.0/2, &midway_lfsr) /* CLK,AMPL,FEED,BIAS,LFSRTB */ | |
| 2199 | ||
| 2200 | DISCRETE_OP_AMP_TRIG_VCA(NODE_20, /* IC K3, pin 9 */ | |
| 2201 | SPACWALK_TARGET_HIT_TOP_EN, SPACWALK_TARGET_HIT_MIDDLE_EN, SPACWALK_TARGET_HIT_BOTTOM_EN, | |
| 2202 | SPACWALK_NOISE, 0, /* IN0, IN1 */ | |
| 2203 | &spacwalk_hit_tvca_info) | |
| 2204 | DISCRETE_RCFILTER(NODE_21, | |
| 2205 | 1, /* ENAB */ | |
| 2206 | NODE_20, /* IN0 */ | |
| 2207 | SPACWALK_R307, SPACWALK_C303) | |
| 2208 | DISCRETE_RCFILTER(SPACWALK_TARGET_HIT_SND, | |
| 2209 | 1, /* ENAB */ | |
| 2210 | NODE_21, /* IN0 */ | |
| 2211 | SPACWALK_R307 + SPACWALK_R308, SPACWALK_C304) | |
| 2212 | ||
| 2213 | /************************************************ | |
| 2214 | * Springboard hit sounds | |
| 2215 | ************************************************/ | |
| 2216 | /* Nodes 30 - 40 */ | |
| 2217 | SPACWALK_SPRINGBOARD_HIT_CIRCUIT(1) | |
| 2218 | SPACWALK_SPRINGBOARD_HIT_CIRCUIT(2) | |
| 2219 | ||
| 2220 | /************************************************ | |
| 2221 | * Springboard miss sound | |
| 2222 | ************************************************/ | |
| 2223 | DISCRETE_CONSTANT(SPACWALK_SPRINGBOARD_MISS_SND, 0) | |
| 2224 | ||
| 2225 | /************************************************ | |
| 2226 | * Space ship sound | |
| 2227 | ************************************************/ | |
| 2228 | DISCRETE_OP_AMP_OSCILLATOR(NODE_60, /* 2.2uF cap near IC JK-2 */ | |
| 2229 | 1, /* ENAB */ | |
| 2230 | &spacwalk_spaceship_osc) | |
| 2231 | DISCRETE_OP_AMP_VCO1(NODE_61, /* IC JK-2, pin 5 */ | |
| 2232 | SPACWALK_SPACE_SHIP_EN, /* ENAB */ | |
| 2233 | NODE_60, /* VMOD1*/ | |
| 2234 | &spacwalk_spaceship_vco) | |
| 2235 | DISCRETE_RCFILTER(NODE_62, | |
| 2236 | 1, /* ENAB */ | |
| 2237 | NODE_61, /* IN0 */ | |
| 2238 | RES_K(1), CAP_U(0.15)) | |
| 2239 | DISCRETE_RCFILTER(SPACWALK_SPACE_SHIP_SND, | |
| 2240 | 1, /* ENAB */ | |
| 2241 | NODE_62, /* IN0 */ | |
| 2242 | RES_K(1) + RES_K(10), CAP_U(0.015)) | |
| 2243 | ||
| 2244 | /************************************************ | |
| 2245 | * Combine all sound sources. | |
| 2246 | ************************************************/ | |
| 2247 | DISCRETE_MIXER6(NODE_90, | |
| 2248 | 1, /* ENAB */ | |
| 2249 | SPACWALK_SPRINGBOARD_HIT1_SND, | |
| 2250 | SPACWALK_SPRINGBOARD_HIT2_SND, | |
| 2251 | SPACWALK_SPACE_SHIP_SND, | |
| 2252 | SPACWALK_SPRINGBOARD_MISS_SND, | |
| 2253 | SPACWALK_TARGET_HIT_SND, | |
| 2254 | MIDWAY_TONE_SND, | |
| 2255 | &spacwalk_mixer) | |
| 2256 | DISCRETE_OUTPUT(NODE_90, 11000) | |
| 2257 | DISCRETE_SOUND_END | |
| 2258 | ||
| 2067 | 2259 | MACHINE_DRIVER_START( spacwalk_audio ) |
| 2068 | 2260 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 2261 | ||
| 2262 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) | |
| 2263 | MDRV_SOUND_CONFIG_DISCRETE(spacwalk) | |
| 2264 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 2069 | 2265 | MACHINE_DRIVER_END |
| 2070 | 2266 | |
| 2071 | WRITE8_HANDLER( spacwalk_audio_1_w ) | |
| 2267 | WRITE8_DEVICE_HANDLER( spacwalk_audio_1_w ) | |
| 2072 | 2268 | { |
| 2073 | 2269 | coin_counter_w(0, (data >> 0) & 0x01); |
| 2074 | 2270 | |
| 2075 | 2271 | clowns_set_controller_select((data >> 1) & 0x01); |
| 2076 | 2272 | |
| 2077 | // D2: ? | |
| 2078 | // D3: ? | |
| 2079 | // D4-7: unused? | |
| 2080 | // if (data&0xfc) printf("%02x ",data); | |
| 2273 | sound_global_enable(device->machine, (data >> 2) & 0x01); | |
| 2274 | ||
| 2275 | discrete_sound_w(device, SPACWALK_SPACE_SHIP_EN, (data >> 3) & 0x01); | |
| 2081 | 2276 | } |
| 2082 | 2277 | |
| 2278 | WRITE8_DEVICE_HANDLER( spacwalk_audio_2_w ) | |
| 2279 | { | |
| 2280 | discrete_sound_w(device, SPACWALK_TARGET_HIT_BOTTOM_EN, (data >> 0) & 0x01); | |
| 2083 | 2281 | |
| 2282 | discrete_sound_w(device, SPACWALK_TARGET_HIT_MIDDLE_EN, (data >> 1) & 0x01); | |
| 2084 | 2283 | |
| 2284 | discrete_sound_w(device, SPACWALK_TARGET_HIT_TOP_EN, (data >> 2) & 0x01); | |
| 2285 | ||
| 2286 | discrete_sound_w(device, SPACWALK_SPRINGBOARD_HIT1_EN, (data >> 3) & 0x01); | |
| 2287 | ||
| 2288 | discrete_sound_w(device, SPACWALK_SPRINGBOARD_HIT2_EN, (data >> 4) & 0x01); | |
| 2289 | ||
| 2290 | discrete_sound_w(device, SPACWALK_SPRINGBOARD_MISS_EN, (data >> 5) & 0x01); | |
| 2291 | } | |
| 2292 | ||
| 2293 | ||
| 2294 | ||
| 2085 | 2295 | /************************************* |
| 2086 | 2296 | * |
| 2087 | 2297 | * Shuffleboard |
| r5955 | r5956 | |
| 2131 | 2341 | * |
| 2132 | 2342 | *************************************/ |
| 2133 | 2343 | |
| 2134 | static const discrete_op_amp_tvca_info dogpatch_music_tvca_info = | |
| 2135 | { | |
| 2136 | RES_M(3.3), | |
| 2137 | RES_K(10) + RES_K(680), | |
| 2138 | 0, | |
| 2139 | RES_K(680), | |
| 2140 | RES_K(10), | |
| 2141 | 0, | |
| 2142 | RES_K(680), | |
| 2143 | 0, | |
| 2144 | 0, | |
| 2145 | 0, | |
| 2146 | 0, | |
| 2147 | CAP_U(.001), | |
| 2148 | 0, | |
| 2149 | 0, | |
| 2150 | 12, /* v1 */ | |
| 2151 | 0, /* v2 */ | |
| 2152 | 0, /* v3 */ | |
| 2153 | 12, /* vP */ | |
| 2154 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG0, | |
| 2155 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2156 | DISC_OP_AMP_TRIGGER_FUNCTION_TRG1, | |
| 2157 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2158 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE, | |
| 2159 | DISC_OP_AMP_TRIGGER_FUNCTION_NONE | |
| 2160 | }; | |
| 2161 | 2344 | |
| 2162 | ||
| 2163 | 2345 | static DISCRETE_SOUND_START(dogpatch) |
| 2164 | 2346 | |
| 2165 | 2347 | /************************************************ |
| 2166 | 2348 | * Tone generator |
| 2167 | 2349 | ************************************************/ |
| 2168 | MIDWAY_TONE_GENERATOR(d | |
| 2350 | MIDWAY_TONE_GENERATOR(midw | |
| 2169 | 2351 | |
| 2170 | 2352 | /************************************************ |
| 2171 | 2353 | * Filter it to be AC. |
| r5955 | r5956 | |
| 2572 | 2754 | NODE_31, /* IN0 */ |
| 2573 | 2755 | -0.5) /* IN1 */ |
| 2574 | 2756 | DISCRETE_CLAMP(NODE_33, |
| 2575 | 1, /* ENAB */ | |
| 2576 | 2757 | NODE_32, /* IN0 */ |
| 2577 | 2758 | 0, /* MIN */ |
| 2578 | 12, /* MAX */ | |
| 2579 | 0) /* CLAMP */ | |
| 2759 | 12) /* MAX */ | |
| 2580 | 2760 | DISCRETE_CRFILTER(NODE_34, |
| 2581 | 2761 | 1, /* ENAB */ |
| 2582 | 2762 | SPCENCTR_NOISE, /* IN0 */ |
| r5955 | r5956 | |
| 2640 | 2820 | NODE_63, /* IN0 */ |
| 2641 | 2821 | 6.8) /* IN1 */ |
| 2642 | 2822 | DISCRETE_CLAMP(SPCENCTR_CRASH_SND, /* IC C2, pin 5 */ |
| 2643 | 1, /* ENAB */ | |
| 2644 | 2823 | NODE_64, /* IN0 */ |
| 2645 | 2824 | 0, /* MIN */ |
| 2646 | 12.0 - OP_AMP_NORTON_VBE, /* MAX */ | |
| 2647 | 0) /* CLAMP */ | |
| 2825 | 12.0 - OP_AMP_NORTON_VBE) /* MAX */ | |
| 2648 | 2826 | |
| 2649 | 2827 | |
| 2650 | 2828 | /************************************************ |
| r5955 | r5956 | |
| 3599 | 3777 | INVADERS_NODE(71, _board), /* IN0 */ \ |
| 3600 | 3778 | -0.5) /* IN1 */ \ |
| 3601 | 3779 | DISCRETE_CLAMP(INVADERS_NODE(73, _board), \ |
| 3602 | 1, /* ENAB */ \ | |
| 3603 | 3780 | INVADERS_NODE(72, _board), /* IN0 */ \ |
| 3604 | 3781 | 0, /* MIN */ \ |
| 3605 | 12, /* MAX */ \ | |
| 3606 | 0) /* CLAMP */ \ | |
| 3782 | 12) /* MAX */ \ | |
| 3607 | 3783 | DISCRETE_CRFILTER(INVADERS_NODE(74, _board), \ |
| 3608 | 3784 | 1, /* ENAB */ \ |
| 3609 | 3785 | INVADERS_NOISE, /* IN0 */ \ |
| r5955 | r5956 | |
|---|---|---|
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | //Sprite Functions |
| 12 | void CX4_op00(running_machine* machine) | |
| 12 | static void CX4_op00(running_machine* machine) | |
| 13 | 13 | { |
| 14 | 14 | switch(cx4.reg[0x4d]) |
| 15 | 15 | { |
| r5955 | r5956 | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | //Draw Wireframe |
| 27 | void CX4_op01(running_machine* machine) | |
| 27 | static void CX4_op01(running_machine* machine) | |
| 28 | 28 | { |
| 29 | 29 | memset(cx4.ram + 0x300, 0, 2304); |
| 30 | 30 | CX4_C4DrawWireFrame(machine); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | //Propulsion |
| 34 | void CX4_op05(running_machine *machine) | |
| 34 | static void CX4_op05(running_machine *machine) | |
| 35 | 35 | { |
| 36 | 36 | INT32 temp = 0x10000; |
| 37 | 37 | if(CX4_readw(0x1f83)) |
| r5955 | r5956 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | //Set Vector length |
| 45 | void CX4_op0d(running_machine *machine) | |
| 45 | static void CX4_op0d(running_machine *machine) | |
| 46 | 46 | { |
| 47 | 47 | cx4.C41FXVal = CX4_readw(0x1f80); |
| 48 | 48 | cx4.C41FYVal = CX4_readw(0x1f83); |
| r5955 | r5956 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | //Triangle |
| 59 | void CX4_op10() | |
| 59 | static void CX4_op10(void) | |
| 60 | 60 | { |
| 61 | 61 | cx4.r0 = CX4_ldr(0); |
| 62 | 62 | cx4.r1 = CX4_ldr(1); |
| r5955 | r5956 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //Triangle |
| 87 | void CX4_op13() | |
| 87 | static void CX4_op13(void) | |
| 88 | 88 | { |
| 89 | 89 | cx4.r0 = CX4_ldr(0); |
| 90 | 90 | cx4.r1 = CX4_ldr(1); |
| r5955 | r5956 | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | //Pythagorean |
| 111 | void CX4_op15(running_machine *machine) | |
| 111 | static void CX4_op15(running_machine *machine) | |
| 112 | 112 | { |
| 113 | 113 | double temp = 0.0; |
| 114 | 114 | cx4.C41FXVal = CX4_readw(0x1f80); |
| r5955 | r5956 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | //Calculate distance |
| 122 | void CX4_op1f(running_machine *machine) | |
| 122 | static void CX4_op1f(running_machine *machine) | |
| 123 | 123 | { |
| 124 | 124 | cx4.C41FXVal = CX4_readw(0x1f80); |
| 125 | 125 | cx4.C41FYVal = CX4_readw(0x1f83); |
| r5955 | r5956 | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | //Trapezoid |
| 145 | void CX4_op22() | |
| 145 | static void CX4_op22(void) | |
| 146 | 146 | { |
| 147 | 147 | INT16 angle1 = CX4_readw(0x1f8c) & 0x1ff; |
| 148 | 148 | INT16 angle2 = CX4_readw(0x1f8f) & 0x1ff; |
| r5955 | r5956 | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | //Multiply |
| 201 | void CX4_op25() | |
| 201 | static void CX4_op25(void) | |
| 202 | 202 | { |
| 203 | 203 | cx4.r0 = CX4_ldr(0); |
| 204 | 204 | cx4.r1 = CX4_ldr(1); |
| r5955 | r5956 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | //Transform Coords |
| 211 | void CX4_op2d(running_machine *machine) | |
| 211 | static void CX4_op2d(running_machine *machine) | |
| 212 | 212 | { |
| 213 | 213 | cx4.C4WFXVal = CX4_readw(0x1f81); |
| 214 | 214 | cx4.C4WFYVal = CX4_readw(0x1f84); |
| r5955 | r5956 | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | //Sum |
| 226 | void CX4_op40() | |
| 226 | static void CX4_op40(void) | |
| 227 | 227 | { |
| 228 | 228 | UINT32 i; |
| 229 | 229 | cx4.r0 = 0; |
| r5955 | r5956 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | //Square |
| 238 | void CX4_op54() | |
| 238 | static void CX4_op54(void) | |
| 239 | 239 | { |
| 240 | 240 | cx4.r0 = CX4_ldr(0); |
| 241 | 241 | CX4_mul(cx4.r0, cx4.r0, &cx4.r1, &cx4.r2); |
| r5955 | r5956 | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | //Immediate Register |
| 247 | void CX4_op5c() | |
| 247 | static void CX4_op5c(void) | |
| 248 | 248 | { |
| 249 | 249 | CX4_str(0, 0x000000); |
| 250 | 250 | CX4_immediate_reg(0); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | //Immediate Register (Multiple) |
| 254 | void CX4_op5e() { CX4_immediate_reg( 0); } | |
| 255 | void CX4_op60() { CX4_immediate_reg( 3); } | |
| 256 | void CX4_op62() { CX4_immediate_reg( 6); } | |
| 257 | void CX4_op64() { CX4_immediate_reg( 9); } | |
| 258 | void CX4_op66() { CX4_immediate_reg(12); } | |
| 259 | void CX4_op68() { CX4_immediate_reg(15); } | |
| 260 | void CX4_op6a() { CX4_immediate_reg(18); } | |
| 261 | void CX4_op6c() { CX4_immediate_reg(21); } | |
| 262 | void CX4_op6e() { CX4_immediate_reg(24); } | |
| 263 | void CX4_op70() { CX4_immediate_reg(27); } | |
| 264 | void CX4_op72() { CX4_immediate_reg(30); } | |
| 265 | void CX4_op74() { CX4_immediate_reg(33); } | |
| 266 | void CX4_op76() { CX4_immediate_reg(36); } | |
| 267 | void CX4_op78() { CX4_immediate_reg(39); } | |
| 268 | void CX4_op7a() { CX4_immediate_reg(42); } | |
| 269 | void CX4_op7c() { CX4_immediate_reg(45); } | |
| 254 | static void CX4_op5e(void) { CX4_immediate_reg( 0); } | |
| 255 | static void CX4_op60(void) { CX4_immediate_reg( 3); } | |
| 256 | static void CX4_op62(void) { CX4_immediate_reg( 6); } | |
| 257 | static void CX4_op64(void) { CX4_immediate_reg( 9); } | |
| 258 | static void CX4_op66(void) { CX4_immediate_reg(12); } | |
| 259 | static void CX4_op68(void) { CX4_immediate_reg(15); } | |
| 260 | static void CX4_op6a(void) { CX4_immediate_reg(18); } | |
| 261 | static void CX4_op6c(void) { CX4_immediate_reg(21); } | |
| 262 | static void CX4_op6e(void) { CX4_immediate_reg(24); } | |
| 263 | static void CX4_op70(void) { CX4_immediate_reg(27); } | |
| 264 | static void CX4_op72(void) { CX4_immediate_reg(30); } | |
| 265 | static void CX4_op74(void) { CX4_immediate_reg(33); } | |
| 266 | static void CX4_op76(void) { CX4_immediate_reg(36); } | |
| 267 | static void CX4_op78(void) { CX4_immediate_reg(39); } | |
| 268 | static void CX4_op7a(void) { CX4_immediate_reg(42); } | |
| 269 | static void CX4_op7c(void) { CX4_immediate_reg(45); } | |
| 270 | 270 | |
| 271 | 271 | //Immediate ROM |
| 272 | void CX4_op89() | |
| 272 | static void CX4_op89(void) | |
| 273 | 273 | { |
| 274 | 274 | CX4_str(0, 0x054336); |
| 275 | 275 | CX4_str(1, 0xffffff); |
| r5955 | r5956 | |
|---|---|---|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | WRITE8_HANDLER(soundcpu_reset_w) | |
| 122 | WRITE8_HANDLER( bublbobl_soundcpu_reset_w ) | |
| 123 | 123 | { |
| 124 | 124 | cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, data ? ASSERT_LINE : CLEAR_LINE); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | READ8_HANDLER( sound_status_r ) | |
| 127 | READ8_HANDLER( bublbobl_sound_status_r ) | |
| 128 | 128 | { |
| 129 | 129 | return sound_status; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | WRITE8_HANDLER( sound_status_w ) | |
| 132 | WRITE8_HANDLER( bublbobl_sound_status_w ) | |
| 133 | 133 | { |
| 134 | 134 | sound_status = data; |
| 135 | 135 | } |
| r5955 | r5956 | |
|---|---|---|
| 17 | 17 | #define PI 3.1415926535897932384626433832795 |
| 18 | 18 | |
| 19 | 19 | //Wireframe Helpers |
| 20 | void CX4_C4TransfWireFrame(void) | |
| 20 | static void CX4_C4TransfWireFrame(void) | |
| 21 | 21 | { |
| 22 | 22 | cx4.c4x = (double)cx4.C4WFXVal; |
| 23 | 23 | cx4.c4y = (double)cx4.C4WFYVal; |
| r5955 | r5956 | |
| 43 | 43 | cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | void CX4_C4CalcWireFrame(void) | |
| 46 | static void CX4_C4CalcWireFrame(void) | |
| 47 | 47 | { |
| 48 | 48 | cx4.C4WFXVal = cx4.C4WFX2Val - cx4.C4WFXVal; |
| 49 | 49 | cx4.C4WFYVal = cx4.C4WFY2Val - cx4.C4WFYVal; |
| r5955 | r5956 | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | void CX4_C4TransfWireFrame2(void) | |
| 69 | static void CX4_C4TransfWireFrame2(void) | |
| 70 | 70 | { |
| 71 | 71 | cx4.c4x = (double)cx4.C4WFXVal; |
| 72 | 72 | cx4.c4y = (double)cx4.C4WFYVal; |
| r5955 | r5956 | |
| 92 | 92 | cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / 0x100); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | void CX4_C4DrawWireFrame(running_machine *machine) | |
| 95 | static void CX4_C4DrawWireFrame(running_machine *machine) | |
| 96 | 96 | { |
| 97 | 97 | UINT32 line = CX4_readl(0x1f80); |
| 98 | 98 | UINT32 point1, point2; |
| r5955 | r5956 | |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color) | |
| 147 | static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color) | |
| 148 | 148 | { |
| 149 | 149 | INT32 i; |
| 150 | 150 | |
| r5955 | r5956 | |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | void CX4_C4DoScaleRotate(int row_padding) | |
| 202 | static void CX4_C4DoScaleRotate(int row_padding) | |
| 203 | 203 | { |
| 204 | 204 | INT16 A, B, C, D; |
| 205 | 205 | INT32 x, y; |
| r5955 | r5956 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | ************************************************************************/ |
| 14 | 14 | |
| 15 | UINT16 DSP3_DataROM[1024]; | |
| 15 | static UINT16 DSP3_DataROM[1024]; | |
| 16 | 16 | |
| 17 | void (*SetDSP3)( void ); | |
| 18 | void DSP3_Command( void ); | |
| 17 | static void(*SetDSP3)(void); | |
| 18 | static void DSP3_Command(void); | |
| 19 | 19 | |
| 20 | UINT16 DSP3_DR; | |
| 21 | UINT16 DSP3_SR; | |
| 22 | UINT16 DSP3_MemoryIndex; | |
| 20 | static UINT16 DSP3_DR; | |
| 21 | static UINT16 DSP3_SR; | |
| 22 | static UINT16 DSP3_MemoryIndex; | |
| 23 | 23 | |
| 24 | void DSP3_Reset( | |
| 24 | static void DSP3_Reset( | |
| 25 | 25 | { |
| 26 | 26 | DSP3_DR = 0x0080; |
| 27 | 27 | DSP3_SR = 0x0084; |
| 28 | 28 | SetDSP3 = &DSP3_Command; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | void DSP3_MemorySize( void ) | |
| 31 | #ifdef UNUSED_FUNCTION | |
| 32 | void DSP3_MemorySize(void) | |
| 32 | 33 | { |
| 33 | 34 | DSP3_DR = 0x0300; |
| 34 | 35 | SetDSP3 = &DSP3_Reset; |
| 35 | 36 | } |
| 37 | #endif | |
| 36 | 38 | |
| 37 | void DSP3_TestMemory( | |
| 39 | static void DSP3_TestMemory( | |
| 38 | 40 | { |
| 39 | 41 | DSP3_DR = 0x0000; |
| 40 | 42 | SetDSP3 = &DSP3_Reset; |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | void DSP3_DumpDataROM( | |
| 45 | static void DSP3_DumpDataROM( | |
| 44 | 46 | { |
| 45 | 47 | DSP3_DR = DSP3_DataROM[DSP3_MemoryIndex++]; |
| 46 | 48 | if (DSP3_MemoryIndex == 1024) |
| 47 | 49 | SetDSP3 = &DSP3_Reset; |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | void DSP3_MemoryDump( | |
| 52 | static void DSP3_MemoryDump( | |
| 51 | 53 | { |
| 52 | 54 | DSP3_MemoryIndex = 0; |
| 53 | 55 | SetDSP3 = &DSP3_DumpDataROM; |
| 54 | 56 | DSP3_DumpDataROM(); |
| 55 | 57 | } |
| 56 | 58 | |
| 57 | INT16 DSP3_WinLo; | |
| 58 | INT16 DSP3_WinHi; | |
| 59 | static INT16 DSP3_WinLo; | |
| 60 | static INT16 DSP3_WinHi; | |
| 59 | 61 | |
| 60 | void DSP3_OP06( | |
| 62 | static void DSP3_OP06( | |
| 61 | 63 | { |
| 62 | 64 | DSP3_WinLo = (UINT8)(DSP3_DR); |
| 63 | 65 | DSP3_WinHi = (UINT8)(DSP3_DR >> 8); |
| 64 | 66 | DSP3_Reset(); |
| 65 | 67 | } |
| 66 | 68 | |
| 67 | void DSP3_OP03( | |
| 69 | static void DSP3_OP03( | |
| 68 | 70 | { |
| 69 | 71 | INT16 Lo = (UINT8)(DSP3_DR); |
| 70 | 72 | INT16 Hi = (UINT8)(DSP3_DR >> 8); |
| r5955 | r5956 | |
| 73 | 75 | SetDSP3 = &DSP3_Reset; |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | INT16 DSP3_AddLo; | |
| 77 | INT16 DSP3_AddHi; | |
| 78 | static INT16 DSP3_AddLo; | |
| 79 | static INT16 DSP3_AddHi; | |
| 78 | 80 | |
| 79 | void DSP3_OP07_B( | |
| 81 | static void DSP3_OP07_B( | |
| 80 | 82 | { |
| 81 | 83 | INT16 Ofs = (DSP3_WinLo * DSP3_AddHi << 1) + (DSP3_AddLo << 1); |
| 82 | 84 | DSP3_DR = Ofs >> 1; |
| 83 | 85 | SetDSP3 = &DSP3_Reset; |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | void DSP3_OP07_A( | |
| 88 | static void DSP3_OP07_A( | |
| 87 | 89 | { |
| 88 | 90 | INT16 Lo = (UINT8)(DSP3_DR); |
| 89 | 91 | INT16 Hi = (UINT8)(DSP3_DR >> 8); |
| r5955 | r5956 | |
| 109 | 111 | SetDSP3 = &DSP3_OP07_B; |
| 110 | 112 | } |
| 111 | 113 | |
| 112 | void DSP3_OP07( | |
| 114 | static void DSP3_OP07( | |
| 113 | 115 | { |
| 114 | 116 | UINT32 dataOfs = ((DSP3_DR << 1) + 0x03b2) & 0x03ff; |
| 115 | 117 | |
| r5955 | r5956 | |
| 120 | 122 | DSP3_SR = 0x0080; |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | UINT16 DSP3_Codewords; | |
| 124 | UINT16 DSP3_Outwords; | |
| 125 | UINT16 DSP3_Symbol; | |
| 126 | UINT16 DSP3_BitCount; | |
| 127 | UINT16 DSP3_Index; | |
| 128 | UINT16 DSP3_Codes[512]; | |
| 129 | UINT16 DSP3_BitsLeft; | |
| 130 | UINT16 DSP3_ReqBits; | |
| 131 | UINT16 DSP3_ReqData; | |
| 132 | UINT16 DSP3_BitCommand; | |
| 133 | UINT8 DSP3_BaseLength; | |
| 134 | UINT16 DSP3_BaseCodes; | |
| 135 | UINT16 DSP3_BaseCode; | |
| 136 | UINT8 DSP3_CodeLengths[8]; | |
| 137 | UINT16 DSP3_CodeOffsets[8]; | |
| 138 | UINT16 DSP3_LZCode; | |
| 139 | UINT8 DSP3_LZLength; | |
| 125 | static UINT16 DSP3_Codewords; | |
| 126 | static UINT16 DSP3_Outwords; | |
| 127 | static UINT16 DSP3_Symbol; | |
| 128 | static UINT16 DSP3_BitCount; | |
| 129 | static UINT16 DSP3_Index; | |
| 130 | static UINT16 DSP3_Codes[512]; | |
| 131 | static UINT16 DSP3_BitsLeft; | |
| 132 | static UINT16 DSP3_ReqBits; | |
| 133 | static UINT16 DSP3_ReqData; | |
| 134 | static UINT16 DSP3_BitCommand; | |
| 135 | static UINT8 DSP3_BaseLength; | |
| 136 | static UINT16 DSP3_BaseCodes; | |
| 137 | static UINT16 DSP3_BaseCode; | |
| 138 | static UINT8 DSP3_CodeLengths[8]; | |
| 139 | static UINT16 DSP3_CodeOffsets[8]; | |
| 140 | static UINT16 DSP3_LZCode; | |
| 141 | static UINT8 DSP3_LZLength; | |
| 140 | 142 | |
| 141 | UINT16 DSP3_X; | |
| 142 | UINT16 DSP3_Y; | |
| 143 | static UINT16 DSP3_X; | |
| 144 | static UINT16 DSP3_Y; | |
| 143 | 145 | |
| 144 | void DSP3_Coordinate( | |
| 146 | static void DSP3_Coordinate( | |
| 145 | 147 | { |
| 146 | 148 | DSP3_Index++; |
| 147 | 149 | |
| r5955 | r5956 | |
| 178 | 180 | } |
| 179 | 181 | } |
| 180 | 182 | |
| 181 | UINT8 DSP3_Bitmap[8]; | |
| 182 | UINT8 DSP3_Bitplane[8]; | |
| 183 | UINT16 DSP3_BMIndex; | |
| 184 | UINT16 DSP3_BPIndex; | |
| 185 | UINT16 DSP3_Count; | |
| 183 | static UINT8 DSP3_Bitmap[8]; | |
| 184 | static UINT8 DSP3_Bitplane[8]; | |
| 185 | static UINT16 DSP3_BMIndex; | |
| 186 | static UINT16 DSP3_BPIndex; | |
| 187 | static UINT16 DSP3_Count; | |
| 186 | 188 | |
| 187 | void DSP3_Convert_A( | |
| 189 | static void DSP3_Convert_A( | |
| 188 | 190 | { |
| 189 | 191 | if (DSP3_BMIndex < 8) |
| 190 | 192 | { |
| r5955 | r5956 | |
| 221 | 223 | } |
| 222 | 224 | } |
| 223 | 225 | |
| 224 | void DSP3_Convert( | |
| 226 | static void DSP3_Convert( | |
| 225 | 227 | { |
| 226 | 228 | DSP3_Count = DSP3_DR; |
| 227 | 229 | DSP3_BMIndex = 0; |
| 228 | 230 | SetDSP3 = &DSP3_Convert_A; |
| 229 | 231 | } |
| 230 | 232 | |
| 231 | UINT8 DSP3_GetBits(UINT8 Count) | |
| 233 | static UINT8 DSP3_GetBits(UINT8 Count) | |
| 232 | 234 | { |
| 233 | 235 | if (!DSP3_BitsLeft) |
| 234 | 236 | { |
| r5955 | r5956 | |
| 255 | 257 | return 1; |
| 256 | 258 | } |
| 257 | 259 | |
| 258 | void DSP3_Decode_Data( | |
| 260 | static void DSP3_Decode_Data( | |
| 259 | 261 | { |
| 260 | 262 | if (!DSP3_BitCount) |
| 261 | 263 | { |
| r5955 | r5956 | |
| 328 | 330 | DSP3_DR = DSP3_Symbol; |
| 329 | 331 | } |
| 330 | 332 | |
| 331 | void DSP3_Decode_Tree( | |
| 333 | static void DSP3_Decode_Tree( | |
| 332 | 334 | { |
| 333 | 335 | if (!DSP3_BitCount) |
| 334 | 336 | { |
| r5955 | r5956 | |
| 373 | 375 | if (DSP3_BitCount) DSP3_Decode_Data(); |
| 374 | 376 | } |
| 375 | 377 | |
| 376 | void DSP3_Decode_Symbols( | |
| 378 | static void DSP3_Decode_Symbols( | |
| 377 | 379 | { |
| 378 | 380 | DSP3_ReqData = DSP3_DR; |
| 379 | 381 | DSP3_BitCount += 16; |
| r5955 | r5956 | |
| 428 | 430 | if (DSP3_BitCount) DSP3_Decode_Tree(); |
| 429 | 431 | } |
| 430 | 432 | |
| 431 | void DSP3_Decode_A( | |
| 433 | static void DSP3_Decode_A( | |
| 432 | 434 | { |
| 433 | 435 | DSP3_Outwords = DSP3_DR; |
| 434 | 436 | SetDSP3 = &DSP3_Decode_Symbols; |
| r5955 | r5956 | |
| 440 | 442 | DSP3_SR = 0xC0; |
| 441 | 443 | } |
| 442 | 444 | |
| 443 | void DSP3_Decode( | |
| 445 | static void DSP3_Decode( | |
| 444 | 446 | { |
| 445 | 447 | DSP3_Codewords = DSP3_DR; |
| 446 | 448 | SetDSP3 = &DSP3_Decode_A; |
| r5955 | r5956 | |
| 450 | 452 | // Opcodes 1E/3E bit-perfect to 'dsp3-intro' log |
| 451 | 453 | // src: adapted from SD Gundam X/G-Next |
| 452 | 454 | |
| 453 | INT16 op3e_x; | |
| 454 | INT16 op3e_y; | |
| 455 | static INT16 op3e_x; | |
| 456 | static INT16 op3e_y; | |
| 455 | 457 | |
| 456 | INT16 op1e_terrain[0x2000]; | |
| 457 | INT16 op1e_cost[0x2000]; | |
| 458 | INT16 op1e_weight[0x2000]; | |
| 458 | static INT16 op1e_terrain[0x2000]; | |
| 459 | static INT16 op1e_cost[0x2000]; | |
| 460 | static INT16 op1e_weight[0x2000]; | |
| 459 | 461 | |
| 460 | INT16 op1e_cell; | |
| 461 | INT16 op1e_turn; | |
| 462 | INT16 op1e_search; | |
| 462 | static INT16 op1e_cell; | |
| 463 | static INT16 op1e_turn; | |
| 464 | static INT16 op1e_search; | |
| 463 | 465 | |
| 464 | INT16 op1e_x; | |
| 465 | INT16 op1e_y; | |
| 466 | static INT16 op1e_x; | |
| 467 | static INT16 op1e_y; | |
| 466 | 468 | |
| 467 | INT16 op1e_min_radius; | |
| 468 | INT16 op1e_max_radius; | |
| 469 | static INT16 op1e_min_radius; | |
| 470 | static INT16 op1e_max_radius; | |
| 469 | 471 | |
| 470 | INT16 op1e_max_search_radius; | |
| 471 | INT16 op1e_max_path_radius; | |
| 472 | static INT16 op1e_max_search_radius; | |
| 473 | static INT16 op1e_max_path_radius; | |
| 472 | 474 | |
| 473 | INT16 op1e_lcv_radius; | |
| 474 | INT16 op1e_lcv_steps; | |
| 475 | INT16 op1e_lcv_turns; | |
| 475 | static INT16 op1e_lcv_radius; | |
| 476 | static INT16 op1e_lcv_steps; | |
| 477 | static INT16 op1e_lcv_turns; | |
| 476 | 478 | |
| 477 | void DSP3_OP3E( | |
| 479 | static void DSP3_OP3E( | |
| 478 | 480 | { |
| 479 | 481 | op3e_x = (UINT8)(DSP3_DR & 0x00ff); |
| 480 | 482 | op3e_y = (UINT8)((DSP3_DR & 0xff00)>>8); |
| r5955 | r5956 | |
| 489 | 491 | op1e_max_path_radius = 0; |
| 490 | 492 | } |
| 491 | 493 | |
| 492 | void DSP3_OP1E_A( void ); | |
| 493 | void DSP3_OP1E_A1( void ); | |
| 494 | void DSP3_OP1E_A2( void ); | |
| 495 | void DSP3_OP1E_A3( void ); | |
| 494 | static void DSP3_OP1E_A(void); | |
| 495 | static void DSP3_OP1E_A1(void); | |
| 496 | static void DSP3_OP1E_A2(void); | |
| 497 | static void DSP3_OP1E_A3(void); | |
| 496 | 498 | |
| 497 | void DSP3_OP1E_B( void ); | |
| 498 | void DSP3_OP1E_B1( void ); | |
| 499 | void DSP3_OP1E_B2( void ); | |
| 499 | static void DSP3_OP1E_B(void); | |
| 500 | static void DSP3_OP1E_B1(void); | |
| 501 | static void DSP3_OP1E_B2(void); | |
| 500 | 502 | |
| 501 | void DSP3_OP1E_C( void ); | |
| 502 | void DSP3_OP1E_C1( void ); | |
| 503 | void DSP3_OP1E_C2( void ); | |
| 503 | static void DSP3_OP1E_C(void); | |
| 504 | static void DSP3_OP1E_C1(void); | |
| 505 | static void DSP3_OP1E_C2(void); | |
| 504 | 506 | |
| 505 | void DSP3_OP1E_D( INT16, INT16 *, INT16 * ); | |
| 506 | void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi ); | |
| 507 | static void DSP3_OP1E_D( INT16, INT16 *, INT16 * ); | |
| 508 | static void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi ); | |
| 507 | 509 | |
| 508 | void DSP3_OP1E( | |
| 510 | static void DSP3_OP1E( | |
| 509 | 511 | { |
| 510 | 512 | int lcv; |
| 511 | 513 | |
| r5955 | r5956 | |
| 536 | 538 | DSP3_OP1E_A(); |
| 537 | 539 | } |
| 538 | 540 | |
| 539 | void DSP3_OP1E_A( | |
| 541 | static void DSP3_OP1E_A( | |
| 540 | 542 | { |
| 541 | 543 | int lcv; |
| 542 | 544 | |
| r5955 | r5956 | |
| 582 | 584 | SetDSP3 = &DSP3_OP1E_A1; |
| 583 | 585 | } |
| 584 | 586 | |
| 585 | void DSP3_OP1E_A1( | |
| 587 | static void DSP3_OP1E_A1( | |
| 586 | 588 | { |
| 587 | 589 | DSP3_SR = 0x0084; |
| 588 | 590 | SetDSP3 = &DSP3_OP1E_A2; |
| 589 | 591 | } |
| 590 | 592 | |
| 591 | void DSP3_OP1E_A2( | |
| 593 | static void DSP3_OP1E_A2( | |
| 592 | 594 | { |
| 593 | 595 | op1e_terrain[ op1e_cell ] = (UINT8)(DSP3_DR & 0x00ff); |
| 594 | 596 | |
| r5955 | r5956 | |
| 596 | 598 | SetDSP3 = &DSP3_OP1E_A3; |
| 597 | 599 | } |
| 598 | 600 | |
| 599 | void DSP3_OP1E_A3( | |
| 601 | static void DSP3_OP1E_A3( | |
| 600 | 602 | { |
| 601 | 603 | op1e_cost[ op1e_cell ] = (UINT8)(DSP3_DR & 0x00ff); |
| 602 | 604 | |
| r5955 | r5956 | |
| 619 | 621 | } |
| 620 | 622 | |
| 621 | 623 | |
| 622 | void DSP3_OP1E_B( | |
| 624 | static void DSP3_OP1E_B( | |
| 623 | 625 | { |
| 624 | 626 | op1e_x = op3e_x; |
| 625 | 627 | op1e_y = op3e_y; |
| r5955 | r5956 | |
| 633 | 635 | } |
| 634 | 636 | |
| 635 | 637 | |
| 636 | void DSP3_OP1E_B1( | |
| 638 | static void DSP3_OP1E_B1( | |
| 637 | 639 | { |
| 638 | 640 | while( op1e_lcv_radius < op1e_max_radius ) { |
| 639 | 641 | op1e_y--; |
| r5955 | r5956 | |
| 673 | 675 | } |
| 674 | 676 | |
| 675 | 677 | |
| 676 | void DSP3_OP1E_B2( | |
| 678 | static void DSP3_OP1E_B2( | |
| 677 | 679 | { |
| 678 | 680 | INT16 cell; |
| 679 | 681 | INT16 path; |
| r5955 | r5956 | |
| 713 | 715 | } |
| 714 | 716 | |
| 715 | 717 | |
| 716 | void DSP3_OP1E_C( | |
| 718 | static void DSP3_OP1E_C( | |
| 717 | 719 | { |
| 718 | 720 | int lcv; |
| 719 | 721 | |
| r5955 | r5956 | |
| 745 | 747 | } |
| 746 | 748 | |
| 747 | 749 | |
| 748 | void DSP3_OP1E_C1( | |
| 750 | static void DSP3_OP1E_C1( | |
| 749 | 751 | { |
| 750 | 752 | int lcv; |
| 751 | 753 | |
| r5955 | r5956 | |
| 792 | 794 | } |
| 793 | 795 | |
| 794 | 796 | |
| 795 | void DSP3_OP1E_C2( | |
| 797 | static void DSP3_OP1E_C2( | |
| 796 | 798 | { |
| 797 | 799 | DSP3_DR = op1e_weight[ op1e_cell ]; |
| 798 | 800 | |
| r5955 | r5956 | |
| 804 | 806 | } |
| 805 | 807 | |
| 806 | 808 | |
| 807 | void DSP3_OP1E_D( INT16 move, INT16 *lo, INT16 *hi ) | |
| 809 | static void DSP3_OP1E_D( INT16 move, INT16 *lo, INT16 *hi ) | |
| 808 | 810 | { |
| 809 | 811 | UINT32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff; |
| 810 | 812 | INT16 Lo; |
| r5955 | r5956 | |
| 838 | 840 | } |
| 839 | 841 | |
| 840 | 842 | |
| 841 | void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi ) | |
| 843 | static void DSP3_OP1E_D1( INT16 move, INT16 *lo, INT16 *hi ) | |
| 842 | 844 | { |
| 843 | 845 | //UINT32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff; |
| 844 | 846 | INT16 Lo; |
| r5955 | r5956 | |
| 871 | 873 | } |
| 872 | 874 | |
| 873 | 875 | |
| 874 | void DSP3_OP10( | |
| 876 | static void DSP3_OP10( | |
| 875 | 877 | { |
| 876 | 878 | if( DSP3_DR == 0xffff ) { |
| 877 | 879 | DSP3_Reset(); |
| r5955 | r5956 | |
| 881 | 883 | } |
| 882 | 884 | } |
| 883 | 885 | |
| 884 | ||
| 885 | void DSP3_OP0C_A( void ) | |
| 886 | #ifdef UNUSED_FUNCTION | |
| 887 | static void DSP3_OP0C_A(void) | |
| 886 | 888 | { |
| 887 | 889 | // absorb 2 bytes |
| 888 | 890 | |
| 889 | 891 | DSP3_DR = 0; |
| 890 | 892 | SetDSP3 = &DSP3_Reset; |
| 891 | 893 | } |
| 894 | #endif | |
| 892 | 895 | |
| 893 | ||
| 894 | void DSP3_OP0C( void ) | |
| 896 | static void DSP3_OP0C(void) | |
| 895 | 897 | { |
| 896 | 898 | // absorb 2 bytes |
| 897 | 899 | |
| r5955 | r5956 | |
| 901 | 903 | } |
| 902 | 904 | |
| 903 | 905 | |
| 904 | void DSP3_OP1C_C( | |
| 906 | static void DSP3_OP1C_C( | |
| 905 | 907 | { |
| 906 | 908 | // return 2 bytes |
| 907 | 909 | DSP3_DR = 0; |
| r5955 | r5956 | |
| 909 | 911 | } |
| 910 | 912 | |
| 911 | 913 | |
| 912 | void DSP3_OP1C_B( | |
| 914 | static void DSP3_OP1C_B( | |
| 913 | 915 | { |
| 914 | 916 | // absorb 2 bytes |
| 915 | 917 | |
| r5955 | r5956 | |
| 919 | 921 | } |
| 920 | 922 | |
| 921 | 923 | |
| 922 | void DSP3_OP1C_A( | |
| 924 | static void DSP3_OP1C_A( | |
| 923 | 925 | { |
| 924 | 926 | // absorb 2 bytes |
| 925 | 927 | |
| r5955 | r5956 | |
| 927 | 929 | } |
| 928 | 930 | |
| 929 | 931 | |
| 930 | void DSP3_OP1C( | |
| 932 | static void DSP3_OP1C( | |
| 931 | 933 | { |
| 932 | 934 | // absorb 2 bytes |
| 933 | 935 | |
| r5955 | r5956 | |
| 935 | 937 | } |
| 936 | 938 | |
| 937 | 939 | |
| 938 | void DSP3_Command( | |
| 940 | static void DSP3_Command( | |
| 939 | 941 | { |
| 940 | 942 | if (DSP3_DR < 0x40) |
| 941 | 943 | { |
| r5955 | r5956 | |
| 963 | 965 | } |
| 964 | 966 | |
| 965 | 967 | |
| 966 | void DSP3_write( UINT16 dsp3_address, UINT8 dsp3_byte ) | |
| 968 | static void DSP3_write( UINT16 dsp3_address, UINT8 dsp3_byte ) | |
| 967 | 969 | { |
| 968 | 970 | if (dsp3_address < 0xC000) |
| 969 | 971 | { |
| r5955 | r5956 | |
| 987 | 989 | } |
| 988 | 990 | } |
| 989 | 991 | |
| 990 | UINT8 DSP3_read( UINT16 dsp3_address ) | |
| 992 | static UINT8 DSP3_read( UINT16 dsp3_address ) | |
| 991 | 993 | { |
| 992 | 994 | UINT8 value; |
| 993 | 995 | if (dsp3_address < 0xC000) |
| r5955 | r5956 | |
| 1019 | 1021 | return value; |
| 1020 | 1022 | } |
| 1021 | 1023 | |
| 1022 | void InitDSP3( running_machine *machine ) | |
| 1024 | static void InitDSP3( running_machine *machine ) | |
| 1023 | 1025 | { |
| 1024 | 1026 | UINT32 i; |
| 1025 | 1027 | UINT8 *dspin = memory_region(machine, "addons"); |
| r5955 | r5956 | |
|---|---|---|
| 7 | 7 | just made a copy & renamed them for now to avoid any conflicts |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | #ifdef UNUSED_FUNCTION | |
| 10 | 11 | UINT16 *system24temp_sys16_shared_ram; |
| 11 | 12 | READ16_HANDLER( system24temp_sys16_shared_ram_r ) |
| 12 | 13 | { |
| r5955 | r5956 | |
| 17 | 18 | { |
| 18 | 19 | COMBINE_DATA(system24temp_sys16_shared_ram + offset); |
| 19 | 20 | } |
| 21 | #endif | |
| 20 | 22 | |
| 21 | 23 | /* The 315-5296 |
| 22 | 24 | 8 8bits I/O ports, 3 output-only pins, some protection, and |
| r5955 | r5956 | |
|---|---|---|
| 206 | 206 | { |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | DRIVER_INIT( scobra ) | |
| 209 | static DRIVER_INIT( scobra ) | |
| 210 | 210 | { |
| 211 | 211 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa803, 0xa803, 0, 0, scrambold_background_enable_w); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | #ifdef UNUSED_FUNCTION | |
| 214 | 215 | DRIVER_INIT( atlantis ) |
| 215 | 216 | { |
| 216 | 217 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, scrambold_background_enable_w); |
| r5955 | r5956 | |
| 220 | 221 | { |
| 221 | 222 | DRIVER_INIT_CALL(atlantis); |
| 222 | 223 | } |
| 224 | #endif | |
| 223 | 225 | |
| 224 | 226 | DRIVER_INIT( stratgyx ) |
| 225 | 227 | { |
| r5955 | r5956 | |
| 250 | 252 | /*memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, (write8_space_func)SMH_NOP);*/ |
| 251 | 253 | } |
| 252 | 254 | |
| 255 | #ifdef UNUSED_FUNCTION | |
| 253 | 256 | DRIVER_INIT( frogger ) |
| 254 | 257 | { |
| 255 | 258 | offs_t A; |
| r5955 | r5956 | |
| 276 | 279 | for (A = 0;A < 0x0800;A++) |
| 277 | 280 | ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1); |
| 278 | 281 | } |
| 282 | #endif | |
| 279 | 283 | |
| 280 | 284 | DRIVER_INIT( devilfsh ) |
| 281 | 285 | { |
| r5955 | r5956 | |
| 396 | 400 | } |
| 397 | 401 | |
| 398 | 402 | |
| 403 | #ifdef UNUSED_FUNCTION | |
| 399 | 404 | DRIVER_INIT( anteater ) |
| 400 | 405 | { |
| 401 | 406 | offs_t i, len; |
| r5955 | r5956 | |
| 432 | 437 | |
| 433 | 438 | free(scratch); |
| 434 | 439 | } |
| 440 | #endif | |
| 435 | 441 | |
| 436 | 442 | DRIVER_INIT( rescue ) |
| 437 | 443 | { |
| r5955 | r5956 | |
| 507 | 513 | free(scratch); |
| 508 | 514 | } |
| 509 | 515 | |
| 516 | #ifdef UNUSED_FUNCTION | |
| 510 | 517 | DRIVER_INIT( losttomb ) |
| 511 | 518 | { |
| 512 | 519 | offs_t i, len; |
| r5955 | r5956 | |
| 543 | 550 | |
| 544 | 551 | free(scratch); |
| 545 | 552 | } |
| 553 | #endif | |
| 546 | 554 | |
| 547 | ||
| 548 | 555 | DRIVER_INIT( hustler ) |
| 549 | 556 | { |
| 550 | 557 | offs_t A; |
| r5955 | r5956 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| 13 | #include "driver.h" | |
| 13 | 14 | #include "snescx4.h" |
| 15 | ||
| 16 | static CX4 cx4; | |
| 17 | ||
| 18 | static UINT8 CX4_read(UINT32 addr); | |
| 19 | static UINT16 CX4_readw(UINT16 addr); | |
| 20 | static UINT32 CX4_readl(UINT16 addr); | |
| 21 | ||
| 22 | static void CX4_write(running_machine *machine, UINT32 addr, UINT8 data); | |
| 23 | static void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data); | |
| 24 | //static void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data); | |
| 25 | ||
| 26 | static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color); | |
| 27 | ||
| 14 | 28 | #include "cx4data.c" |
| 15 | 29 | #include "cx4fn.c" |
| 16 | #include "cx4oam.c" | |
| 17 | #include "cx4ops.c" | |
| 18 | 30 | |
| 19 | UINT32 CX4_ldr(UINT8 r) | |
| 31 | static UINT32 CX4_ldr(UINT8 r) | |
| 20 | 32 | { |
| 21 | 33 | UINT16 addr = 0x0080 + (r * 3); |
| 22 | 34 | return (cx4.reg[addr + 0] << 0) |
| r5955 | r5956 | |
| 24 | 36 | | (cx4.reg[addr + 2] << 16); |
| 25 | 37 | } |
| 26 | 38 | |
| 27 | void CX4_str(UINT8 r, UINT32 data) | |
| 39 | static void CX4_str(UINT8 r, UINT32 data) | |
| 28 | 40 | { |
| 29 | 41 | UINT16 addr = 0x0080 + (r * 3); |
| 30 | 42 | cx4.reg[addr + 0] = (data >> 0); |
| r5955 | r5956 | |
| 32 | 44 | cx4.reg[addr + 2] = (data >> 16); |
| 33 | 45 | } |
| 34 | 46 | |
| 35 | void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh) | |
| 47 | static void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh) | |
| 36 | 48 | { |
| 37 | 49 | INT64 rx = x & 0xffffff; |
| 38 | 50 | INT64 ry = y & 0xffffff; |
| r5955 | r5956 | |
| 45 | 57 | *rh = (rx >> 24) & 0xffffff; |
| 46 | 58 | } |
| 47 | 59 | |
| 48 | UINT32 CX4_sin(UINT32 rx) | |
| 60 | static UINT32 CX4_sin(UINT32 rx) | |
| 49 | 61 | { |
| 50 | 62 | cx4.r0 = rx & 0x1ff; |
| 51 | 63 | if(cx4.r0 & 0x100) |
| r5955 | r5956 | |
| 66 | 78 | } |
| 67 | 79 | } |
| 68 | 80 | |
| 69 | UINT32 CX4_cos(UINT32 rx) | |
| 81 | static UINT32 CX4_cos(UINT32 rx) | |
| 70 | 82 | { |
| 71 | 83 | return CX4_sin(rx + 0x080); |
| 72 | 84 | } |
| 73 | 85 | |
| 74 | void CX4_immediate_reg(UINT32 start) | |
| 86 | static void CX4_immediate_reg(UINT32 start) | |
| 75 | 87 | { |
| 76 | 88 | UINT32 i = 0; |
| 77 | 89 | cx4.r0 = CX4_ldr(0); |
| r5955 | r5956 | |
| 86 | 98 | CX4_str(0, cx4.r0); |
| 87 | 99 | } |
| 88 | 100 | |
| 89 | void CX4_transfer_data(running_machine *machine) | |
| 101 | static void CX4_transfer_data(running_machine *machine) | |
| 90 | 102 | { |
| 91 | 103 | UINT32 src; |
| 92 | 104 | UINT16 dest, count; |
| r5955 | r5956 | |
| 102 | 114 | } |
| 103 | 115 | } |
| 104 | 116 | |
| 105 | void CX4_write(running_machine *machine, UINT32 addr, UINT8 data) | |
| 117 | #include "cx4oam.c" | |
| 118 | #include "cx4ops.c" | |
| 119 | ||
| 120 | static void CX4_write(running_machine *machine, UINT32 addr, UINT8 data) | |
| 106 | 121 | { |
| 107 | 122 | addr &= 0x1fff; |
| 108 | 123 | |
| r5955 | r5956 | |
| 176 | 191 | } |
| 177 | 192 | } |
| 178 | 193 | |
| 194 | #ifdef UNUSED_FUNCTION | |
| 179 | 195 | void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data) |
| 180 | 196 | { |
| 181 | 197 | CX4_write(machine, addr, data); |
| 182 | 198 | } |
| 199 | #endif | |
| 183 | 200 | |
| 184 | void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data) | |
| 201 | static void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data) | |
| 185 | 202 | { |
| 186 | 203 | CX4_write(machine, addr + 0, data >> 0); |
| 187 | 204 | CX4_write(machine, addr + 1, data >> 8); |
| 188 | 205 | } |
| 189 | 206 | |
| 207 | #ifdef UNUSED_FUNCTION | |
| 190 | 208 | void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data) |
| 191 | 209 | { |
| 192 | 210 | CX4_write(machine, addr + 0, data >> 0); |
| 193 | 211 | CX4_write(machine, addr + 1, data >> 8); |
| 194 | 212 | CX4_write(machine, addr + 2, data >> 16); |
| 195 | 213 | } |
| 214 | #endif | |
| 196 | 215 | |
| 197 | UINT8 CX4_read(UINT32 addr) | |
| 216 | static UINT8 CX4_read(UINT32 addr) | |
| 198 | 217 | { |
| 199 | 218 | addr &= 0x1fff; |
| 200 | 219 | |
| r5955 | r5956 | |
| 211 | 230 | return 0xff; |
| 212 | 231 | } |
| 213 | 232 | |
| 233 | #ifdef UNUSED_FUNCTION | |
| 214 | 234 | UINT8 CX4_readb(UINT16 addr) |
| 215 | 235 | { |
| 216 | 236 | return CX4_read(addr); |
| 217 | 237 | } |
| 238 | #endif | |
| 218 | 239 | |
| 219 | UINT16 CX4_readw(UINT16 addr) | |
| 240 | static UINT16 CX4_readw(UINT16 addr) | |
| 220 | 241 | { |
| 221 | 242 | return CX4_read(addr) | (CX4_read(addr + 1) << 8); |
| 222 | 243 | } |
| 223 | 244 | |
| 224 | UINT32 CX4_readl(UINT16 addr) | |
| 245 | static UINT32 CX4_readl(UINT16 addr) | |
| 225 | 246 | { |
| 226 | 247 | return CX4_read(addr) | (CX4_read(addr + 1) << 8) | (CX4_read(addr + 2) << 16); |
| 227 | 248 | } |
| 228 | 249 | |
| 250 | #ifdef UNUSED_FUNCTION | |
| 229 | 251 | void CX4_reset() |
| 230 | 252 | { |
| 231 | 253 | memset(cx4.ram, 0, 0x0c00); |
| 232 | 254 | memset(cx4.reg, 0, 0x0100); |
| 233 | 255 | } |
| 256 | #endif | |
| 257 |
| r5955 | r5956 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | #include "driver.h" | |
| 12 | ||
| 13 | 11 | typedef struct |
| 14 | 12 | { |
| 15 | 13 | UINT8 ram[0x0c00]; |
| r5955 | r5956 | |
| 24 | 22 | double c4x, c4y, c4z; |
| 25 | 23 | double c4x2, c4y2, c4z2; |
| 26 | 24 | } CX4; |
| 27 | ||
| 28 | static CX4 cx4; | |
| 29 | ||
| 30 | UINT32 CX4_ldr(UINT8 r); | |
| 31 | void CX4_str(UINT8 r, UINT32 data); | |
| 32 | void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh); | |
| 33 | UINT32 CX4_sin(UINT32 rx); | |
| 34 | UINT32 CX4_cos(UINT32 rx); | |
| 35 | ||
| 36 | void CX4_transfer_data(running_machine *machine); | |
| 37 | void CX4_immediate_reg(UINT32 num); | |
| 38 | ||
| 39 | void CX4_op00_00(running_machine *machine); | |
| 40 | void CX4_op00_03(void); | |
| 41 | void CX4_op00_05(running_machine *machine); | |
| 42 | void CX4_op00_07(void); | |
| 43 | void CX4_op00_08(running_machine *machine); | |
| 44 | void CX4_op00_0b(running_machine *machine); | |
| 45 | void CX4_op00_0c(running_machine *machine); | |
| 46 | ||
| 47 | void CX4_op00(running_machine* machine); | |
| 48 | void CX4_op01(running_machine* machine); | |
| 49 | void CX4_op05(running_machine *machine); | |
| 50 | void CX4_op0d(running_machine *machine); | |
| 51 | void CX4_op10(void); | |
| 52 | void CX4_op13(void); | |
| 53 | void CX4_op15(running_machine *machine); | |
| 54 | void CX4_op1f(running_machine *machine); | |
| 55 | void CX4_op22(void); | |
| 56 | void CX4_op25(void); | |
| 57 | void CX4_op2d(running_machine *machine); | |
| 58 | void CX4_op40(void); | |
| 59 | void CX4_op54(void); | |
| 60 | void CX4_op5c(void); | |
| 61 | void CX4_op5e(void); | |
| 62 | void CX4_op60(void); | |
| 63 | void CX4_op62(void); | |
| 64 | void CX4_op64(void); | |
| 65 | void CX4_op66(void); | |
| 66 | void CX4_op68(void); | |
| 67 | void CX4_op6a(void); | |
| 68 | void CX4_op6c(void); | |
| 69 | void CX4_op6e(void); | |
| 70 | void CX4_op70(void); | |
| 71 | void CX4_op72(void); | |
| 72 | void CX4_op74(void); | |
| 73 | void CX4_op76(void); | |
| 74 | void CX4_op78(void); | |
| 75 | void CX4_op7a(void); | |
| 76 | void CX4_op7c(void); | |
| 77 | void CX4_op89(void); | |
| 78 | ||
| 79 | UINT8 CX4_readb(UINT16 addr); | |
| 80 | UINT16 CX4_readw(UINT16 addr); | |
| 81 | UINT32 CX4_readl(UINT16 addr); | |
| 82 | ||
| 83 | void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data); | |
| 84 | void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data); | |
| 85 | void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data); | |
| 86 | ||
| 87 | void CX4_reset(void); | |
| 88 | ||
| 89 | UINT8 CX4_read(UINT32 addr); | |
| 90 | void CX4_write(running_machine *machine, UINT32 addr, UINT8 data); | |
| 91 | ||
| 92 | void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color); |
| r5955 | r5956 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | /* global data */ |
| 26 | 26 | UINT8 balsente_shooter; |
| 27 | UINT8 balsente_shooter_x; | |
| 28 | UINT8 balsente_shooter_y; | |
| 27 | static UINT8 balsente_shooter_x; | |
| 28 | static UINT8 balsente_shooter_y; | |
| 29 | 29 | UINT8 balsente_adc_shift; |
| 30 | 30 | UINT16 *shrike_shared; |
| 31 | 31 | UINT16 *shrike_io; |
| r5955 | r5956 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | #include "snesdsp4.h" |
| 29 | 29 | |
| 30 | struct DSP4_t DSP4; | |
| 31 | struct DSP4_vars_t DSP4_vars; | |
| 30 | static struct DSP4_t DSP4; | |
| 31 | static struct DSP4_vars_t DSP4_vars; | |
| 32 | 32 | |
| 33 | 33 | INLINE UINT16 READ_WORD(UINT8 *addr) |
| 34 | 34 | { |
| r5955 | r5956 | |
| 142 | 142 | 0x0333, 0x031f, 0x030c, 0x02fa, 0x02e8, 0x02d8, 0x02c8, 0x02b9, 0x02aa, 0x029c, |
| 143 | 143 | 0x028f, 0x0282, 0x0276, 0x026a, 0x025e, 0x0253, 0x0249, 0x023e, 0x0234, 0x022b, |
| 144 | 144 | 0x0222, 0x0219, 0x0210, 0x0208, }; |
| 145 | INT16 DSP4_Inverse(INT16 value) | |
| 145 | static INT16 DSP4_Inverse(INT16 value) | |
| 146 | 146 | { |
| 147 | 147 | // saturate bounds |
| 148 | 148 | if (value < 0) |
| r5955 | r5956 | |
| 160 | 160 | ////////////////////////////////////////////////////////////// |
| 161 | 161 | |
| 162 | 162 | // Prototype |
| 163 | void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop); | |
| 163 | static void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop); | |
| 164 | 164 | |
| 165 | 165 | ////////////////////////////////////////////////////////////// |
| 166 | 166 | |
| 167 | 167 | // OP00 |
| 168 | void DSP4_Multiply(INT16 Multiplicand, INT16 Multiplier, INT32 *Product) | |
| 168 | static void DSP4_Multiply(INT16 Multiplicand, INT16 Multiplier, INT32 *Product) | |
| 169 | 169 | { |
| 170 | 170 | *Product = (Multiplicand * Multiplier << 1) >> 1; |
| 171 | 171 | } |
| r5955 | r5956 | |
| 173 | 173 | ////////////////////////////////////////////////////////////// |
| 174 | 174 | |
| 175 | 175 | |
| 176 | void DSP4_OP01( void ) | |
| 176 | static void DSP4_OP01( void ) | |
| 177 | 177 | { |
| 178 | 178 | DSP4.waiting4command = 0; |
| 179 | 179 | |
| r5955 | r5956 | |
| 388 | 388 | ////////////////////////////////////////////////////////////// |
| 389 | 389 | |
| 390 | 390 | |
| 391 | void DSP4_OP03( void ) | |
| 391 | static void DSP4_OP03( void ) | |
| 392 | 392 | { |
| 393 | 393 | DSP4_vars.OAM_RowMax = 33; |
| 394 | 394 | memset(DSP4_vars.OAM_Row, 0, 64); |
| r5955 | r5956 | |
| 398 | 398 | ////////////////////////////////////////////////////////////// |
| 399 | 399 | |
| 400 | 400 | |
| 401 | void DSP4_OP05( void ) | |
| 401 | static void DSP4_OP05( void ) | |
| 402 | 402 | { |
| 403 | 403 | DSP4_vars.OAM_index = 0; |
| 404 | 404 | DSP4_vars.OAM_bits = 0; |
| r5955 | r5956 | |
| 409 | 409 | |
| 410 | 410 | ////////////////////////////////////////////////////////////// |
| 411 | 411 | |
| 412 | void DSP4_OP06( void ) | |
| 412 | static void DSP4_OP06( void ) | |
| 413 | 413 | { |
| 414 | 414 | DSP4_CLEAR_OUT(); |
| 415 | 415 | DSP4_WRITE_16_WORD(DSP4_vars.OAM_attr); |
| r5955 | r5956 | |
| 418 | 418 | ////////////////////////////////////////////////////////////// |
| 419 | 419 | |
| 420 | 420 | |
| 421 | void DSP4_OP07( void ) | |
| 421 | static void DSP4_OP07( void ) | |
| 422 | 422 | { |
| 423 | 423 | DSP4.waiting4command = 0; |
| 424 | 424 | |
| r5955 | r5956 | |
| 587 | 587 | |
| 588 | 588 | ////////////////////////////////////////////////////////////// |
| 589 | 589 | |
| 590 | void DSP4_OP08( void ) | |
| 590 | static void DSP4_OP08( void ) | |
| 591 | 591 | { |
| 592 | 592 | INT16 win_left, win_right; |
| 593 | 593 | INT16 view_x[2], view_y[2]; |
| r5955 | r5956 | |
| 918 | 918 | |
| 919 | 919 | ////////////////////////////////////////////////////////////// |
| 920 | 920 | |
| 921 | void DSP4_OP09( void ) | |
| 921 | static void DSP4_OP09( void ) | |
| 922 | 922 | { |
| 923 | 923 | DSP4.waiting4command = 0; |
| 924 | 924 | |
| r5955 | r5956 | |
| 1181 | 1181 | |
| 1182 | 1182 | ////////////////////////////////////////////////////////////// |
| 1183 | 1183 | |
| 1184 | const UINT16 OP0A_Values[16] = { 0x0000, 0x0030, 0x0060, 0x0090, 0x00c0, 0x00f0, 0x0120, 0x0150, 0xfe80, | |
| 1184 | static const UINT16 OP0A_Values[16] = { 0x0000, 0x0030, 0x0060, 0x0090, 0x00c0, 0x00f0, 0x0120, 0x0150, 0xfe80, | |
| 1185 | 1185 | 0xfeb0, 0xfee0, 0xff10, 0xff40, 0xff70, 0xffa0, 0xffd0 }; |
| 1186 | 1186 | |
| 1187 | void DSP4_OP0A(INT16 n2, INT16 *o1, INT16 *o2, INT16 *o3, INT16 *o4) | |
| 1187 | static void DSP4_OP0A(INT16 n2, INT16 *o1, INT16 *o2, INT16 *o3, INT16 *o4) | |
| 1188 | 1188 | { |
| 1189 | 1189 | *o4 = OP0A_Values[(n2 & 0x000f)]; |
| 1190 | 1190 | *o3 = OP0A_Values[(n2 & 0x00f0) >> 4]; |
| r5955 | r5956 | |
| 1194 | 1194 | |
| 1195 | 1195 | ////////////////////////////////////////////////////////////// |
| 1196 | 1196 | |
| 1197 | void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop) | |
| 1197 | static void DSP4_OP0B(UINT8 *draw, INT16 sp_x, INT16 sp_y, INT16 sp_attr, UINT8 size, UINT8 stop) | |
| 1198 | 1198 | { |
| 1199 | 1199 | INT16 Row1, Row2; |
| 1200 | 1200 | |
| r5955 | r5956 | |
| 1279 | 1279 | |
| 1280 | 1280 | ////////////////////////////////////////////////////////////// |
| 1281 | 1281 | |
| 1282 | void DSP4_OP0D( void ) | |
| 1282 | static void DSP4_OP0D( void ) | |
| 1283 | 1283 | { |
| 1284 | 1284 | DSP4.waiting4command = 0; |
| 1285 | 1285 | |
| r5955 | r5956 | |
| 1467 | 1467 | ////////////////////////////////////////////////////////////// |
| 1468 | 1468 | |
| 1469 | 1469 | |
| 1470 | void DSP4_OP0E( void ) | |
| 1470 | static void DSP4_OP0E( void ) | |
| 1471 | 1471 | { |
| 1472 | 1472 | DSP4_vars.OAM_RowMax = 16; |
| 1473 | 1473 | memset(DSP4_vars.OAM_Row, 0, 64); |
| r5955 | r5956 | |
| 1476 | 1476 | |
| 1477 | 1477 | ////////////////////////////////////////////////////////////// |
| 1478 | 1478 | |
| 1479 | void DSP4_OP0F( void ) | |
| 1479 | static void DSP4_OP0F( void ) | |
| 1480 | 1480 | { |
| 1481 | 1481 | DSP4.waiting4command = 0; |
| 1482 | 1482 | |
| r5955 | r5956 | |
| 1727 | 1727 | ////////////////////////////////////////////////////////////// |
| 1728 | 1728 | |
| 1729 | 1729 | |
| 1730 | void DSP4_OP10( void ) | |
| 1730 | static void DSP4_OP10( void ) | |
| 1731 | 1731 | { |
| 1732 | 1732 | DSP4.waiting4command = 0; |
| 1733 | 1733 | |
| r5955 | r5956 | |
| 1935 | 1935 | |
| 1936 | 1936 | ////////////////////////////////////////////////////////////// |
| 1937 | 1937 | |
| 1938 | void DSP4_OP11(INT16 A, INT16 B, INT16 C, INT16 D, INT16 *M) | |
| 1938 | static void DSP4_OP11(INT16 A, INT16 B, INT16 C, INT16 D, INT16 *M) | |
| 1939 | 1939 | { |
| 1940 | 1940 | // 0x155 = 341 = Horizontal Width of the Screen |
| 1941 | 1941 | *M = ((A * 0x0155 >> 2) & 0xf000) | |
| r5955 | r5956 | |
| 1952 | 1952 | //Processing Code |
| 1953 | 1953 | ///////////////////////////////////////////////////////////// |
| 1954 | 1954 | |
| 1955 | void InitDSP4( void ) | |
| 1955 | static void InitDSP4( void ) | |
| 1956 | 1956 | { |
| 1957 | 1957 | memset(&DSP4, 0, sizeof(DSP4)); |
| 1958 | 1958 | DSP4.waiting4command = 1; |
| 1959 | 1959 | } |
| 1960 | 1960 | |
| 1961 | void DSP4_write( UINT8 dsp4_byte ) | |
| 1961 | static void DSP4_write( UINT8 dsp4_byte ) | |
| 1962 | 1962 | { |
| 1963 | 1963 | // clear pending read |
| 1964 | 1964 | if (DSP4.out_index < DSP4.out_count) |
| r5955 | r5956 | |
| 2159 | 2159 | } |
| 2160 | 2160 | } |
| 2161 | 2161 | |
| 2162 | UINT8 DSP4_read( void ) | |
| 2162 | static UINT8 DSP4_read( void ) | |
| 2163 | 2163 | { |
| 2164 | 2164 | UINT8 value; |
| 2165 | 2165 |
| r5955 | r5956 | |
|---|---|---|
| 18 | 18 | UINT8 output[512]; |
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | extern struct DSP4_t DSP4; | |
| 22 | ||
| 23 | 21 | struct DSP4_vars_t |
| 24 | 22 | { |
| 25 | 23 | // op control |
| r5955 | r5956 | |
| 99 | 97 | INT16 OAM_Row[32]; // current number of tiles per row |
| 100 | 98 | }; |
| 101 | 99 | |
| 102 | extern struct DSP4_vars_t DSP4_vars; | |
| 103 | ||
| 104 | 100 | #endif |
| r5955 | r5956 | |
|---|---|---|
| 486 | 486 | |
| 487 | 487 | // init, reset & handlers |
| 488 | 488 | |
| 489 | UINT8 st010_read( UINT16 address ) | |
| 489 | static UINT8 st010_read( UINT16 address ) | |
| 490 | 490 | { |
| 491 | 491 | return st010_readb(address); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | void st010_write( UINT16 address, UINT8 data ) | |
| 494 | static void st010_write( UINT16 address, UINT8 data ) | |
| 495 | 495 | { |
| 496 | 496 | st010_writeb(address, data); |
| 497 | 497 | |
| r5955 | r5956 | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | |
| 517 | void st010_init( running_machine* machine ) | |
| 517 | static void st010_init( running_machine* machine ) | |
| 518 | 518 | { |
| 519 | 519 | snes_st010.ram = (UINT8*)auto_alloc_array(machine, UINT8, 0x1000); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | void st010_reset( void ) | |
| 522 | static void st010_reset( void ) | |
| 523 | 523 | { |
| 524 | 524 | snes_st010.x1 = 0; |
| 525 | 525 | snes_st010.y1 = 0; |
| r5955 | r5956 | |
|---|---|---|
| 17 | 17 | extern void namcos21_kickstart(running_machine *, int); |
| 18 | 18 | |
| 19 | 19 | static TIMER_CALLBACK( namcos2_posirq_tick ); |
| 20 | static void InitC148(void); | |
| 21 | ||
| 20 | 22 | static emu_timer *namcos2_posirq_timer; |
| 21 | 23 | |
| 22 | 24 | int namcos2_gametype; |
| r5955 | r5956 | |
| 110 | 112 | MACHINE_RESET( namcos2 ) |
| 111 | 113 | { |
| 112 | 114 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 113 | int loop; | |
| 114 | 115 | mFinalLapProtCount = 0; |
| 115 | 116 | namcos2_mcu_analog_ctrl = 0; |
| 116 | 117 | namcos2_mcu_analog_data = 0xaa; |
| r5955 | r5956 | |
| 126 | 127 | ResetAllSubCPUs( machine, ASSERT_LINE ); |
| 127 | 128 | |
| 128 | 129 | /* Initialise interrupt handlers */ |
| 129 | for(loop = 0; loop < 0x20; loop++) | |
| 130 | { | |
| 131 | namcos2_68k_master_C148[loop] = 0; | |
| 132 | namcos2_68k_slave_C148[loop] = 0; | |
| 133 | namcos2_68k_gpu_C148[loop] = 0; | |
| 134 | } | |
| 130 | InitC148(); | |
| 135 | 131 | |
| 136 | 132 | /* reset POSIRQ timer */ |
| 137 | 133 | timer_adjust_oneshot(namcos2_posirq_timer, attotime_never, 0); |
| r5955 | r5956 | |
| 190 | 186 | /* 68000 Shared serial communications processor (CPU5?) */ |
| 191 | 187 | /**************************************************************/ |
| 192 | 188 | |
| 193 | UINT16 namcos2_68k_serial_comms_ctrl[0x8]; | |
| 189 | static UINT16 namcos2_68k_serial_comms_ctrl[0x8]; | |
| 194 | 190 | UINT16 *namcos2_68k_serial_comms_ram; |
| 195 | 191 | |
| 196 | 192 | READ16_HANDLER( namcos2_68k_serial_comms_ram_r ){ |
| r5955 | r5956 | |
| 458 | 454 | #define FRAME_TIME (1.0/60.0) |
| 459 | 455 | #define LINE_LENGTH (FRAME_TIME/NO_OF_LINES) |
| 460 | 456 | |
| 461 | UINT16 namcos2_68k_master_C148[0x20]; | |
| 462 | UINT16 namcos2_68k_slave_C148[0x20]; | |
| 463 | UINT16 namcos2_68k_gpu_C148[0x20]; | |
| 457 | static UINT16 namcos2_68k_master_C148[0x20]; | |
| 458 | static UINT16 namcos2_68k_slave_C148[0x20]; | |
| 459 | static UINT16 namcos2_68k_gpu_C148[0x20]; | |
| 464 | 460 | |
| 465 | 461 | |
| 466 | 462 | static int IsSystem21( void ) |
| r5955 | r5956 | |
| 479 | 475 | } |
| 480 | 476 | } |
| 481 | 477 | |
| 478 | static void InitC148(void) | |
| 479 | { | |
| 480 | int loop; | |
| 481 | ||
| 482 | for(loop = 0; loop < 0x20; loop++) | |
| 483 | { | |
| 484 | namcos2_68k_master_C148[loop] = 0; | |
| 485 | namcos2_68k_slave_C148[loop] = 0; | |
| 486 | namcos2_68k_gpu_C148[loop] = 0; | |
| 487 | } | |
| 488 | } | |
| 489 | ||
| 482 | 490 | static UINT16 |
| 483 | 491 | ReadWriteC148( const address_space *space, offs_t offset, UINT16 data, int bWrite ) |
| 484 | 492 | { |
| r5955 | r5956 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | const UINT8 CX4_immediate_data[48] = | |
| 11 | static const UINT8 CX4_immediate_data[48] = | |
| 12 | 12 | { |
| 13 | 13 | 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, |
| 14 | 14 | 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f, |
| r5955 | r5956 | |
| 16 | 16 | 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xfe, 0x00 |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | const UINT16 CX4_wave_data[40] = | |
| 19 | static const UINT16 CX4_wave_data[40] = | |
| 20 | 20 | { |
| 21 | 21 | 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, |
| 22 | 22 | 0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e, |
| r5955 | r5956 | |
| 25 | 25 | 0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080a, 0x080c, 0x080e |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | const UINT32 CX4_sin_table[256] = | |
| 28 | static const UINT32 CX4_sin_table[256] = | |
| 29 | 29 | { |
| 30 | 30 | 0x000000, 0x000324, 0x000648, 0x00096c, 0x000c8f, 0x000fb2, 0x0012d5, 0x0015f6, |
| 31 | 31 | 0x001917, 0x001c37, 0x001f56, 0x002273, 0x002590, 0x0028aa, 0x002bc4, 0x002edb, |
| r5955 | r5956 | |
| 61 | 61 | 0xff013b, 0xff00f1, 0xff00b1, 0xff007b, 0xff004e, 0xff002c, 0xff0013, 0xff0004 |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | const INT16 CX4_SinTable[512] = | |
| 64 | static const INT16 CX4_SinTable[512] = | |
| 65 | 65 | { |
| 66 | 66 | 0, 402, 804, 1206, 1607, 2009, 2410, 2811, |
| 67 | 67 | 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, |
| r5955 | r5956 | |
| 129 | 129 | -3211, -2811, -2410, -2009, -1607, -1206, -804, -402 |
| 130 | 130 | }; |
| 131 | 131 | |
| 132 | const INT16 CX4_CosTable[512] = | |
| 132 | static const INT16 CX4_CosTable[512] = | |
| 133 | 133 | { |
| 134 | 134 | 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, |
| 135 | 135 | 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, |
| r5955 | r5956 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | static const int page_sizes[4] = { 4096, 8192, 16384, 32768 }; |
| 39 | 39 | |
| 40 | UINT32 *memc_physmem; | |
| 40 | UINT32 *archimedes_memc_physmem; | |
| 41 | 41 | static UINT32 memc_pagesize; |
| 42 | 42 | static int memc_latchrom; |
| 43 | 43 | static INT16 memc_pages[(32*1024*1024)/(4096)]; // the logical RAM area is 32 megs, and the smallest page size is 4k |
| r5955 | r5956 | |
| 175 | 175 | timer_adjust_oneshot(snd_timer, attotime_never, 0); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | READ32_HANDLER(memc_logical_r) | |
| 178 | READ32_HANDLER(archimedes_memc_logical_r) | |
| 179 | 179 | { |
| 180 | 180 | UINT32 page, poffs; |
| 181 | 181 | |
| r5955 | r5956 | |
| 198 | 198 | |
| 199 | 199 | if (memc_pages[page] != -1) |
| 200 | 200 | { |
| 201 | return memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]; | |
| 201 | return archimedes_memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]; | |
| 202 | 202 | } |
| 203 | 203 | else |
| 204 | 204 | { |
| r5955 | r5956 | |
| 209 | 209 | return 0; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | WRITE32_HANDLER(memc_logical_w) | |
| 212 | WRITE32_HANDLER(archimedes_memc_logical_w) | |
| 213 | 213 | { |
| 214 | 214 | UINT32 page, poffs; |
| 215 | 215 | |
| r5955 | r5956 | |
| 228 | 228 | |
| 229 | 229 | if (memc_pages[page] != -1) |
| 230 | 230 | { |
| 231 | COMBINE_DATA(&memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]); | |
| 231 | COMBINE_DATA(&archimedes_memc_physmem[((memc_pages[page] * page_sizes[memc_pagesize]) + poffs)>>2]); | |
| 232 | 232 | } |
| 233 | 233 | else |
| 234 | 234 | { |
| r5955 | r5956 | |
| 260 | 260 | direct->bytemask = page_sizes[memc_pagesize]-1; |
| 261 | 261 | direct->bytestart = page * page_sizes[memc_pagesize]; |
| 262 | 262 | direct->byteend = direct->bytestart + direct->bytemask; |
| 263 | direct->raw = direct->decrypted = (UINT8 *)&memc_physmem[(memc_pages[page] * page_sizes[memc_pagesize])>>2]; | |
| 263 | direct->raw = direct->decrypted = (UINT8 *)&archimedes_memc_physmem[(memc_pages[page] * page_sizes[memc_pagesize])>>2]; | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | return ~0; |
| r5955 | r5956 | |
| 314 | 314 | ioc_timerout[tmr] = ioc_timercnt[tmr] - (UINT32)time; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | READ32_HANDLER(ioc_r) | |
| 317 | READ32_HANDLER(archimedes_ioc_r) | |
| 318 | 318 | { |
| 319 | 319 | #ifdef MESS |
| 320 | 320 | const device_config *fdc = (const device_config *)devtag_get_device(space->machine, "wd1772"); |
| r5955 | r5956 | |
| 364 | 364 | return 0; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | WRITE32_HANDLER(ioc_w) | |
| 367 | WRITE32_HANDLER(archimedes_ioc_w) | |
| 368 | 368 | { |
| 369 | 369 | #ifdef MESS |
| 370 | 370 | const device_config *fdc = (const device_config *)devtag_get_device(space->machine, "wd1772"); |
| r5955 | r5956 | |
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | READ32_HANDLER(vidc_r) | |
| 495 | READ32_HANDLER(archimedes_vidc_r) | |
| 496 | 496 | { |
| 497 | 497 | return 0; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | WRITE32_HANDLER(vidc_w) | |
| 500 | WRITE32_HANDLER(archimedes_vidc_w) | |
| 501 | 501 | { |
| 502 | 502 | UINT32 reg = data>>24; |
| 503 | 503 | UINT32 val = data & 0xffffff; |
| r5955 | r5956 | |
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | READ32_HANDLER(memc_r) | |
| 560 | READ32_HANDLER(archimedes_memc_r) | |
| 561 | 561 | { |
| 562 | 562 | return 0; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | WRITE32_HANDLER(memc_w) | |
| 565 | WRITE32_HANDLER(archimedes_memc_w) | |
| 566 | 566 | { |
| 567 | 567 | // is it a register? |
| 568 | 568 | if ((data & 0x0fe00000) == 0x03600000) |
| r5955 | r5956 | |
| 638 | 638 | 1 being bit 6 |
| 639 | 639 | */ |
| 640 | 640 | |
| 641 | WRITE32_HANDLER(memc_page_w) | |
| 641 | WRITE32_HANDLER(archimedes_memc_page_w) | |
| 642 | 642 | { |
| 643 | 643 | UINT32 log, phys, memc, perms; |
| 644 | 644 |
| r5955 | r5956 | |
|---|---|---|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
| 125 | #ifdef UNUSED_FUNCTION | |
| 125 | 126 | static READ8_HANDLER( checkmaj_protection_r ) |
| 126 | 127 | { |
| 127 | 128 | switch (cpu_get_pc(space->cpu)) |
| r5955 | r5956 | |
| 212 | 213 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */ |
| 213 | 214 | |
| 214 | 215 | } |
| 216 | #endif | |
| 215 | 217 | |
| 216 | 218 | |
| 217 | 219 | READ8_HANDLER( scramblb_protection_1_r ) |
| r5955 | r5956 | |
| 253 | 255 | return (input_port_read(field->port->machine, portnames[_4in1_bank]) & bit_mask) ? 0x01 : 0x00; |
| 254 | 256 | } |
| 255 | 257 | |
| 258 | #ifdef UNUSED_FUNCTION | |
| 256 | 259 | DRIVER_INIT( pisces ) |
| 257 | 260 | { |
| 258 | 261 | /* the coin lockout was replaced */ |
| r5955 | r5956 | |
| 383 | 386 | rom[i] ^= data_xor; |
| 384 | 387 | } |
| 385 | 388 | } |
| 389 | #endif | |
| 386 | 390 | |
| 387 | 391 | DRIVER_INIT( 4in1 ) |
| 388 | 392 | { |
| r5955 | r5956 | |
|---|---|---|
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | //Build OAM |
| 12 | void CX4_op00_00(running_machine *machine) | |
| 12 | static void CX4_op00_00(running_machine *machine) | |
| 13 | 13 | { |
| 14 | 14 | INT32 i; |
| 15 | 15 | |
| r5955 | r5956 | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | //Scale and Rotate |
| 129 | void CX4_op00_03() | |
| 129 | static void CX4_op00_03(void) | |
| 130 | 130 | { |
| 131 | 131 | CX4_C4DoScaleRotate(0); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | //Transform Lines |
| 135 | void CX4_op00_05(running_machine *machine) | |
| 135 | static void CX4_op00_05(running_machine *machine) | |
| 136 | 136 | { |
| 137 | 137 | INT32 i; |
| 138 | 138 | UINT32 ptr = 0, ptr2 = 0; |
| r5955 | r5956 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | //Scale and Rotate |
| 181 | void CX4_op00_07() | |
| 181 | static void CX4_op00_07(void) | |
| 182 | 182 | { |
| 183 | 183 | CX4_C4DoScaleRotate(64); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | //Draw Wireframe |
| 187 | void CX4_op00_08(running_machine *machine) | |
| 187 | static void CX4_op00_08(running_machine *machine) | |
| 188 | 188 | { |
| 189 | 189 | CX4_C4DrawWireFrame(machine); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | //Disintegrate |
| 193 | void CX4_op00_0b(running_machine *machine) | |
| 193 | static void CX4_op00_0b(running_machine *machine) | |
| 194 | 194 | { |
| 195 | 195 | UINT8 width, height; |
| 196 | 196 | UINT32 startx, starty; |
| r5955 | r5956 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | //Bitplane Wave |
| 243 | void CX4_op00_0c(running_machine *machine) | |
| 243 | static void CX4_op00_0c(running_machine *machine) | |
| 244 | 244 | { |
| 245 | 245 | int i, j; |
| 246 | 246 | UINT32 destptr = 0; |
| r5955 | r5956 | |
|---|---|---|
| 2 | 2 | #include "system16.h" |
| 3 | 3 | #include "sound/upd7759.h" |
| 4 | 4 | |
| 5 | UINT16 *sys16_workingram; | |
| 6 | UINT16 *sys16_workingram2; | |
| 7 | UINT16 *sys16_extraram; | |
| 8 | UINT16 *sys16_extraram2; | |
| 9 | UINT16 *sys16_extraram3; | |
| 10 | ||
| 11 | 5 | static void patch_codeX( UINT16 *mem, offs_t offset, int data ) |
| 12 | 6 | { |
| 13 | 7 | int aligned_offset = offset&0xfffffe; |
| r5955 | r5956 | |
|---|---|---|
| 24 | 24 | #define DRIVER_RECURSIVE |
| 25 | 25 | |
| 26 | 26 | /* step 1: declare all external references */ |
| 27 | #define DRIVER(NAME) | |
| 27 | #define DRIVER(NAME) GAME | |
| 28 | 28 | #include "tiny.c" |
| 29 | 29 | |
| 30 | 30 | /* step 2: define the drivers[] array */ |
| 31 | 31 | #undef DRIVER |
| 32 | #define DRIVER(NAME) & | |
| 32 | #define DRIVER(NAME) &GAME | |
| 33 | 33 | const game_driver * const drivers[] = |
| 34 | 34 | { |
| 35 | 35 | #include "tiny.c" |
| r5955 | r5956 | |
|---|---|---|
| 22 | 22 | #define DRIVER_RECURSIVE |
| 23 | 23 | |
| 24 | 24 | /* step 1: declare all external references */ |
| 25 | #define DRIVER(NAME) | |
| 25 | #define DRIVER(NAME) GAME | |
| 26 | 26 | #include "mamedriv.c" |
| 27 | 27 | |
| 28 | 28 | /* step 2: define the drivers[] array */ |
| 29 | 29 | #undef DRIVER |
| 30 | #define DRIVER(NAME) & | |
| 30 | #define DRIVER(NAME) &GAME | |
| 31 | 31 | const game_driver * const drivers[] = |
| 32 | 32 | { |
| 33 | 33 | #include "mamedriv.c" |
| r5955 | r5956 | |
| 165 | 165 | DRIVER( gteikob2 ) /* bootleg */ |
| 166 | 166 | DRIVER( spacbatt ) /* bootleg */ |
| 167 | 167 | DRIVER( spacbat2 ) /* bootleg */ |
| 168 | DRIVER( spacempr ) /* bootleg */ | |
| 168 | 169 | DRIVER( skyraidr ) /* bootleg */ |
| 169 | 170 | DRIVER( batman2 ) /* bootleg */ |
| 170 | 171 | DRIVER( warofbug ) /* (c) 1981 Armenia */ |
| r5955 | r5956 | |
| 172 | 173 | DRIVER( exodus ) /* Subelectro - bootleg? */ |
| 173 | 174 | DRIVER( streakng ) /* [1980] Shoei */ |
| 174 | 175 | DRIVER( pacmanbl ) /* bootleg */ |
| 176 | DRIVER( pacmanbla ) /* bootleg */ | |
| 175 | 177 | DRIVER( devilfsg ) /* (c) 1984 Vision / Artic (bootleg?) */ |
| 176 | 178 | DRIVER( zigzag ) /* (c) 1982 LAX */ |
| 177 | 179 | DRIVER( zigzag2 ) /* (c) 1982 LAX */ |
| r5955 | r5956 | |
| 616 | 618 | DRIVER( warpwarpr ) /* (c) 1981 [Namco] (Rock-ola license) */ |
| 617 | 619 | DRIVER( warpwarpr2 )/* (c) 1981 [Namco] (Rock-ola license) */ |
| 618 | 620 | DRIVER( rallyx ) /* (c) 1980 Namco */ |
| 621 | DRIVER( rallyxa ) /* (c) 1980 Namco */ | |
| 619 | 622 | DRIVER( rallyxm ) /* (c) 1980 Midway */ |
| 620 | 623 | DRIVER( nrallyx ) /* (c) 1981 Namco */ |
| 624 | DRIVER( nrallyxb ) /* (c) 1981 Namco */ | |
| 621 | 625 | DRIVER( jungler ) /* GX327 (c) 1981 Konami */ |
| 622 | 626 | DRIVER( junglers ) /* GX327 (c) 1981 Stern */ |
| 623 | 627 | DRIVER( tactcian ) /* GX335 (c) 1982 Sega */ |
| r5955 | r5956 | |
| 1787 | 1791 | DRIVER( cadashu ) /* C21 (c) 1989 Taito America Corporation */ |
| 1788 | 1792 | DRIVER( cadashi ) /* C21 (c) 1989 Taito Corporation Japan */ |
| 1789 | 1793 | DRIVER( cadashf ) /* C21 (c) 1989 Taito Corporation Japan */ |
| 1794 | DRIVER( cadashg ) /* C21 (c) 1989 Taito Corporation Japan */ | |
| 1790 | 1795 | DRIVER( parentj ) /* C42 (c) 199? Taito */ |
| 1791 | 1796 | DRIVER( galmedes ) /* (c) 1992 Visco (Japan) */ |
| 1792 | 1797 | DRIVER( earthjkr ) /* (c) 1993 Visco (Japan) */ |
| r5955 | r5956 | |
| 2554 | 2559 | DRIVER( sf2j ) /* 10/12/1991 (c) 1991 (Japan) */ |
| 2555 | 2560 | DRIVER( sf2ja ) /* 14/02/1991 (c) 1991 (Japan) */ |
| 2556 | 2561 | DRIVER( sf2jc ) /* 06/03/1991 (c) 1991 (Japan) */ |
| 2562 | DRIVER( sf2qp1 ) /* hack */ | |
| 2557 | 2563 | DRIVER( 3wonders ) /* 20/05/1991 (c) 1991 (World) */ |
| 2558 | 2564 | DRIVER( 3wondersu ) /* 20/05/1991 (c) 1991 (US) */ |
| 2559 | 2565 | DRIVER( wonder3 ) /* 20/05/1991 (c) 1991 (Japan) */ |
| r5955 | r5956 | |
| 2580 | 2586 | DRIVER( sf2rb3 ) /* hack */ |
| 2581 | 2587 | DRIVER( sf2red ) /* hack */ |
| 2582 | 2588 | DRIVER( sf2v004 ) /* hack */ |
| 2589 | DRIVER( sf2acc ) /* hack */ | |
| 2583 | 2590 | DRIVER( sf2accp2 ) /* hack */ |
| 2584 | 2591 | DRIVER( sf2m1 ) /* hack */ |
| 2585 | 2592 | DRIVER( sf2m2 ) /* hack */ |
| r5955 | r5956 | |
| 3431 | 3438 | DRIVER( aafbb ) /* (c) 1989 Leland */ |
| 3432 | 3439 | DRIVER( offroad ) /* (c) 1989 Leland */ |
| 3433 | 3440 | DRIVER( offroadt ) /* (c) 1989 Leland */ |
| 3441 | DRIVER( offrdtp2 ) /* (c) 1989 Leland */ | |
| 3434 | 3442 | DRIVER( pigout ) /* (c) 1990 Leland */ |
| 3435 | 3443 | DRIVER( pigouta ) /* (c) 1990 Leland */ |
| 3436 | 3444 | DRIVER( ataxx ) /* (c) 1990 Leland */ |
| r5955 | r5956 | |
| 3520 | 3528 | |
| 3521 | 3529 | /* Sega "Zaxxon hardware" games */ |
| 3522 | 3530 | DRIVER( zaxxon ) /* (c) 1982 */ |
| 3531 | DRIVER( zaxxonj ) /* (c) 1982 */ | |
| 3523 | 3532 | DRIVER( zaxxon2 ) /* (c) 1982 */ |
| 3524 | 3533 | DRIVER( zaxxonb ) /* bootleg */ |
| 3525 | 3534 | DRIVER( szaxxon ) /* (c) 1982 */ |
| r5955 | r5956 | |
| 4527 | 4536 | DRIVER( clubkrte ) /* 2002.?? Club Kart: European Session */ |
| 4528 | 4537 | /* 2002.06 WCCF SERIE A 2001-2002 */ |
| 4529 | 4538 | /* 2002.07 Soul Surfer */ |
| 4539 | DRIVER( vf4evoct ) /* 2002.08 Virtua Fighter 4 Evolution (cartridge) */ | |
| 4530 | 4540 | DRIVER( vf4evoa ) /* 2002.08 Virtua Fighter 4 Evolution */ |
| 4531 | 4541 | /* 2002.11 WCCF SERIE A 2001-2002 ver.1.2 */ |
| 4532 | 4542 | DRIVER( initdv2j ) /* 2002.12 Initial D Arcade Stage ver.2 */ |
| r5955 | r5956 | |
| 5327 | 5337 | DRIVER( majuu ) /* GX687 (c) 1987 (Japan) */ |
| 5328 | 5338 | DRIVER( vulcan ) /* GX785 (c) 1988 */ |
| 5329 | 5339 | DRIVER( vulcana ) /* GX785 (c) 1988 */ |
| 5340 | DRIVER( vulcanb ) /* GX785 (c) 1988 */ | |
| 5330 | 5341 | DRIVER( gradius2 ) /* GX785 (c) 1988 (Japan) */ |
| 5331 | 5342 | DRIVER( gradius2a ) /* GX785 (c) 1988 (Japan) */ |
| 5332 | 5343 | DRIVER( gradius2b ) /* GX785 (c) 1988 (Japan) */ |
| r5955 | r5956 | |
| 5560 | 5571 | /* Konami M2 games */ |
| 5561 | 5572 | DRIVER( polystar ) /* GX623 (c)1997 */ |
| 5562 | 5573 | DRIVER( totlvice ) /* GX639 (c)1997 */ |
| 5574 | DRIVER( totlvicj ) /* GX639 (c)1997 */ | |
| 5563 | 5575 | DRIVER( btltryst ) /* GX636 (c)1998 */ |
| 5564 | 5576 | DRIVER( heatof11 ) /* GX703 (c)1998 */ |
| 5565 | 5577 | DRIVER( evilngt ) /* GX810 (c)1998 */ |
| r5955 | r5956 | |
| 6768 | 6780 | DRIVER( totcarn ) /* (c) 1992 Midway */ |
| 6769 | 6781 | DRIVER( totcarnp ) /* (c) 1992 Midway */ |
| 6770 | 6782 | DRIVER( mk2 ) /* (c) 1993 Midway */ |
| 6783 | DRIVER( mk2r31e ) /* (c) 1993 Midway */ | |
| 6771 | 6784 | DRIVER( mk2r32 ) /* (c) 1993 Midway */ |
| 6772 | 6785 | DRIVER( mk2r30 ) /* (c) 1993 Midway */ |
| 6773 | 6786 | DRIVER( mk2r21 ) /* (c) 1993 Midway */ |
| r5955 | r5956 | |
| 7379 | 7392 | DRIVER( glass10 ) /* (c) 1993 - Ref 931021 */ |
| 7380 | 7393 | DRIVER( glassbrk ) /* (c) 1993 - Ref 931021 shows "Break Edition" on a real PCB */ |
| 7381 | 7394 | DRIVER( targeth ) /* (c) 1994 - Ref 940531 */ |
| 7395 | DRIVER( targetha ) /* (c) 1994 - Ref 940531 */ | |
| 7382 | 7396 | DRIVER( thoop2 ) /* (c) 1994 - Ref ??? */ |
| 7383 | 7397 | DRIVER( aligator ) /* (c) 1994 - Ref 940411 */ |
| 7384 | 7398 | DRIVER( aligatorun ) /* (c) 1994 - Ref 940411 (unprotected) */ |
| r5955 | r5956 | |
| 7468 | 7482 | /* Kaneko "Super Nova System" games */ |
| 7469 | 7483 | DRIVER( skns ) |
| 7470 | 7484 | DRIVER( galpani4 ) /* 1996.09 (c) 1996 Kaneko (Japan) */ |
| 7485 | DRIVER( galpani4k ) /* 1996.09 (c) 1996 Kaneko (Korea) */ | |
| 7471 | 7486 | DRIVER( jjparads ) /* 1996.12 (c) 1996 Electro Design Co. (Japan) */ |
| 7472 | 7487 | DRIVER( sarukani ) /* 1997.01 (c) 1997 Kaneko / Mediaworks (Japan) */ |
| 7473 | 7488 | DRIVER( vblokbrk ) /* 1997.?? (c) 1997 Kaneko / Mediaworks (Asia) */ |
| r5955 | r5956 | |
| 7512 | 7527 | DRIVER( calibr50 ) /* UH (c) 1989 + Romstar or Taito license (DSW) */ |
| 7513 | 7528 | DRIVER( arbalest ) /* UK (c) 1989 + Jordan, Romstar or Taito license (DSW) */ |
| 7514 | 7529 | DRIVER( metafox ) /* UP (c) 1989 + Jordan, Romstar or Taito license (DSW) */ |
| 7530 | DRIVER( setaroul ) /* UF (c) 19?? Seta / Visco */ | |
| 7515 | 7531 | DRIVER( drgnunit ) /* (c) 1989 Athena / Seta + Romstar or Taito license (DSW) */ |
| 7516 | 7532 | DRIVER( wits ) /* (c) 1989 Athena (Visco license) */ |
| 7517 | 7533 | DRIVER( thunderl ) /* (c) 1990 Seta + Romstar or Visco license (DSW) */ |
| r5955 | r5956 | |
| 8717 | 8733 | DRIVER( dynadice ) /* ? */ |
| 8718 | 8734 | DRIVER( ssingles ) /* Yachiyo? */ |
| 8719 | 8735 | DRIVER( tcl ) /* (c) 1995 Uniwang */ |
| 8736 | DRIVER( othello ) /* (c) 1984 Success */ | |
| 8720 | 8737 | DRIVER( sothello ) /* (c) 1986 Success / Fujiwara */ |
| 8721 | 8738 | DRIVER( quake ) /* (c) 19?? Lazer-Tron / iD Software */ |
| 8722 | 8739 | |
| r5955 | r5956 | |
| 9077 | 9094 | DRIVER( gstream ) /* (c) 2002, Oriental Soft Japan */ |
| 9078 | 9095 | DRIVER( miniboy7 ) /* (c) 1983, Bonanza Enterprises */ |
| 9079 | 9096 | DRIVER( 39in1 ) /* MAME based bootleg */ |
| 9097 | DRIVER( 48in1 ) /* MAME based bootleg */ | |
| 9098 | DRIVER( 48in1a ) /* MAME based bootleg */ | |
| 9080 | 9099 | DRIVER( kingpin ) /* (c) 1983 American Communications Laboratories Inc. */ |
| 9081 | 9100 | DRIVER( kingpinm ) /* (c) 1983 American Communications Laboratories Inc. */ |
| 9082 | 9101 | DRIVER( thayers ) /* (c) 1983 RDI Video Systems */ |
| r5955 | r5956 | |
|---|---|---|
| 11 | 11 | WRITE8_HANDLER( bublbobl_sound_command_w ); |
| 12 | 12 | WRITE8_HANDLER( bublbobl_sh_nmi_disable_w ); |
| 13 | 13 | WRITE8_HANDLER( bublbobl_sh_nmi_enable_w ); |
| 14 | WRITE8_HANDLER( soundcpu_reset_w ); | |
| 15 | WRITE8_HANDLER( sound_status_w ); | |
| 16 | READ8_HANDLER( sound_status_r ); | |
| 14 | WRITE8_HANDLER( bublbobl_soundcpu_reset_w ); | |
| 15 | WRITE8_HANDLER( bublbobl_sound_status_w ); | |
| 16 | READ8_HANDLER( bublbobl_sound_status_r ); | |
| 17 | 17 | READ8_HANDLER( boblbobl_ic43_a_r ); |
| 18 | 18 | WRITE8_HANDLER( boblbobl_ic43_a_w ); |
| 19 | 19 | READ8_HANDLER( boblbobl_ic43_b_r ); |
| r5955 | r5956 | |
|---|---|---|
| 22 | 22 | /*----------- defined in audio/redbaron.c -----------*/ |
| 23 | 23 | |
| 24 | 24 | WRITE8_HANDLER( redbaron_sounds_w ); |
| 25 | WRITE8_DEVICE_HANDLER( redbaron_pokey_w ); | |
| 26 | 25 | |
| 27 | 26 | DEVICE_GET_INFO( redbaron_sound ); |
| 28 | 27 | #define SOUND_REDBARON DEVICE_GET_INFO_NAME(redbaron_sound) |
| r5955 | r5956 | |
|---|---|---|
| 21 | 21 | /*----------- defined in machine/balsente.c -----------*/ |
| 22 | 22 | |
| 23 | 23 | extern UINT8 balsente_shooter; |
| 24 | extern UINT8 balsente_shooter_x; | |
| 25 | extern UINT8 balsente_shooter_y; | |
| 26 | 24 | extern UINT8 balsente_adc_shift; |
| 27 | 25 | extern UINT16 *shrike_shared; |
| 28 | 26 | extern UINT16 *shrike_io; |
| r5955 | r5956 | |
|---|---|---|
| 165 | 165 | READ16_HANDLER( namcos2_68k_serial_comms_ctrl_r ); |
| 166 | 166 | WRITE16_HANDLER( namcos2_68k_serial_comms_ctrl_w ); |
| 167 | 167 | |
| 168 | extern UINT16 namcos2_68k_serial_comms_ctrl[]; | |
| 169 | 168 | extern UINT16 *namcos2_68k_serial_comms_ram; |
| 170 | 169 | |
| 171 | 170 | /**************************************************************/ |
| r5955 | r5956 | |
| 187 | 186 | #define NAMCOS2_C148_SERIRQ 6 /* 0x1cc000 */ |
| 188 | 187 | #define NAMCOS2_C148_VBLANKIRQ 7 /* 0x1ce000 */ |
| 189 | 188 | |
| 190 | extern UINT16 namcos2_68k_master_C148[]; | |
| 191 | extern UINT16 namcos2_68k_slave_C148[]; | |
| 192 | extern UINT16 namcos2_68k_gpu_C148[]; | |
| 193 | ||
| 194 | 189 | WRITE16_HANDLER( namcos2_68k_master_C148_w ); |
| 195 | 190 | READ16_HANDLER( namcos2_68k_master_C148_r ); |
| 196 | 191 | INTERRUPT_GEN( namcos2_68k_master_vblank ); |
| r5955 | r5956 | |
|---|---|---|
| 1 | /*----------- defined in drivers/namcona1.c -----------*/ | |
| 2 | ||
| 3 | extern int namcona1_gametype; | |
| 4 | ||
| 5 | ||
| 6 | 1 | /*----------- defined in video/namcona1.c -----------*/ |
| 7 | 2 | |
| 8 | 3 | enum |
| r5955 | r5956 | |
|---|---|---|
| 141 | 141 | WRITE8_HANDLER( dkong_videoram_w ); |
| 142 | 142 | |
| 143 | 143 | PALETTE_INIT( dkong2b ); |
| 144 | PALETTE_INIT( dkong4b ); | |
| 145 | 144 | PALETTE_INIT( radarscp ); |
| 146 | 145 | PALETTE_INIT( radarsc1 ); |
| 147 | 146 | PALETTE_INIT( dkong3 ); |
| r5955 | r5956 | |
|---|---|---|
| 130 | 130 | |
| 131 | 131 | extern UINT16 *galpani2_bg8_0, *galpani2_bg8_1; |
| 132 | 132 | extern UINT16 *galpani2_palette_0, *galpani2_palette_1; |
| 133 | extern UINT16 *galpani2_bg8_regs_0, *galpani2_bg8_regs_1; | |
| 134 | 133 | extern UINT16 *galpani2_bg8_0_scrollx, *galpani2_bg8_1_scrollx; |
| 135 | 134 | extern UINT16 *galpani2_bg8_0_scrolly, *galpani2_bg8_1_scrolly; |
| 136 | 135 |
| r5955 | r5956 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | /*----------- defined in machine/system16.c -----------*/ |
| 58 | 58 | |
| 59 | extern UINT16 *sys16_workingram; | |
| 60 | extern UINT16 *sys16_workingram2; | |
| 61 | extern UINT16 *sys16_extraram; | |
| 62 | extern UINT16 *sys16_extraram2; | |
| 63 | extern UINT16 *sys16_extraram3; | |
| 64 | ||
| 65 | 59 | /* sound */ |
| 66 | 60 | extern const upd7759_interface sys16_upd7759_interface; |
| 67 | 61 | |
| r5955 | r5956 | |
| 116 | 110 | extern int sys16_MaxShadowColors; |
| 117 | 111 | |
| 118 | 112 | /* video driver constants (vary with game) */ |
| 119 | extern int sys16_gr_bitmap_width; | |
| 120 | 113 | extern int sys16_sprxoffset; |
| 121 | 114 | extern int sys16_bgxoffset; |
| 122 | 115 | extern int sys16_fgxoffset; |
| r5955 | r5956 | |
| 153 | 146 | extern UINT16 *sys18_splittab_fg_x; |
| 154 | 147 | extern UINT16 *sys18_splittab_fg_y; |
| 155 | 148 | |
| 156 | extern UINT16 *sys16_gr_ver; | |
| 157 | extern UINT16 *sys16_gr_hor; | |
| 158 | extern UINT16 *sys16_gr_pal; | |
| 159 | extern UINT16 *sys16_gr_flip; | |
| 160 | extern int sys16_gr_palette; | |
| 161 | extern int sys16_gr_palette_default; | |
| 162 | extern UINT8 sys16_gr_colorflip[2][4]; | |
| 163 | extern UINT16 *sys16_gr_second_road; | |
| 164 |
| r5955 | r5956 | |
|---|---|---|
| 143 | 143 | WRITE8_DEVICE_HANDLER( clowns_audio_2_w ); |
| 144 | 144 | |
| 145 | 145 | MACHINE_DRIVER_EXTERN( spacwalk_audio ); |
| 146 | WRITE8_HANDLER( spacwalk_audio_1_w ); | |
| 146 | WRITE8_DEVICE_HANDLER( spacwalk_audio_1_w ); | |
| 147 | WRITE8_DEVICE_HANDLER( spacwalk_audio_2_w ); | |
| 147 | 148 | |
| 148 | 149 | MACHINE_DRIVER_EXTERN( shuffle_audio ); |
| 149 | 150 | WRITE8_HANDLER( shuffle_audio_1_w ); |
| r5955 | r5956 | |
|---|---|---|
| 8 | 8 | READ16_HANDLER( qsound_sharedram1_r ); |
| 9 | 9 | WRITE16_HANDLER( qsound_sharedram1_w ); |
| 10 | 10 | |
| 11 | READ16_HANDLER( cps1_eeprom_port_r ); | |
| 12 | WRITE16_HANDLER( cps1_eeprom_port_w ); | |
| 13 | ||
| 14 | INTERRUPT_GEN( cps1_qsound_interrupt ); | |
| 15 | ||
| 16 | 11 | READ16_HANDLER( cps1_dsw_r ); |
| 17 | 12 | WRITE16_HANDLER( cps1_coinctrl_w ); |
| 18 | 13 | INTERRUPT_GEN( cps1_interrupt ); |
| r5955 | r5956 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | /*----------- defined in drivers/snk.c -----------*/ | |
| 8 | ||
| 9 | extern READ8_HANDLER ( snk_cpuA_nmi_trigger_r ); | |
| 10 | extern WRITE8_HANDLER( snk_cpuA_nmi_ack_w ); | |
| 11 | ||
| 12 | extern READ8_HANDLER ( snk_cpuB_nmi_trigger_r ); | |
| 13 | extern WRITE8_HANDLER( snk_cpuB_nmi_ack_w ); | |
| 14 | ||
| 15 | ||
| 16 | 7 | /*----------- defined in video/snk.c -----------*/ |
| 17 | 8 | |
| 18 | 9 | extern PALETTE_INIT( tnk3 ); |
| r5955 | r5956 | |
|---|---|---|
| 1 | 1 | /*----------- defined in drivers/namconb1.c -----------*/ |
| 2 | 2 | |
| 3 | extern UINT32 *namconb1_workram32; | |
| 4 | 3 | extern UINT32 *namconb1_spritebank32; |
| 5 | 4 | extern UINT32 *namconb1_tilebank32; |
| 6 | 5 |
| r5955 | r5956 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | /*----------- defined in drivers/kyugo.c -----------*/ | |
| 8 | ||
| 9 | MACHINE_RESET( kyugo ); | |
| 10 | ||
| 11 | WRITE8_HANDLER( kyugo_sub_cpu_control_w ); | |
| 12 | ||
| 13 | 7 | /*----------- defined in video/kyugo.c -----------*/ |
| 14 | 8 | |
| 15 | 9 | extern UINT8 *kyugo_fgvideoram; |
| r5955 | r5956 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | /* New Code */ |
| 9 | 9 | |
| 10 | extern UINT16 *system24temp_sys16_shared_ram; | |
| 11 | READ16_HANDLER( system24temp_sys16_shared_ram_r ); | |
| 12 | WRITE16_HANDLER( system24temp_sys16_shared_ram_w ); | |
| 13 | ||
| 14 | 10 | void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port), |
| 15 | 11 | void (*io_w)(running_machine *machine, int port, UINT8 data), |
| 16 | 12 | void (*cnt_w)(const address_space *space, UINT8 data), |
| r5955 | r5956 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | READ16_HANDLER( namco_rozcontrol16_r ); |
| 148 | 148 | WRITE16_HANDLER( namco_rozcontrol16_w ); |
| 149 | READ16_HANDLER( namco_rozbank16_r ); | |
| 150 | WRITE16_HANDLER( namco_rozbank16_w ); | |
| 151 | 149 | READ16_HANDLER( namco_rozvideoram16_r ); |
| 152 | 150 | WRITE16_HANDLER( namco_rozvideoram16_w ); |
| 153 | 151 |
| r5955 | r5956 | |
|---|---|---|
| 43 | 43 | VIDEO_UPDATE( taitof2_yesnoj ); |
| 44 | 44 | |
| 45 | 45 | WRITE16_HANDLER( taitof2_spritebank_w ); |
| 46 | READ16_HANDLER ( koshien_spritebank_r ); | |
| 47 | 46 | WRITE16_HANDLER( koshien_spritebank_w ); |
| 48 | 47 | WRITE16_HANDLER( taitof2_sprite_extension_w ); |
| r5955 | r5956 | |
|---|---|---|
| 544 | 544 | extern DEVICE_GET_INFO( snes_sound ); |
| 545 | 545 | #define SOUND_SNES DEVICE_GET_INFO_NAME( snes_sound ) |
| 546 | 546 | |
| 547 | extern STREAM_UPDATE( snes_sh_update ); | |
| 548 | ||
| 549 | 547 | /* Stuff from OpenSPC 0.3.99 by Brad Martin */ |
| 550 | 548 | |
| 551 | 549 | /*========== TYPES ==========*/ |
| r5955 | r5956 | |
|---|---|---|
| 102 | 102 | WRITE8_HANDLER( spyhunt_videoram_w ); |
| 103 | 103 | WRITE8_HANDLER( spyhunt_alpharam_w ); |
| 104 | 104 | |
| 105 | VIDEO_START( mcr3 ); | |
| 106 | 105 | VIDEO_START( mcrmono ); |
| 107 | 106 | VIDEO_START( spyhunt ); |
| 108 | 107 |
| r5955 | r5956 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | #define NAMCOS22_PALETTE_SIZE 0x8000 |
| 31 | 31 | |
| 32 | /*----------- defined in drivers/namcos22.c -----------*/ | |
| 33 | ||
| 34 | extern const gfx_layout namcos22_cg_layout; | |
| 35 | ||
| 36 | 32 | /*----------- defined in video/namcos22.c -----------*/ |
| 37 | 33 | |
| 38 | 34 | extern UINT32 *namcos22_cgram; |
| r5955 | r5956 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | /*----------- defined in machine/archimds.c -----------*/ |
| 38 | 38 | |
| 39 | extern UINT32 *memc_physmem; | |
| 39 | extern UINT32 *archimedes_memc_physmem; | |
| 40 | 40 | |
| 41 | 41 | void archimedes_init(running_machine *machine); // call at MACHINE_INIT |
| 42 | 42 | void archimedes_reset(running_machine *machine); // call at MACHINE_RESET |
| r5955 | r5956 | |
| 49 | 49 | void archimedes_clear_irq_b(running_machine *machine, int mask); |
| 50 | 50 | void archimedes_clear_fiq(running_machine *machine, int mask); |
| 51 | 51 | |
| 52 | extern READ32_HANDLER(memc_logical_r); | |
| 53 | extern WRITE32_HANDLER(memc_logical_w); | |
| 54 | extern READ32_HANDLER(memc_r); | |
| 55 | extern WRITE32_HANDLER(memc_w); | |
| 56 | extern WRITE32_HANDLER(memc_page_w); | |
| 57 | extern READ32_HANDLER(ioc_r); | |
| 58 | extern WRITE32_HANDLER(ioc_w); | |
| 59 | extern READ32_HANDLER(vidc_r); | |
| 60 | extern WRITE32_HANDLER(vidc_w); | |
| 52 | extern READ32_HANDLER(archimedes_memc_logical_r); | |
| 53 | extern WRITE32_HANDLER(archimedes_memc_logical_w); | |
| 54 | extern READ32_HANDLER(archimedes_memc_r); | |
| 55 | extern WRITE32_HANDLER(archimedes_memc_w); | |
| 56 | extern WRITE32_HANDLER(archimedes_memc_page_w); | |
| 57 | extern READ32_HANDLER(archimedes_ioc_r); | |
| 58 | extern WRITE32_HANDLER(archimedes_ioc_w); | |
| 59 | extern READ32_HANDLER(archimedes_vidc_r); | |
| 60 | extern WRITE32_HANDLER(archimedes_vidc_w); | |
| 61 | 61 | |
| 62 | 62 | #endif // _ARCHIMEDES_H_ |
| r5955 | r5956 | |
|---|---|---|
| 70 | 70 | VIDEO_START( batman2 ); |
| 71 | 71 | VIDEO_START( dkongjrm ); |
| 72 | 72 | VIDEO_START( scrambold ); |
| 73 | VIDEO_START( theend ); | |
| 74 | 73 | VIDEO_START( darkplnt ); |
| 75 | 74 | VIDEO_START( rescue ); |
| 76 | 75 | VIDEO_START( minefld ); |
| r5955 | r5956 | |
| 95 | 94 | WRITE8_HANDLER( galaxold_gfxbank_w ); |
| 96 | 95 | WRITE8_HANDLER( galaxold_flip_screen_x_w ); |
| 97 | 96 | WRITE8_HANDLER( galaxold_flip_screen_y_w ); |
| 98 | WRITE8_HANDLER( gteikob2_flip_screen_x_w ); | |
| 99 | WRITE8_HANDLER( gteikob2_flip_screen_y_w ); | |
| 100 | 97 | |
| 101 | 98 | |
| 102 | 99 | /*----------- defined in machine/galaxold.c -----------*/ |
| 103 | 100 | |
| 104 | DRIVER_INIT( zigzag ); | |
| 105 | DRIVER_INIT( pisces ); | |
| 106 | DRIVER_INIT( checkmaj ); | |
| 107 | DRIVER_INIT( dingo ); | |
| 108 | DRIVER_INIT( dingoe ); | |
| 109 | DRIVER_INIT( mooncrsu ); | |
| 110 | DRIVER_INIT( mooncrst ); | |
| 111 | DRIVER_INIT( mooncrgx ); | |
| 112 | DRIVER_INIT( moonqsr ); | |
| 113 | DRIVER_INIT( checkman ); | |
| 114 | 101 | DRIVER_INIT( 4in1 ); |
| 115 | 102 | DRIVER_INIT( ladybugg ); |
| 116 | 103 | |
| r5955 | r5956 | |
| 132 | 119 | WRITE8_HANDLER( _4in1_bank_w ); |
| 133 | 120 | CUSTOM_INPUT( _4in1_fake_port_r ); |
| 134 | 121 | |
| 135 | WRITE8_HANDLER( zigzag_sillyprotection_w ); | |
| 136 | ||
| 137 | 122 | INTERRUPT_GEN( hunchbks_vh_interrupt ); |
| 138 | 123 | |
| 139 | 124 | |
| r5955 | r5956 | |
| 147 | 132 | |
| 148 | 133 | |
| 149 | 134 | DRIVER_INIT( scramble_ppi ); |
| 150 | DRIVER_INIT( scobra ); | |
| 151 | DRIVER_INIT( atlantis ); | |
| 152 | DRIVER_INIT( scramble ); | |
| 153 | 135 | DRIVER_INIT( stratgyx ); |
| 154 | 136 | DRIVER_INIT( tazmani2 ); |
| 155 | 137 | DRIVER_INIT( ckongs ); |
| 156 | 138 | DRIVER_INIT( mariner ); |
| 157 | DRIVER_INIT( frogger ); | |
| 158 | DRIVER_INIT( froggers ); | |
| 159 | 139 | DRIVER_INIT( devilfsh ); |
| 160 | 140 | DRIVER_INIT( mars ); |
| 161 | 141 | DRIVER_INIT( hotshock ); |
| r5955 | r5956 | |
| 164 | 144 | DRIVER_INIT( mimonkey ); |
| 165 | 145 | DRIVER_INIT( mimonsco ); |
| 166 | 146 | DRIVER_INIT( mimonscr ); |
| 167 | DRIVER_INIT( anteater ); | |
| 168 | 147 | DRIVER_INIT( rescue ); |
| 169 | 148 | DRIVER_INIT( minefld ); |
| 170 | DRIVER_INIT( losttomb ); | |
| 171 | 149 | DRIVER_INIT( hustler ); |
| 172 | 150 | DRIVER_INIT( billiard ); |
| 173 | 151 | DRIVER_INIT( mrkougar ); |
| r5955 | r5956 | |
| 200 | 178 | |
| 201 | 179 | WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w ); |
| 202 | 180 | WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w ); |
| 203 | WRITE8_HANDLER( froggrmc_sh_irqtrigger_w ); | |
| 204 | 181 | WRITE8_HANDLER( hotshock_sh_irqtrigger_w ); |
| 205 | 182 | |
| 206 | 183 | MACHINE_DRIVER_EXTERN( ad2083_audio ); |
| r5955 | r5956 | |
|---|---|---|
| 1 | #include "sound/discrete.h" | |
| 2 | ||
| 1 | 3 | /*----------- defined in drivers/sprint8.c -----------*/ |
| 2 | 4 | |
| 3 | 5 | void sprint8_set_collision(running_machine *machine, int n); |
| r5955 | r5956 | |
| 17 | 19 | VIDEO_UPDATE( sprint8 ); |
| 18 | 20 | |
| 19 | 21 | WRITE8_HANDLER( sprint8_video_ram_w ); |
| 22 | ||
| 23 | ||
| 24 | /*----------- defined in audio/sprint8.c -----------*/ | |
| 25 | ||
| 26 | DISCRETE_SOUND_EXTERN( sprint8 ); | |
| 27 | ||
| 28 | WRITE8_DEVICE_HANDLER( sprint8_crash_w ); | |
| 29 | WRITE8_DEVICE_HANDLER( sprint8_screech_w ); | |
| 30 | WRITE8_DEVICE_HANDLER( sprint8_attract_w ); | |
| 31 | WRITE8_DEVICE_HANDLER( sprint8_motor_w ); |
| r5955 | r5956 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | /*----------- defined in drivers/cloud9.c -----------*/ | |
| 8 | ||
| 9 | extern int cloud9_vblank_start; | |
| 10 | extern int cloud9_vblank_end; | |
| 11 | ||
| 12 | ||
| 13 | 7 | /*----------- defined in video/cloud9.c -----------*/ |
| 14 | 8 | |
| 15 | 9 | VIDEO_START( cloud9 ); |
| r5955 | r5956 | |
|---|---|---|
| 433 | 433 | $(DRIVERS)/skyraid.o $(AUDIO)/skyraid.o $(VIDEO)/skyraid.o \ |
| 434 | 434 | $(DRIVERS)/sprint2.o $(AUDIO)/sprint2.o $(VIDEO)/sprint2.o \ |
| 435 | 435 | $(DRIVERS)/sprint4.o $(VIDEO)/sprint4.o $(AUDIO)/sprint4.o \ |
| 436 | $(DRIVERS)/sprint8.o $(VIDEO)/sprint8.o \ | |
| 436 | $(DRIVERS)/sprint8.o $(AUDIO)/sprint8.o $(VIDEO)/sprint8.o \ | |
| 437 | 437 | $(DRIVERS)/starshp1.o $(AUDIO)/starshp1.o $(VIDEO)/starshp1.o \ |
| 438 | 438 | $(DRIVERS)/starwars.o $(MACHINE)/starwars.o $(AUDIO)/starwars.o \ |
| 439 | 439 | $(DRIVERS)/subs.o $(MACHINE)/subs.o $(AUDIO)/subs.o $(VIDEO)/subs.o \ |
| r5955 | r5956 | |
| 1128 | 1128 | $(DRIVERS)/segas18.o $(VIDEO)/segas18.o \ |
| 1129 | 1129 | $(DRIVERS)/segas24.o $(MACHINE)/segas24.o $(VIDEO)/segas24.o \ |
| 1130 | 1130 | $(DRIVERS)/segas32.o $(MACHINE)/segas32.o $(VIDEO)/segas32.o \ |
| 1131 | $(DRIVERS)/sega | |
| 1131 | $(DRIVERS)/segamsys.o $( | |
| 1132 | 1132 | $(DRIVERS)/segaxbd.o $(VIDEO)/segaxbd.o \ |
| 1133 | 1133 | $(DRIVERS)/segaybd.o $(VIDEO)/segaybd.o \ |
| 1134 | 1134 | $(DRIVERS)/ssf2md.o \ |
| r5955 | r5956 | |
| 1575 | 1575 | $(DRIVERS)/norautp.o $(AUDIO)/norautp.o \ |
| 1576 | 1576 | $(DRIVERS)/oneshot.o $(VIDEO)/oneshot.o \ |
| 1577 | 1577 | $(DRIVERS)/onetwo.o \ |
| 1578 | $(DRIVERS)/othello.o \ | |
| 1578 | 1579 | $(DRIVERS)/othldrby.o $(VIDEO)/othldrby.o \ |
| 1579 | 1580 | $(DRIVERS)/pachifev.o \ |
| 1580 | 1581 | $(DRIVERS)/pangofun.o \ |
| r5955 | r5956 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | UINT16 *galpani2_bg8_0, *galpani2_bg8_1; |
| 27 | 27 | UINT16 *galpani2_palette_0, *galpani2_palette_1; |
| 28 | UINT16 *galpani2_bg8_regs_0, *galpani2_bg8_regs_1; | |
| 28 | //UINT16 *galpani2_bg8_regs_0, *galpani2_bg8_regs_1; | |
| 29 | 29 | UINT16 *galpani2_bg8_0_scrollx, *galpani2_bg8_1_scrollx; |
| 30 | 30 | UINT16 *galpani2_bg8_0_scrolly, *galpani2_bg8_1_scrolly; |
| 31 | 31 | |
| 32 | 32 | static bitmap_t *galpani2_bg8_bitmap_0, *galpani2_bg8_bitmap_1; |
| 33 | 33 | |
| 34 | #ifdef UNUSED_DEFINITION | |
| 34 | 35 | #define galpani2_BG8_REGS_R( _n_ ) \ |
| 35 | 36 | READ16_HANDLER( galpani2_bg8_regs_##_n_##_r ) \ |
| 36 | 37 | { \ |
| r5955 | r5956 | |
| 55 | 56 | { \ |
| 56 | 57 | COMBINE_DATA(&galpani2_bg8_regs_##_n_[offset]); \ |
| 57 | 58 | } |
| 59 | #endif | |
| 58 | 60 | |
| 59 | 61 | #define galpani2_BG8_W( _n_ ) \ |
| 60 | 62 | WRITE16_HANDLER( galpani2_bg8_##_n_##_w ) \ |
| r5955 | r5956 | |
| 74 | 76 | palette_set_color_rgb( space->machine, offset + 0x4000 + _n_ * 0x100, pal5bit(newword >> 5), pal5bit(newword >> 10), pal5bit(newword >> 0) ); \ |
| 75 | 77 | } |
| 76 | 78 | |
| 79 | #ifdef UNUSED_FUNCTION | |
| 77 | 80 | galpani2_BG8_REGS_R( 0 ) |
| 78 | 81 | galpani2_BG8_REGS_R( 1 ) |
| 79 | 82 | |
| 80 | 83 | galpani2_BG8_REGS_W( 0 ) |
| 81 | 84 | galpani2_BG8_REGS_W( 1 ) |
| 85 | #endif | |
| 82 | 86 | |
| 83 | 87 | galpani2_BG8_W( 0 ) |
| 84 | 88 | galpani2_BG8_W( 1 ) |
| r5955 | r5956 | |
|---|---|---|
| 228 | 228 | free(rgb); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | #ifdef UNUSED_FUNCTION | |
| 231 | 232 | PALETTE_INIT( dkong4b ) |
| 232 | 233 | { |
| 233 | 234 | dkong_state *state = (dkong_state *)machine->driver_data; |
| r5955 | r5956 | |
| 265 | 266 | /* color_prom now points to the beginning of the character color codes */ |
| 266 | 267 | state->color_codes = color_prom; /* we'll need it later */ |
| 267 | 268 | } |
| 269 | #endif | |
| 268 | 270 | |
| 269 | 271 | PALETTE_INIT( radarscp ) |
| 270 | 272 | { |
| r5955 | r5956 | |
|---|---|---|
| 145 | 145 | int sys16_MaxShadowColors; |
| 146 | 146 | |
| 147 | 147 | /* video driver constants (potentially different for each game) */ |
| 148 | int sys16_gr_bitmap_width; | |
| 149 | ||
| 150 | 148 | const int *sys16_obj_bank; |
| 151 | 149 | int sys16_sprxoffset; |
| 152 | 150 | int sys16_bgxoffset; |
| r5955 | r5956 | |
| 185 | 183 | UINT16 *sys18_splittab_fg_x; |
| 186 | 184 | UINT16 *sys18_splittab_fg_y; |
| 187 | 185 | |
| 188 | UINT16 *sys16_gr_ver; | |
| 189 | UINT16 *sys16_gr_hor; | |
| 190 | UINT16 *sys16_gr_pal; | |
| 191 | UINT16 *sys16_gr_flip; | |
| 192 | int sys16_gr_palette; | |
| 193 | int sys16_gr_palette_default; | |
| 194 | UINT8 sys16_gr_colorflip[2][4]; | |
| 195 | UINT16 *sys16_gr_second_road; | |
| 196 | ||
| 197 | 186 | static tilemap *background, *foreground, *text_layer; |
| 198 | 187 | static tilemap *background2, *foreground2; |
| 199 | 188 | static int old_bg_page[4],old_fg_page[4], old_tile_bank1, old_tile_bank0; |
| r5955 | r5956 | |
|---|---|---|
| 42 | 42 | * |
| 43 | 43 | *************************************/ |
| 44 | 44 | |
| 45 | #ifdef UNUSED_FUNCTION | |
| 45 | 46 | static TILE_GET_INFO( get_bg_tile_info ) |
| 46 | 47 | { |
| 47 | 48 | int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8); |
| r5955 | r5956 | |
| 49 | 50 | int color = (data >> 12) & 3; |
| 50 | 51 | SET_TILE_INFO(0, code, color, TILE_FLIPYX((data >> 10) & 3)); |
| 51 | 52 | } |
| 53 | #endif | |
| 52 | 54 | |
| 53 | 55 | |
| 54 | 56 | static TILE_GET_INFO( mcrmono_get_bg_tile_info ) |
| r5955 | r5956 | |
| 105 | 107 | * |
| 106 | 108 | *************************************/ |
| 107 | 109 | |
| 110 | #ifdef UNUSED_FUNCTION | |
| 108 | 111 | VIDEO_START( mcr3 ) |
| 109 | 112 | { |
| 110 | 113 | /* initialize the background tilemap */ |
| 111 | 114 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16,16, 32,30); |
| 112 | 115 | } |
| 116 | #endif | |
| 113 | 117 | |
| 114 | 118 | |
| 115 | 119 | VIDEO_START( mcrmono ) |
| r5955 | r5956 | |
|---|---|---|
| 1291 | 1291 | {"sf2j", CPS_B_13, mapper_STF29, 0x36 }, |
| 1292 | 1292 | {"sf2ja", CPS_B_17, mapper_STF29, 0x36 }, |
| 1293 | 1293 | {"sf2jc", CPS_B_12, mapper_STF29, 0x36 }, |
| 1294 | {"sf2qp1", CPS_B_17, mapper_STF29, 0x36 }, | |
| 1294 | 1295 | /* from here onwards the CPS-B board has suicide battery and multiply protection */ |
| 1295 | 1296 | {"3wonders", CPS_B_21_BT1, mapper_RT24B }, |
| 1296 | 1297 | {"3wondersu",CPS_B_21_BT1, mapper_RT24B }, |
| r5955 | r5956 | |
| 1318 | 1319 | {"sf2rb3", CPS_B_21_DEF, mapper_S9263B, 0x36 }, |
| 1319 | 1320 | {"sf2red", CPS_B_21_DEF, mapper_S9263B, 0x36 }, |
| 1320 | 1321 | {"sf2v004", CPS_B_21_DEF, mapper_S9263B, 0x36 }, |
| 1322 | {"sf2acc", CPS_B_21_DEF, mapper_S9263B, 0x36 }, | |
| 1321 | 1323 | {"sf2accp2", CPS_B_21_DEF, mapper_S9263B, 0x36 }, |
| 1322 | 1324 | {"sf2m1", CPS_B_21_DEF, mapper_S9263B, 0x36 }, |
| 1323 | 1325 | {"sf2m2", CPS_B_21_DEF, mapper_S9263B, 0x36, 0, 0, 1 }, |
| r5955 | r5956 | |
|---|---|---|
| 93 | 93 | static void (*draw_stars)(running_machine *machine, bitmap_t *, const rectangle *); /* function to call to draw the star layer */ |
| 94 | 94 | static void noop_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 95 | 95 | void galaxold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 96 | static void scrambl | |
| 96 | static void scrambold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 97 | 97 | static void rescue_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 98 | 98 | static void mariner_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 99 | 99 | static void start_stars_blink_timer(double ra, double rb, double c); |
| r5955 | r5956 | |
| 103 | 103 | static UINT8 darkplnt_bullet_color; |
| 104 | 104 | static void (*draw_bullets)(running_machine *,bitmap_t *,const rectangle *,int,int,int); /* function to call to draw a bullet */ |
| 105 | 105 | static void galaxold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 106 | static void scrambl | |
| 106 | static void scrambold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); | |
| 107 | 107 | static void darkplnt_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 108 | 108 | static void dambustr_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); |
| 109 | 109 | |
| r5955 | r5956 | |
| 112 | 112 | static UINT8 background_red, background_green, background_blue; |
| 113 | 113 | static void (*draw_background)(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); /* function to call to draw the background */ |
| 114 | 114 | static void galaxold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 115 | static void scramble_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 116 | static void turtles_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 115 | static void scrambold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 116 | static void ad2083_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 117 | 117 | static void mariner_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 118 | 118 | static void stratgyx_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 119 | 119 | static void minefld_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| r5955 | r5956 | |
| 575 | 575 | */ |
| 576 | 576 | tilemap_set_scrolldx(bg_tilemap, 0, 0); |
| 577 | 577 | |
| 578 | draw_stars = scrambl | |
| 578 | draw_stars = scrambold_draw_stars; | |
| 579 | 579 | |
| 580 | draw_bullets = scrambl | |
| 580 | draw_bullets = scrambold_draw_bullets; | |
| 581 | 581 | |
| 582 | draw_background = scrambl | |
| 582 | draw_background = scrambold_draw_background; | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | VIDEO_START( darkplnt ) |
| r5955 | r5956 | |
| 628 | 628 | |
| 629 | 629 | draw_stars = mariner_draw_stars; |
| 630 | 630 | |
| 631 | draw_bullets = scrambl | |
| 631 | draw_bullets = scrambold_draw_bullets; | |
| 632 | 632 | |
| 633 | 633 | draw_background = mariner_draw_background; |
| 634 | 634 | |
| r5955 | r5956 | |
| 681 | 681 | modify_spritecode = pisces_modify_spritecode; |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | #ifdef UNUSED_FUNCTION | |
| 684 | 685 | static void theend_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) |
| 685 | 686 | { |
| 686 | 687 | int i; |
| r5955 | r5956 | |
| 702 | 703 | |
| 703 | 704 | draw_bullets = theend_draw_bullets; |
| 704 | 705 | } |
| 706 | #endif | |
| 705 | 707 | |
| 706 | 708 | static void mooncrst_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 707 | 709 | { |
| r5955 | r5956 | |
| 826 | 828 | |
| 827 | 829 | mooncrst_gfxextend = 0; |
| 828 | 830 | |
| 829 | draw_bullets = scrambl | |
| 831 | draw_bullets = scrambold_draw_bullets; | |
| 830 | 832 | |
| 831 | draw_background = | |
| 833 | draw_background = ad2083 | |
| 832 | 834 | background_enable = 0; |
| 833 | 835 | background_blue = 0; |
| 834 | 836 | background_red = 0; |
| r5955 | r5956 | |
| 1022 | 1024 | } |
| 1023 | 1025 | |
| 1024 | 1026 | |
| 1027 | #ifdef UNUSED_FUNCTION | |
| 1025 | 1028 | WRITE8_HANDLER( gteikob2_flip_screen_x_w ) |
| 1026 | 1029 | { |
| 1027 | 1030 | galaxold_flip_screen_x_w(space, offset, ~data); |
| r5955 | r5956 | |
| 1031 | 1034 | { |
| 1032 | 1035 | galaxold_flip_screen_y_w(space, offset, ~data); |
| 1033 | 1036 | } |
| 1037 | #endif | |
| 1034 | 1038 | |
| 1035 | 1039 | |
| 1036 | 1040 | WRITE8_HANDLER( hotshock_flip_screen_w ) |
| r5955 | r5956 | |
| 1251 | 1255 | } |
| 1252 | 1256 | } |
| 1253 | 1257 | |
| 1254 | static void scrambl | |
| 1258 | static void scrambold_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) | |
| 1255 | 1259 | { |
| 1256 | 1260 | if (flipscreen_x) x++; |
| 1257 | 1261 | |
| r5955 | r5956 | |
| 1308 | 1312 | bitmap_fill(bitmap,cliprect,0); |
| 1309 | 1313 | } |
| 1310 | 1314 | |
| 1311 | static void scrambl | |
| 1315 | static void scrambold_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) | |
| 1312 | 1316 | { |
| 1313 | 1317 | if (background_enable) |
| 1314 | 1318 | bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE); |
| r5955 | r5956 | |
| 1316 | 1320 | bitmap_fill(bitmap,cliprect,0); |
| 1317 | 1321 | } |
| 1318 | 1322 | |
| 1319 | static void | |
| 1323 | static void ad2083 | |
| 1320 | 1324 | { |
| 1321 | 1325 | int color = (background_blue << 2) | (background_green << 1) | background_red; |
| 1322 | 1326 | |
| r5955 | r5956 | |
| 1600 | 1604 | } |
| 1601 | 1605 | } |
| 1602 | 1606 | |
| 1603 | static void scrambl | |
| 1607 | static void scrambold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) | |
| 1604 | 1608 | { |
| 1605 | 1609 | int offs; |
| 1606 | 1610 |
| r5955 | r5956 | |
|---|---|---|
| 13 | 13 | /* TTL text plane stuff */ |
| 14 | 14 | |
| 15 | 15 | static int ttl_gfx_index; |
| 16 | static tilemap *ttl_tilemap; | |
| 17 | static UINT16 ttl_vram[0x800]; | |
| 16 | static tilemap *ttl_tilemap, *roz_tilemap; | |
| 17 | static UINT16 ttl_vram[0x800], roz_vram[0x800]; | |
| 18 | 18 | |
| 19 | 19 | /* TTL text plane */ |
| 20 | 20 | |
| r5955 | r5956 | |
| 29 | 29 | SET_TILE_INFO(ttl_gfx_index, code, attr, 0); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | static TILE_GET_INFO( roz_get_tile_info ) | |
| 33 | { | |
| 34 | int attr, code; | |
| 35 | ||
| 36 | attr = (roz_vram[tile_index] >> 12) + 16; // roz base palette is palette 16 | |
| 37 | code = roz_vram[tile_index] & 0x3ff; | |
| 38 | ||
| 39 | SET_TILE_INFO(0, code, attr, 0); | |
| 40 | } | |
| 41 | ||
| 32 | 42 | READ32_HANDLER( polygonet_ttl_ram_r ) |
| 33 | 43 | { |
| 34 | 44 | UINT32 *vram = (UINT32 *)ttl_vram; |
| r5955 | r5956 | |
| 46 | 56 | tilemap_mark_tile_dirty(ttl_tilemap, offset*2+1); |
| 47 | 57 | } |
| 48 | 58 | |
| 59 | READ32_HANDLER( polygonet_roz_ram_r ) | |
| 60 | { | |
| 61 | UINT32 *vram = (UINT32 *)roz_vram; | |
| 62 | ||
| 63 | return(vram[offset]); | |
| 64 | } | |
| 65 | ||
| 66 | WRITE32_HANDLER( polygonet_roz_ram_w ) | |
| 67 | { | |
| 68 | UINT32 *vram = (UINT32 *)roz_vram; | |
| 69 | ||
| 70 | COMBINE_DATA(&vram[offset]); | |
| 71 | ||
| 72 | tilemap_mark_tile_dirty(roz_tilemap, offset*2); | |
| 73 | tilemap_mark_tile_dirty(roz_tilemap, offset*2+1); | |
| 74 | } | |
| 75 | ||
| 49 | 76 | static TILEMAP_MAPPER( plygonet_scan ) |
| 50 | 77 | { |
| 51 | 78 | return row * num_cols + (col^1); |
| 52 | 79 | } |
| 53 | 80 | |
| 81 | static TILEMAP_MAPPER( plygonet_scan_cols ) | |
| 82 | { | |
| 83 | return col * num_rows + (row^1); | |
| 84 | } | |
| 85 | ||
| 54 | 86 | VIDEO_START( polygonet ) |
| 55 | 87 | { |
| 56 | 88 | static const gfx_layout charlayout = |
| r5955 | r5956 | |
| 80 | 112 | tilemap_set_transparent_pen(ttl_tilemap, 0); |
| 81 | 113 | |
| 82 | 114 | state_save_register_global_array(machine, ttl_vram); |
| 115 | ||
| 116 | // set up the roz t-map too | |
| 117 | roz_tilemap = tilemap_create(machine, roz_get_tile_info, plygonet_scan_cols, 16, 16, 32, 64); | |
| 118 | tilemap_set_transparent_pen(roz_tilemap, 0); | |
| 83 | 119 | } |
| 84 | 120 | |
| 85 | 121 | VIDEO_UPDATE( polygonet ) |
| r5955 | r5956 | |
| 87 | 123 | bitmap_fill(screen->machine->priority_bitmap, NULL, 0); |
| 88 | 124 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 89 | 125 | |
| 126 | K053936_0_zoom_draw(bitmap, cliprect, roz_tilemap, 0, 0, 0); | |
| 127 | ||
| 90 | 128 | tilemap_draw(bitmap, cliprect, ttl_tilemap, 0, 1<<0); |
| 91 | 129 | return 0; |
| 92 | 130 | } |
| r5955 | r5956 | |
|---|---|---|
| 97 | 97 | #include "video/resnet.h" |
| 98 | 98 | |
| 99 | 99 | |
| 100 | UINT8 *fg_videoram, *fg_colorram, *bg_videoram, *bg_colorram; | |
| 100 | UINT8 *lucky74_fg_videoram, *lucky74_fg_colorram, *lucky74_bg_videoram, *lucky74_bg_colorram; | |
| 101 | 101 | static tilemap *fg_tilemap, *bg_tilemap; |
| 102 | 102 | |
| 103 | 103 | |
| 104 | WRITE8_HANDLER( fg_videoram_w ) | |
| 104 | WRITE8_HANDLER( lucky74_fg_videoram_w ) | |
| 105 | 105 | { |
| 106 | fg_videoram[offset] = data; | |
| 106 | lucky74_fg_videoram[offset] = data; | |
| 107 | 107 | tilemap_mark_tile_dirty(fg_tilemap, offset); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | WRITE8_HANDLER( fg_colorram_w ) | |
| 110 | WRITE8_HANDLER( lucky74_fg_colorram_w ) | |
| 111 | 111 | { |
| 112 | fg_colorram[offset] = data; | |
| 112 | lucky74_fg_colorram[offset] = data; | |
| 113 | 113 | tilemap_mark_tile_dirty(fg_tilemap, offset); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | WRITE8_HANDLER( bg_videoram_w ) | |
| 116 | WRITE8_HANDLER( lucky74_bg_videoram_w ) | |
| 117 | 117 | { |
| 118 | bg_videoram[offset] = data; | |
| 118 | lucky74_bg_videoram[offset] = data; | |
| 119 | 119 | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | WRITE8_HANDLER( bg_colorram_w ) | |
| 122 | WRITE8_HANDLER( lucky74_bg_colorram_w ) | |
| 123 | 123 | { |
| 124 | bg_colorram[offset] = data; | |
| 124 | lucky74_bg_colorram[offset] = data; | |
| 125 | 125 | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 126 | 126 | } |
| 127 | 127 | |
| r5955 | r5956 | |
| 206 | 206 | xxxx ---- tiles page offset. |
| 207 | 207 | */ |
| 208 | 208 | int bank = 0; |
| 209 | int attr = fg_colorram[tile_index]; | |
| 210 | int code = fg_videoram[tile_index] + ((attr & 0xf0) << 4); | |
| 209 | int attr = lucky74_fg_colorram[tile_index]; | |
| 210 | int code = lucky74_fg_videoram[tile_index] + ((attr & 0xf0) << 4); | |
| 211 | 211 | int color = (attr & 0x0f); |
| 212 | 212 | |
| 213 | 213 | SET_TILE_INFO(bank, code, color, 0); |
| r5955 | r5956 | |
| 221 | 221 | xxxx ---- tiles page offset. |
| 222 | 222 | */ |
| 223 | 223 | int bank = 1; |
| 224 | int attr = bg_colorram[tile_index]; | |
| 225 | int code = bg_videoram[tile_index] + ((attr & 0xf0) << 4); | |
| 224 | int attr = lucky74_bg_colorram[tile_index]; | |
| 225 | int code = lucky74_bg_videoram[tile_index] + ((attr & 0xf0) << 4); | |
| 226 | 226 | int color = (attr & 0x0f); |
| 227 | 227 | |
| 228 | 228 | SET_TILE_INFO(bank, code, color, 0); |
| r5955 | r5956 | |
|---|---|---|
| 43 | 43 | static UINT16 spritebank[8]; |
| 44 | 44 | //static UINT16 spritebank_eof[8]; |
| 45 | 45 | static UINT16 spritebank_buffered[8]; |
| 46 | static UINT16 koshien_spritebank; | |
| 47 | 46 | |
| 48 | 47 | static INT32 sprites_disabled,sprites_active_area,sprites_master_scrollx,sprites_master_scrolly; |
| 49 | 48 | /* remember flip status over frames because driftout can fail to set it */ |
| r5955 | r5956 | |
| 134 | 133 | state_save_register_global(machine, f2_hide_pixels); |
| 135 | 134 | state_save_register_global(machine, f2_sprite_type); |
| 136 | 135 | state_save_register_global_array(machine, spritebank); |
| 137 | state_save_register_global(machine, koshien_spritebank); | |
| 138 | 136 | state_save_register_global(machine, sprites_disabled); |
| 139 | 137 | state_save_register_global(machine, sprites_active_area); |
| 140 | 138 | state_save_register_global_pointer(machine, spriteram_delayed, spriteram_size/2); |
| r5955 | r5956 | |
| 347 | 345 | |
| 348 | 346 | } |
| 349 | 347 | |
| 350 | READ16_HANDLER( koshien_spritebank_r ) | |
| 351 | { | |
| 352 | return koshien_spritebank; | |
| 353 | } | |
| 354 | ||
| 355 | 348 | WRITE16_HANDLER( koshien_spritebank_w ) |
| 356 | 349 | { |
| 357 | koshien_spritebank = data; | |
| 358 | ||
| 359 | 350 | spritebank_buffered[0]=0x0000; /* never changes */ |
| 360 | 351 | spritebank_buffered[1]=0x0400; |
| 361 | 352 |
| r5955 | r5956 | |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | Sega System E (834-5803) Driver (video/segasyse.c) | |
| 3 | ******************************************************************************** | |
| 4 | driver by David Haywood | |
| 5 | 1 | |
| 6 | this is currently only used by megaplay, and will soon be obsolete. | |
| 7 | 2 | |
| 8 | *******************************************************************************/ | |
| 9 | ||
| 10 | #include "driver.h" | |
| 11 | ||
| 12 | /*-- Variables --*/ | |
| 13 | ||
| 14 | #define CHIPS 2 /* There are 2 VDP Chips */ | |
| 15 | ||
| 16 | static UINT8 vdp_cmdpart[CHIPS]; /* VDP Command Part Counter */ | |
| 17 | static UINT16 vdp_command[CHIPS]; /* VDP Command Word */ | |
| 18 | ||
| 19 | static UINT8 vdp_accessmode[CHIPS]; /* VDP Access Mode (VRAM, CRAM) */ | |
| 20 | static UINT16 vdp_accessaddr[CHIPS]; /* VDP Access Address */ | |
| 21 | static UINT8 vdp_readbuffer[CHIPS]; /* VDP Read Buffer */ | |
| 22 | ||
| 23 | static UINT8 *segae_vdp_vram[CHIPS]; /* Pointer to VRAM */ | |
| 24 | static UINT8 *vdp_cram[CHIPS]; /* Pointer to the VDP's CRAM */ | |
| 25 | UINT8 *segae_vdp_regs[CHIPS]; /* Pointer to the VDP's Registers */ | |
| 26 | ||
| 27 | static UINT8 segae_vdp_vrambank[CHIPS]; /* Current VRAM Bank number (from writes to Port 0xf7) */ | |
| 28 | ||
| 29 | static UINT8 *cache_bitmap; /* 8bpp bitmap with raw pen values */ | |
| 30 | ||
| 31 | static int palette_base; // needed for megatech for now.. | |
| 32 | ||
| 33 | UINT8 segae_vintpending; | |
| 34 | UINT8 segae_hintpending; | |
| 35 | ||
| 36 | /*-- Prototypes --*/ | |
| 37 | ||
| 38 | static void vdp_start(running_machine *machine, UINT8 chip ); | |
| 39 | ||
| 40 | static void vdp_processcmd(UINT8 chip, UINT16 cmd); | |
| 41 | static void vdp_setregister(UINT8 chip, UINT16 cmd); | |
| 42 | ||
| 43 | static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri); | |
| 44 | static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line); | |
| 45 | static void segae_drawscanline(running_machine *machine, int line, int chips, int blank); | |
| 46 | ||
| 47 | static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); | |
| 48 | static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); | |
| 49 | static void draw_8pix_sprite(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line); | |
| 50 | ||
| 51 | /******************************************************************************* | |
| 52 | vhstart, vhstop and vhrefresh functions | |
| 53 | *******************************************************************************/ | |
| 54 | ||
| 55 | /* starts vdp for bios screen only */ | |
| 56 | VIDEO_START( megaplay_normal ) | |
| 57 | { | |
| 58 | palette_base = 0x40; | |
| 59 | ||
| 60 | vdp_start(machine, 0); | |
| 61 | ||
| 62 | cache_bitmap = auto_alloc_array(machine, UINT8, (16+256+16) * 192); /* 16 pixels either side to simplify drawing */ | |
| 63 | } | |
| 64 | ||
| 65 | VIDEO_UPDATE( megaplay_normal ) | |
| 66 | { | |
| 67 | int miny = (cliprect->min_y < 16) ? 16 : cliprect->min_y; | |
| 68 | int maxy = (cliprect->max_y > 16+192-1) ? 16+192-1 : cliprect->max_y; | |
| 69 | int i; | |
| 70 | ||
| 71 | /*- Draw from cache_bitmap to screen -*/ | |
| 72 | ||
| 73 | for (i = miny; i <= maxy;i++) | |
| 74 | segae_drawscanline(screen->machine, i-16,0,0); | |
| 75 | ||
| 76 | for (i = miny;i <= maxy;i++) | |
| 77 | { | |
| 78 | UINT16 *dest = BITMAP_ADDR16(bitmap, i, 32); | |
| 79 | int x; | |
| 80 | for (x = 0; x < 256; x++) | |
| 81 | { | |
| 82 | UINT8 pix = cache_bitmap[(i-16) * (16+256+16) + 24 + x]; | |
| 83 | if (pix != 0) | |
| 84 | dest[x] = screen->machine->pens[palette_base + pix]; | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | return 0; | |
| 89 | } | |
| 90 | ||
| 91 | /******************************************************************************* | |
| 92 | VDP Start / Stop Functions | |
| 93 | ******************************************************************************** | |
| 94 | note: we really should check after each allocation to make sure it was | |
| 95 | successful then if one allocation fails we can free up the previous ones | |
| 96 | *******************************************************************************/ | |
| 97 | ||
| 98 | static void vdp_start(running_machine *machine, UINT8 chip) | |
| 99 | { | |
| 100 | UINT8 temp; | |
| 101 | ||
| 102 | /*- VRAM -*/ | |
| 103 | ||
| 104 | segae_vdp_vram[chip] = auto_alloc_array(machine, UINT8, 0x8000); /* 32kb (2 banks) */ | |
| 105 | segae_vdp_vrambank[chip] = 0; | |
| 106 | ||
| 107 | /*- CRAM -*/ | |
| 108 | ||
| 109 | vdp_cram[chip] = auto_alloc_array(machine, UINT8, 0x20); | |
| 110 | ||
| 111 | /*- VDP Registers -*/ | |
| 112 | ||
| 113 | segae_vdp_regs[chip] = auto_alloc_array(machine, UINT8, 0x20); | |
| 114 | ||
| 115 | /*- Clear Memory -*/ | |
| 116 | ||
| 117 | memset(segae_vdp_vram[chip], 0, 0x8000); | |
| 118 | memset(vdp_cram[chip], 0, 0x20); | |
| 119 | memset(segae_vdp_regs[chip], 0, 0x20); | |
| 120 | ||
| 121 | /*- Set Up Some Default Values */ | |
| 122 | ||
| 123 | vdp_accessaddr[chip] = 0; | |
| 124 | vdp_accessmode[chip] = 0; | |
| 125 | vdp_cmdpart[chip] = 0; | |
| 126 | vdp_command[chip] = 0; | |
| 127 | ||
| 128 | /*- Black the Palette -*/ | |
| 129 | ||
| 130 | for (temp=0;temp<32;temp++) | |
| 131 | palette_set_color(machine, temp + 32*chip+palette_base, MAKE_RGB(0, 0, 0)); | |
| 132 | ||
| 133 | /* Save State Stuff (based on video/taitoic.c) */ | |
| 134 | ||
| 135 | state_save_register_item_pointer(machine, "VDP", NULL, chip, segae_vdp_vram[chip], 0x8000); | |
| 136 | state_save_register_item_pointer(machine, "VDP", NULL, chip, vdp_cram[chip], 0x20); | |
| 137 | state_save_register_item_pointer(machine, "VDP", NULL, chip, segae_vdp_regs[chip], 0x20); | |
| 138 | state_save_register_item(machine, "VDP", NULL, chip, vdp_cmdpart[chip]); | |
| 139 | state_save_register_item(machine, "VDP", NULL, chip, vdp_command[chip]); | |
| 140 | state_save_register_item(machine, "VDP", NULL, chip, vdp_accessmode[chip]); | |
| 141 | state_save_register_item(machine, "VDP", NULL, chip, vdp_accessaddr[chip]); | |
| 142 | state_save_register_item(machine, "VDP", NULL, chip, segae_vdp_vrambank[chip]); | |
| 143 | } | |
| 144 | ||
| 145 | /******************************************************************************* | |
| 146 | Core VDP Functions | |
| 147 | *******************************************************************************/ | |
| 148 | ||
| 149 | /*-- Reads --*/ | |
| 150 | ||
| 151 | /*************************************** | |
| 152 | segae_vdp_ctrl_r ( UINT8 chip ) | |
| 153 | **************************************** | |
| 154 | reading the vdp control port will | |
| 155 | return the following | |
| 156 | ||
| 157 | bit: | |
| 158 | 7 - vert int pending | |
| 159 | 6 - line int pending | |
| 160 | 5 - sprite collision (non 0 pixels) *not currently emulated (not needed by these games)* | |
| 161 | 4 - always 0 | |
| 162 | 3 - always 0 | |
| 163 | 2 - always 0 | |
| 164 | 1 - always 0 | |
| 165 | 0 - always 0 | |
| 166 | ||
| 167 | bits 5,6,7 are cleared after a read | |
| 168 | ***************************************/ | |
| 169 | ||
| 170 | UINT8 segae_vdp_ctrl_r ( UINT8 chip ) | |
| 171 | { | |
| 172 | UINT8 temp; | |
| 173 | ||
| 174 | temp = 0; | |
| 175 | ||
| 176 | temp |= (segae_vintpending << 7); | |
| 177 | temp |= (segae_hintpending << 6); | |
| 178 | ||
| 179 | segae_hintpending = segae_vintpending = 0; | |
| 180 | ||
| 181 | return temp; | |
| 182 | } | |
| 183 | ||
| 184 | UINT8 segae_vdp_data_r ( UINT8 chip ) | |
| 185 | { | |
| 186 | UINT8 temp; | |
| 187 | ||
| 188 | vdp_cmdpart[chip] = 0; | |
| 189 | ||
| 190 | temp = vdp_readbuffer[chip]; | |
| 191 | ||
| 192 | if (vdp_accessmode[chip]==0x03) { /* CRAM Access */ | |
| 193 | /* error CRAM can't be read!! */ | |
| 194 | } else { /* VRAM */ | |
| 195 | vdp_readbuffer[chip] = segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ]; | |
| 196 | vdp_accessaddr[chip] += 1; | |
| 197 | vdp_accessaddr[chip] &= 0x3fff; | |
| 198 | } | |
| 199 | return temp; | |
| 200 | } | |
| 201 | ||
| 202 | /*-- Writes --*/ | |
| 203 | ||
| 204 | void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data ) | |
| 205 | { | |
| 206 | if (!vdp_cmdpart[chip]) { | |
| 207 | vdp_cmdpart[chip] = 1; | |
| 208 | vdp_command[chip] = data; | |
| 209 | } else { | |
| 210 | vdp_cmdpart[chip] = 0; | |
| 211 | vdp_command[chip] |= (data << 8); | |
| 212 | vdp_processcmd (chip, vdp_command[chip]); | |
| 213 | } | |
| 214 | } | |
| 215 | ||
| 216 | void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data ) | |
| 217 | { | |
| 218 | vdp_cmdpart[chip] = 0; | |
| 219 | ||
| 220 | if (vdp_accessmode[chip]==0x03) { /* CRAM Access */ | |
| 221 | UINT8 r,g,b, temp; | |
| 222 | ||
| 223 | temp = vdp_cram[chip][vdp_accessaddr[chip]]; | |
| 224 | ||
| 225 | vdp_cram[chip][vdp_accessaddr[chip]] = data; | |
| 226 | ||
| 227 | if (temp != data) { | |
| 228 | r = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x03) >> 0; | |
| 229 | g = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x0c) >> 2; | |
| 230 | b = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x30) >> 4; | |
| 231 | ||
| 232 | palette_set_color_rgb(machine, vdp_accessaddr[chip] + 32*chip+palette_base, pal2bit(r), pal2bit(g), pal2bit(b)); | |
| 233 | } | |
| 234 | ||
| 235 | vdp_accessaddr[chip] += 1; | |
| 236 | vdp_accessaddr[chip] &= 0x1f; | |
| 237 | } else { /* VRAM Accesses */ | |
| 238 | segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ] = data; | |
| 239 | vdp_accessaddr[chip] += 1; | |
| 240 | vdp_accessaddr[chip] &= 0x3fff; | |
| 241 | } | |
| 242 | } | |
| 243 | ||
| 244 | /*-- Associated Functions --*/ | |
| 245 | ||
| 246 | /*************************************** | |
| 247 | vdp_processcmd | |
| 248 | **************************************** | |
| 249 | ||
| 250 | general command format | |
| 251 | ||
| 252 | M M A A A A A A A A A A A A A A M=Mode, A=Address | |
| 253 | ||
| 254 | the command will be one of 3 things according to the upper | |
| 255 | 4 bits | |
| 256 | ||
| 257 | 0 0 - - - - - - - - - - - - - - VRAM Acess Mode (Special Read) | |
| 258 | ||
| 259 | 0 1 - - - - - - - - - - - - - - VRAM Acesss Mode | |
| 260 | ||
| 261 | 1 0 0 0 - - - - - - - - - - - - VDP Register Set (current mode & address _not_ changed) | |
| 262 | ||
| 263 | 1 0 x x - - - - - - - - - - - - VRAM Access Mode (0x1000 - 0x3FFF only, x x is anything but 0 0) | |
| 264 | ||
| 265 | 1 1 - - - - - - - - - - - - - - CRAM Access Mode | |
| 266 | ||
| 267 | ***************************************/ | |
| 268 | ||
| 269 | static void vdp_processcmd (UINT8 chip, UINT16 cmd) | |
| 270 | { | |
| 271 | if ( (cmd & 0xf000) == 0x8000 ) { /* 1 0 0 0 - - - - - - - - - - - - VDP Register Set */ | |
| 272 | vdp_setregister (chip, cmd); | |
| 273 | } else { /* Anything Else */ | |
| 274 | vdp_accessmode[chip] = (cmd & 0xc000) >> 14; | |
| 275 | vdp_accessaddr[chip] = (cmd & 0x3fff); | |
| 276 | ||
| 277 | if ((vdp_accessmode[chip]==0x03) && (vdp_accessaddr[chip] > 0x1f) ) { /* Check Address is valid for CRAM */ | |
| 278 | /* Illegal, CRAM isn't this large! */ | |
| 279 | vdp_accessaddr[chip] &= 0x1f; | |
| 280 | } | |
| 281 | ||
| 282 | if (vdp_accessmode[chip] == 0x00) { /* 0 0 - - - - - - - - - - - - - - VRAM Acess Mode (Special Read) */ | |
| 283 | vdp_readbuffer[chip] = segae_vdp_vram[chip][ segae_vdp_vrambank[chip]*0x4000 + vdp_accessaddr[chip] ]; | |
| 284 | vdp_accessaddr[chip] += 1; | |
| 285 | vdp_accessaddr[chip] &= 0x3fff; | |
| 286 | } | |
| 287 | } | |
| 288 | } | |
| 289 | ||
| 290 | /*************************************** | |
| 291 | vdp_setregister | |
| 292 | ||
| 293 | general command format | |
| 294 | ||
| 295 | 1 0 0 0 R R R R D D D D D D D D 1/0 = Fixed Values, R = Register # / Address, D = Data | |
| 296 | ||
| 297 | ***************************************/ | |
| 298 | ||
| 299 | static void vdp_setregister(UINT8 chip, UINT16 cmd) | |
| 300 | { | |
| 301 | UINT8 regnumber; | |
| 302 | UINT8 regdata; | |
| 303 | ||
| 304 | regnumber = (cmd & 0x0f00) >> 8; | |
| 305 | regdata = (cmd & 0x00ff); | |
| 306 | ||
| 307 | if (regnumber < 11) { | |
| 308 | segae_vdp_regs[chip][regnumber] = regdata; | |
| 309 | } else { | |
| 310 | /* Illegal, there aren't this many registers! */ | |
| 311 | } | |
| 312 | } | |
| 313 | ||
| 314 | /******************************************************************************* | |
| 315 | System E Drawing Capabilities Notes | |
| 316 | ******************************************************************************** | |
| 317 | Display Consists of | |
| 318 | ||
| 319 | VDP0 Backdrop Color (?) | |
| 320 | VDP0 Tiles (Low) | |
| 321 | VDP0 Sprites | |
| 322 | VDP0 Tiles (High) | |
| 323 | VDP1 Tiles (Low) | |
| 324 | VDP1 Sprites | |
| 325 | VDP1 Tiles (High) | |
| 326 | ||
| 327 | each vdp has its on vram, etc etc. | |
| 328 | ||
| 329 | the tilemaps are 256x224 in size, 256x192 of this is visible, the tiles | |
| 330 | are 8x8 pixels, so 32x28 of 8x8 tiles make a 256x224 tilemap. | |
| 331 | ||
| 332 | the tiles are 4bpp (16 colours), video ram can hold upto 512 tile gfx | |
| 333 | ||
| 334 | tile references are 16 bits (3 bits unused, 1 bit priority, 1 bit palette, | |
| 335 | 2 bits for flip, 9 bits for tile number) | |
| 336 | ||
| 337 | tilemaps can be scrolled horizontally, the top 16 lines of the display can | |
| 338 | have horinzontal scrolling disabled | |
| 339 | ||
| 340 | tilemaps can be scrolled vertically, the right 64 lines of the display can | |
| 341 | have the vertical scrolling disabled | |
| 342 | ||
| 343 | the leftmost 8 line of the display can be blanked | |
| 344 | ||
| 345 | *******************************************************************************/ | |
| 346 | ||
| 347 | static void segae_drawscanline(running_machine *machine, int line, int chips, int blank) | |
| 348 | { | |
| 349 | ||
| 350 | UINT8* dest; | |
| 351 | ||
| 352 | if (video_skip_this_frame()) | |
| 353 | return; | |
| 354 | ||
| 355 | dest = cache_bitmap + (16+256+16) * line; | |
| 356 | ||
| 357 | /* This should be cleared to bg colour, but which vdp determines that !, neither seems to be right, maybe its always the same col? */ | |
| 358 | memset(dest, 0, 16+256+16); | |
| 359 | ||
| 360 | if (segae_vdp_regs[0][1] & 0x40) { | |
| 361 | draw_tiles_line (dest+16, line, 0,0); | |
| 362 | draw_sprite_line(dest+16, 0, line); | |
| 363 | draw_tiles_line (dest+16, line, 0,1); | |
| 364 | } | |
| 365 | ||
| 366 | if (chips>0) /* we don't want to do this on megatech */ | |
| 367 | { | |
| 368 | if (segae_vdp_regs[1][1] & 0x40) { | |
| 369 | draw_tiles_line (dest+16, line, 1,0); | |
| 370 | draw_sprite_line(dest+16, 1, line); | |
| 371 | draw_tiles_line (dest+16, line, 1,1); | |
| 372 | } | |
| 373 | } | |
| 374 | ||
| 375 | /* FIX ME!! */ | |
| 376 | if (blank) | |
| 377 | { | |
| 378 | if (strcmp(machine->gamedrv->name,"tetrisse")) /* and we really don't want to do it on tetrise */ | |
| 379 | memset(dest+16, 32+16, 8); /* Clear Leftmost column, there should be a register for this like on the SMS i imagine */ | |
| 380 | /* on the SMS this is bit 5 of register 0 (according to CMD's SMS docs) for system E this */ /* appears to be incorrect, most games need it blanked 99% of the time so we blank it */ | |
| 381 | } | |
| 382 | } | |
| 383 | ||
| 384 | /*-- Drawing a line of tiles --*/ | |
| 385 | ||
| 386 | static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri) | |
| 387 | { | |
| 388 | /* todo: fix vscrolling (or is it something else causing the glitch on the hi-score screen of hangonjr, seems to be .. */ | |
| 389 | ||
| 390 | UINT8 hscroll; | |
| 391 | UINT8 vscroll; | |
| 392 | UINT16 tmbase; | |
| 393 | UINT8 tilesline, tilesline2; | |
| 394 | UINT8 coloffset, coloffset2; | |
| 395 | UINT8 loopcount; | |
| 396 | ||
| 397 | hscroll = (256-segae_vdp_regs[chip][8]); | |
| 398 | vscroll = segae_vdp_regs[chip][9]; | |
| 399 | if (vscroll > 224) vscroll %= 224; | |
| 400 | ||
| 401 | tmbase = (segae_vdp_regs[chip][2] & 0x0e) << 10; | |
| 402 | tmbase += (segae_vdp_vrambank[chip] * 0x4000); | |
| 403 | ||
| 404 | tilesline = (line + vscroll) >> 3; | |
| 405 | tilesline2= (line + vscroll) % 8; | |
| 406 | ||
| 407 | ||
| 408 | coloffset = (hscroll >> 3); | |
| 409 | coloffset2= (hscroll % 8); | |
| 410 | ||
| 411 | dest -= coloffset2; | |
| 412 | ||
| 413 | for (loopcount=0;loopcount<33;loopcount++) { | |
| 414 | ||
| 415 | UINT16 vram_offset, vram_word; | |
| 416 | UINT16 tile_no; | |
| 417 | UINT8 palette, priority, flipx, flipy; | |
| 418 | ||
| 419 | vram_offset = tmbase | |
| 420 | + (2 * (32*tilesline + ((coloffset+loopcount)&0x1f) ) ); | |
| 421 | vram_word = segae_vdp_vram[chip][vram_offset] | (segae_vdp_vram[chip][vram_offset+1] << 8); | |
| 422 | ||
| 423 | tile_no = (vram_word & 0x01ff); | |
| 424 | flipx = (vram_word & 0x0200) >> 9; | |
| 425 | flipy = (vram_word & 0x0400) >> 10; | |
| 426 | palette = (vram_word & 0x0800) >> 11; | |
| 427 | priority= (vram_word & 0x1000) >> 12; | |
| 428 | ||
| 429 | tilesline2= (line + vscroll) % 8; | |
| 430 | if (flipy) tilesline2 = 7-tilesline2; | |
| 431 | ||
| 432 | if (priority == pri) { | |
| 433 | if (chip == 0) draw_8pix_solid16(dest, chip, tile_no,tilesline2,flipx,palette); | |
| 434 | else draw_8pix(dest, chip, tile_no,tilesline2,flipx,palette); | |
| 435 | } | |
| 436 | dest+=8; | |
| 437 | } | |
| 438 | } | |
| 439 | ||
| 440 | static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line) | |
| 441 | { | |
| 442 | int nosprites; | |
| 443 | int loopcount; | |
| 444 | ||
| 445 | UINT16 spritebase; | |
| 446 | ||
| 447 | nosprites = 63; // if there is no end marker we draw everything (ridleofp) | |
| 448 | ||
| 449 | spritebase = (segae_vdp_regs[chip][5] & 0x7e) << 7; | |
| 450 | spritebase += (segae_vdp_vrambank[chip] * 0x4000); | |
| 451 | ||
| 452 | /*- find out how many sprites there are -*/ | |
| 453 | ||
| 454 | for (loopcount=0;loopcount<64;loopcount++) { | |
| 455 | UINT8 ypos; | |
| 456 | ||
| 457 | ypos = segae_vdp_vram[chip][spritebase+loopcount]; | |
| 458 | ||
| 459 | if (ypos==208) { | |
| 460 | nosprites=loopcount; | |
| 461 | break; | |
| 462 | } | |
| 463 | } | |
| 464 | ||
| 465 | /*- draw sprites IN REVERSE ORDER -*/ | |
| 466 | ||
| 467 | for (loopcount = nosprites; loopcount >= 0;loopcount--) { | |
| 468 | int ypos; | |
| 469 | UINT8 sheight; | |
| 470 | ||
| 471 | ypos = segae_vdp_vram[chip][spritebase+loopcount] +1; | |
| 472 | ||
| 473 | if (segae_vdp_regs[chip][1] & 0x02) sheight=16; else sheight=8; | |
| 474 | ||
| 475 | if ( (line >= ypos) && (line < ypos+sheight) ) { | |
| 476 | int xpos; | |
| 477 | UINT16 sprnum; | |
| 478 | UINT8 spline; | |
| 479 | ||
| 480 | spline = line - ypos; | |
| 481 | ||
| 482 | xpos = segae_vdp_vram[chip][spritebase+0x80+ (2*loopcount)]; | |
| 483 | sprnum = segae_vdp_vram[chip][spritebase+0x81+ (2*loopcount)]; | |
| 484 | ||
| 485 | if (segae_vdp_regs[chip][6] & 0x04) | |
| 486 | sprnum += 0x100; | |
| 487 | ||
| 488 | draw_8pix_sprite(dest+xpos, chip, sprnum, spline); | |
| 489 | ||
| 490 | } | |
| 491 | } | |
| 492 | } | |
| 493 | ||
| 494 | static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col) | |
| 495 | { | |
| 496 | ||
| 497 | UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]]; | |
| 498 | UINT8 pix, coladd; | |
| 499 | ||
| 500 | if (!pix8 && !col) return; /*note only the colour 0 of each vdp is transparent NOT colour 16???, fixes sky in HangonJr */ | |
| 501 | ||
| 502 | coladd = 16*col; | |
| 503 | ||
| 504 | if (flipx) { | |
| 505 | pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; pix+= coladd ; if (pix) dest[0] = pix+ 32*chip; | |
| 506 | pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; pix+= coladd ; if (pix) dest[1] = pix+ 32*chip; | |
| 507 | pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; pix+= coladd ; if (pix) dest[2] = pix+ 32*chip; | |
| 508 | pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; pix+= coladd ; if (pix) dest[3] = pix+ 32*chip; | |
| 509 | pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; pix+= coladd ; if (pix) dest[4] = pix+ 32*chip; | |
| 510 | pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; pix+= coladd ; if (pix) dest[5] = pix+ 32*chip; | |
| 511 | pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; pix+= coladd ; if (pix) dest[6] = pix+ 32*chip; | |
| 512 | pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; pix+= coladd ; if (pix) dest[7] = pix+ 32*chip; | |
| 513 | } else { | |
| 514 | pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; pix+= coladd ; if (pix) dest[0] = pix+ 32*chip; | |
| 515 | pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; pix+= coladd ; if (pix) dest[1] = pix+ 32*chip; | |
| 516 | pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; pix+= coladd ; if (pix) dest[2] = pix+ 32*chip; | |
| 517 | pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; pix+= coladd ; if (pix) dest[3] = pix+ 32*chip; | |
| 518 | pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; pix+= coladd ; if (pix) dest[4] = pix+ 32*chip; | |
| 519 | pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; pix+= coladd ; if (pix) dest[5] = pix+ 32*chip; | |
| 520 | pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; pix+= coladd ; if (pix) dest[6] = pix+ 32*chip; | |
| 521 | pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; pix+= coladd ; if (pix) dest[7] = pix+ 32*chip; | |
| 522 | } | |
| 523 | } | |
| 524 | ||
| 525 | static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col) | |
| 526 | { | |
| 527 | ||
| 528 | UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]]; | |
| 529 | UINT8 pix, coladd; | |
| 530 | ||
| 531 | if (!pix8) return; | |
| 532 | ||
| 533 | coladd = 16*col+32*chip; | |
| 534 | ||
| 535 | if (flipx) { | |
| 536 | pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[0] = pix+ coladd; | |
| 537 | pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[1] = pix+ coladd; | |
| 538 | pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[2] = pix+ coladd; | |
| 539 | pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[3] = pix+ coladd; | |
| 540 | pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[4] = pix+ coladd; | |
| 541 | pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[5] = pix+ coladd; | |
| 542 | pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[6] = pix+ coladd; | |
| 543 | pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[7] = pix+ coladd; | |
| 544 | } else { | |
| 545 | pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[0] = pix+ coladd; | |
| 546 | pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[1] = pix+ coladd; | |
| 547 | pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[2] = pix+ coladd; | |
| 548 | pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[3] = pix+ coladd; | |
| 549 | pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[4] = pix+ coladd; | |
| 550 | pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[5] = pix+ coladd; | |
| 551 | pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[6] = pix+ coladd; | |
| 552 | pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[7] = pix+ coladd; | |
| 553 | } | |
| 554 | } | |
| 555 | ||
| 556 | static void draw_8pix_sprite(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line) | |
| 557 | { | |
| 558 | ||
| 559 | UINT32 pix8 = *(UINT32 *)&segae_vdp_vram[chip][(32)*tile + (4)*line + (0x4000) * segae_vdp_vrambank[chip]]; | |
| 560 | UINT8 pix; | |
| 561 | ||
| 562 | if (!pix8) return; /*note only the colour 0 of each vdp is transparent NOT colour 16, fixes sky in HangonJr */ | |
| 563 | ||
| 564 | pix = ((pix8 >> 7) & 0x01) | ((pix8 >>14) & 0x02) | ((pix8 >> 21) & 0x04) | ((pix8 >> 28) & 0x08) ; if (pix) dest[0] = pix+16+32*chip; | |
| 565 | pix = ((pix8 >> 6) & 0x01) | ((pix8 >>13) & 0x02) | ((pix8 >> 20) & 0x04) | ((pix8 >> 27) & 0x08) ; if (pix) dest[1] = pix+16+32*chip; | |
| 566 | pix = ((pix8 >> 5) & 0x01) | ((pix8 >>12) & 0x02) | ((pix8 >> 19) & 0x04) | ((pix8 >> 26) & 0x08) ; if (pix) dest[2] = pix+16+32*chip; | |
| 567 | pix = ((pix8 >> 4) & 0x01) | ((pix8 >>11) & 0x02) | ((pix8 >> 18) & 0x04) | ((pix8 >> 25) & 0x08) ; if (pix) dest[3] = pix+16+32*chip; | |
| 568 | pix = ((pix8 >> 3) & 0x01) | ((pix8 >>10) & 0x02) | ((pix8 >> 17) & 0x04) | ((pix8 >> 24) & 0x08) ; if (pix) dest[4] = pix+16+32*chip; | |
| 569 | pix = ((pix8 >> 2) & 0x01) | ((pix8 >> 9) & 0x02) | ((pix8 >> 16) & 0x04) | ((pix8 >> 23) & 0x08) ; if (pix) dest[5] = pix+16+32*chip; | |
| 570 | pix = ((pix8 >> 1) & 0x01) | ((pix8 >> 8) & 0x02) | ((pix8 >> 15) & 0x04) | ((pix8 >> 22) & 0x08) ; if (pix) dest[6] = pix+16+32*chip; | |
| 571 | pix = ((pix8 >> 0) & 0x01) | ((pix8 >> 7) & 0x02) | ((pix8 >> 14) & 0x04) | ((pix8 >> 21) & 0x08) ; if (pix) dest[7] = pix+16+32*chip; | |
| 572 | ||
| 573 | } |
| r5955 | r5956 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #include "genesis.h" |
| 14 | 14 | |
| 15 | /* in video/segasyse.c */ | |
| 16 | VIDEO_START( megaplay_normal ); | |
| 17 | VIDEO_UPDATE( megaplay_normal ); | |
| 18 | 15 | |
| 19 | 16 | static const device_config *genesis_screen; |
| 20 | 17 | |
| r5955 | r5956 | |
| 279 | 276 | /* megaplay, draws either Genesis or SMS (single screen display) */ |
| 280 | 277 | |
| 281 | 278 | /* core refresh: computes the final screen */ |
| 279 | #if 0 | |
| 282 | 280 | VIDEO_UPDATE( megaplay ) |
| 283 | 281 | { |
| 284 | 282 | int y; |
| r5955 | r5956 | |
| 287 | 285 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 288 | 286 | drawline(BITMAP_ADDR16(bitmap, y, 0), y, 0); |
| 289 | 287 | |
| 290 | VIDEO_UPDATE_CALL(megaplay_normal); | |
| 288 | //VIDEO_UPDATE_CALL(megaplay_normal); | |
| 291 | 289 | |
| 292 | 290 | return 0; |
| 293 | 291 | } |
| 292 | #endif | |
| 294 | 293 | |
| 295 | 294 | void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ) |
| 296 | 295 | { |
| r5955 | r5956 | |
|---|---|---|
| 286 | 286 | AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE(&bublbobl_objectram) AM_SIZE(&bublbobl_objectram_size) |
| 287 | 287 | AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE(1) |
| 288 | 288 | AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram) |
| 289 | AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w) | |
| 290 | AM_RANGE(0xfa03, 0xfa03) AM_WRITE(soundcpu_reset_w) | |
| 289 | AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w) | |
| 290 | AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w) | |
| 291 | 291 | AM_RANGE(0xfa80, 0xfa80) AM_WRITE(watchdog_reset_w) |
| 292 | 292 | AM_RANGE(0xfb40, 0xfb40) AM_WRITE(bublbobl_bankswitch_w) |
| 293 | 293 | AM_RANGE(0xfc00, 0xffff) AM_RAM AM_BASE(&bublbobl_mcu_sharedram) |
| r5955 | r5956 | |
| 303 | 303 | AM_RANGE(0x8000, 0x8fff) AM_RAM |
| 304 | 304 | AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE("ym1", ym2203_r, ym2203_w) |
| 305 | 305 | AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ym2", ym3526_r, ym3526_w) |
| 306 | AM_RANGE(0xb000, 0xb000) AM_READWRITE(soundlatch_r, sound_status_w) | |
| 306 | AM_RANGE(0xb000, 0xb000) AM_READWRITE(soundlatch_r, bublbobl_sound_status_w) | |
| 307 | 307 | AM_RANGE(0xb001, 0xb001) AM_WRITE(bublbobl_sh_nmi_enable_w) AM_READNOP |
| 308 | 308 | AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w) |
| 309 | 309 | AM_RANGE(0xe000, 0xffff) AM_ROM // space for diagnostic ROM? |
| r5955 | r5956 | |
| 342 | 342 | AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE(&bublbobl_objectram) AM_SIZE(&bublbobl_objectram_size) |
| 343 | 343 | AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE(1) |
| 344 | 344 | AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram) |
| 345 | AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w) | |
| 346 | AM_RANGE(0xfa03, 0xfa03) AM_WRITE(soundcpu_reset_w) | |
| 345 | AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w) | |
| 346 | AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w) | |
| 347 | 347 | AM_RANGE(0xfa80, 0xfa80) AM_WRITENOP // ??? |
| 348 | 348 | AM_RANGE(0xfb40, 0xfb40) AM_WRITE(bublbobl_bankswitch_w) |
| 349 | 349 | AM_RANGE(0xfc00, 0xfcff) AM_RAM |
| r5955 | r5956 | |
| 375 | 375 | AM_RANGE(0xfa80, 0xfa80) AM_WRITE(tokio_bankswitch_w) |
| 376 | 376 | AM_RANGE(0xfb00, 0xfb00) AM_WRITE(tokio_videoctrl_w) |
| 377 | 377 | AM_RANGE(0xfb80, 0xfb80) AM_WRITE(bublbobl_nmitrigger_w) |
| 378 | AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(sound_status_r, bublbobl_sound_command_w) | |
| 378 | AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w) | |
| 379 | 379 | AM_RANGE(0xfe00, 0xfe00) AM_READ(tokio_mcu_r) AM_WRITENOP // ??? |
| 380 | 380 | ADDRESS_MAP_END |
| 381 | 381 | |
| r5955 | r5956 | |
| 387 | 387 | static ADDRESS_MAP_START( tokio_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 388 | 388 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 389 | 389 | AM_RANGE(0x8000, 0x8fff) AM_RAM |
| 390 | AM_RANGE(0x9000, 0x9000) AM_READWRITE(soundlatch_r, sound_status_w) | |
| 390 | AM_RANGE(0x9000, 0x9000) AM_READWRITE(soundlatch_r, bublbobl_sound_status_w) | |
| 391 | 391 | AM_RANGE(0x9800, 0x9800) AM_READNOP // ??? |
| 392 | 392 | AM_RANGE(0xa000, 0xa000) AM_WRITE(bublbobl_sh_nmi_disable_w) |
| 393 | 393 | AM_RANGE(0xa800, 0xa800) AM_WRITE(bublbobl_sh_nmi_enable_w) |
| r5955 | r5956 | |
|---|---|---|
| 1558 | 1558 | /* video hardware */ |
| 1559 | 1559 | MDRV_GFXDECODE(wb) |
| 1560 | 1560 | MDRV_VIDEO_UPDATE(wintbob) |
| 1561 | MDRV_VIDEO_EOF( | |
| 1561 | MDRV_VIDEO_EOF(0 | |
| 1562 | 1562 | MACHINE_DRIVER_END |
| 1563 | 1563 | |
| 1564 | 1564 |
| r5955 | r5956 | |
|---|---|---|
| 1142 | 1142 | ROM_LOAD( "j214a2.72", 0x0100, 0x0100, CRC(a9e1fb43) SHA1(57dbcfe2438fd090c08594818549aeea6339eab2) ) |
| 1143 | 1143 | ROM_END |
| 1144 | 1144 | |
| 1145 | ROM_START( zaxxonj ) | |
| 1146 | ROM_REGION( 0x6000, "maincpu", 0 ) | |
| 1147 | ROM_LOAD( "zaxxon_rom3.u13", 0x0000, 0x2000, CRC(925168c7) SHA1(0f14b5072b5be252955ffb3a30fa6c76b3e6a6c4) ) | |
| 1148 | ROM_LOAD( "zaxxon_rom2.u12", 0x2000, 0x2000, CRC(c088df92) SHA1(c0c6cd8dcf6db65129980331fa9ecc3800b63436) ) | |
| 1149 | ROM_LOAD( "zaxxon_rom1.u11", 0x4000, 0x1000, CRC(f832dd79) SHA1(1d626f22630eaa53603637991a06aeb7401e9769) ) | |
| 1150 | ||
| 1151 | ROM_REGION( 0x1000, "gfx1", 0 ) | |
| 1152 | ROM_LOAD( "zaxxon_rom14.u54", 0x0000, 0x0800, CRC(07bf8c52) SHA1(425157a1625b1bd5169c3218b958010bf6af12bb) ) | |
| 1153 | ROM_LOAD( "zaxxon_rom15.u55", 0x0800, 0x0800, CRC(c215edcb) SHA1(f1ded2173eb139f48d2ca86c5ef00acbe6c11cd3) ) | |
| 1154 | ||
| 1155 | ROM_REGION( 0x6000, "gfx2", 0 ) | |
| 1156 | ROM_LOAD( "zaxxon_rom6.u70", 0x0000, 0x2000, CRC(6e07bb68) SHA1(a002f3441b0f0044615ce71ecbd14edadba16270) ) | |
| 1157 | ROM_LOAD( "zaxxon_rom5.u69", 0x2000, 0x2000, CRC(0a5bce6a) SHA1(a86543727389931244ba8a576b543d7ac05a2585) ) | |
| 1158 | ROM_LOAD( "zaxxon_rom4.u68", 0x4000, 0x2000, CRC(a5bf1465) SHA1(a8cd27dfb4a606bae8bfddcf936e69e980fb1977) ) | |
| 1159 | ||
| 1160 | ROM_REGION( 0x6000, "gfx3", 0 ) | |
| 1161 | ROM_LOAD( "zaxxon_rom11.u59", 0x0000, 0x2000, CRC(eaf0dd4b) SHA1(194e2ca0a806e0cb6bb7cc8341d1fc6f2ea911f6) ) | |
| 1162 | ROM_LOAD( "zaxxon_rom12.u60", 0x2000, 0x2000, CRC(1c5369c7) SHA1(af6a5984c3cedfa8c9efcd669f4f205b51a433b2) ) | |
| 1163 | ROM_LOAD( "zaxxon_rom13.u61", 0x4000, 0x2000, CRC(ab4e8a9a) SHA1(4ac79cccc30e4adfa878b36101e97e20ac010438) ) | |
| 1164 | ||
| 1165 | ROM_REGION( 0x8000, "gfx4", 0 ) | |
| 1166 | ROM_LOAD( "zaxxon_rom8.u58", 0x0000, 0x2000, CRC(28d65063) SHA1(e1f90716236c61df61bdc6915a8e390cb4dcbf15) ) | |
| 1167 | ROM_LOAD( "zaxxon_rom7.u57", 0x2000, 0x2000, CRC(6284c200) SHA1(d26a9049541479b8b19f5aa0690cf4aaa787c9b5) ) | |
| 1168 | ROM_LOAD( "zaxxon_rom10.u60", 0x4000, 0x2000, CRC(a95e61fd) SHA1(a0f8c15ff75affa3532abf8f340811cf415421fd) ) | |
| 1169 | ROM_LOAD( "zaxxon_rom9.u59", 0x6000, 0x2000, CRC(7e42691f) SHA1(2124363be8f590b74e2b15dd3f90d77dd9ca9528) ) | |
| 1170 | ||
| 1171 | ROM_REGION( 0x0200, "proms", 0 ) | |
| 1172 | ROM_LOAD( "mro_16.u76", 0x0000, 0x0100, CRC(6cc6695b) SHA1(01ae8450ccc302e1a5ae74230d44f6f531a962e2) ) | |
| 1173 | ROM_LOAD( "mro_17.u41", 0x0100, 0x0100, CRC(a9e1fb43) SHA1(57dbcfe2438fd090c08594818549aeea6339eab2) ) | |
| 1174 | ROM_END | |
| 1175 | ||
| 1145 | 1176 | ROM_START( zaxxonb ) |
| 1146 | 1177 | ROM_REGION( 0x6000, "maincpu", 0 ) |
| 1147 | 1178 | ROM_LOAD( "zaxxonb3.u27", 0x0000, 0x2000, CRC(125bca1c) SHA1(f4160966d42e5282736cde8a276204ba8910ca61) ) |
| r5955 | r5956 | |
| 1388 | 1419 | * |
| 1389 | 1420 | *************************************/ |
| 1390 | 1421 | |
| 1391 | static void zaxxon | |
| 1422 | static void zaxxonj_decode(running_machine *machine, const char *cputag) | |
| 1392 | 1423 | { |
| 1393 | 1424 | /* |
| 1394 | 1425 | the values vary, but the translation mask is always laid out like this: |
| r5955 | r5956 | |
| 1473 | 1504 | * |
| 1474 | 1505 | *************************************/ |
| 1475 | 1506 | |
| 1476 | static DRIVER_INIT( zaxxon | |
| 1507 | static DRIVER_INIT( zaxxonj ) | |
| 1477 | 1508 | { |
| 1478 | zaxxon | |
| 1509 | zaxxonj_decode(machine, "maincpu"); | |
| 1479 | 1510 | } |
| 1480 | 1511 | |
| 1481 | 1512 | |
| r5955 | r5956 | |
| 1531 | 1562 | /* these games run on standard Zaxxon hardware */ |
| 1532 | 1563 | GAME( 1982, zaxxon, 0, zaxxon, zaxxon, 0, ROT90, "Sega", "Zaxxon (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 1533 | 1564 | GAME( 1982, zaxxon2, zaxxon, zaxxon, zaxxon, 0, ROT90, "Sega", "Zaxxon (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 1534 | GAME( 1982, zaxxonb, zaxxon, zaxxon, zaxxon, zaxxonb, ROT90, "bootleg", "Jackson", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) | |
| 1565 | GAME( 1982, zaxxonj, zaxxon, zaxxon, zaxxon, zaxxonj, ROT90, "Sega", "Zaxxon (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) | |
| 1566 | GAME( 1982, zaxxonb, zaxxon, zaxxon, zaxxon, zaxxonj, ROT90, "bootleg", "Jackson", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) | |
| 1535 | 1567 | GAME( 1982, szaxxon, 0, zaxxon, szaxxon, szaxxon, ROT90, "Sega", "Super Zaxxon (315-5013)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 1536 | 1568 | GAME( 1984, futspy, 0, futspy, futspy, futspy, ROT90, "Sega", "Future Spy (315-5061)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 1537 | 1569 |
| r5955 | r5956 | |
|---|---|---|
| 250 | 250 | /* sound hardware */ |
| 251 | 251 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 252 | 252 | |
| 253 | MDRV_SOUND_ADD("discrete", DISCRETE, | |
| 253 | MDRV_SOUND_ADD("discrete", DISCRETE, | |
| 254 | 254 | MDRV_SOUND_CONFIG_DISCRETE(skyraid) |
| 255 | 255 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 256 | 256 | MACHINE_DRIVER_END |
| r5955 | r5956 | |
| 286 | 286 | ROM_END |
| 287 | 287 | |
| 288 | 288 | |
| 289 | GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_IMPERFECT_ | |
| 289 | GAME( 1978, skyraid, 0, skyraid, skyraid, 0, ORIENTATION_FLIP_Y, "Atari", "Sky Raider", GAME_IMPERFECT_ |
| r5955 | r5956 | |
|---|---|---|
| 311 | 311 | static UINT8 lamp_data; |
| 312 | 312 | static UINT8 ay_data; |
| 313 | 313 | |
| 314 | extern const UINT8 MPU4_chr_lut[72]; | |
| 315 | 314 | static UINT8 MPU4_chr_data[72]; |
| 316 | 315 | |
| 317 | 316 | static UINT8 Lamps[128]; /* 128 multiplexed lamps */ |
| 318 | 317 | static int optic_pattern; |
| 319 | 318 | |
| 320 | 319 | /* Lookup table for CHR data */ |
| 321 | const UINT8 MPU4_chr_lut[72]= { 0x00,0x1A,0x04,0x10,0x18,0x0F,0x13,0x1B, | |
| 320 | static const UINT8 MPU4_chr_lut[72]= { 0x00,0x1A,0x04,0x10,0x18,0x0F,0x13,0x1B, | |
| 322 | 321 | 0x03,0x07,0x17,0x1D,0x36,0x35,0x2B,0x28, |
| 323 | 322 | 0x39,0x21,0x22,0x25,0x2C,0x29,0x31,0x34, |
| 324 | 323 | 0x0A,0x1F,0x06,0x0E,0x1C,0x12,0x1E,0x0D, |
| r5955 | r5956 | |
|---|---|---|
| 1773 | 1773 | PORT_START(CLOWNS_CONTROLLER_P2_TAG) |
| 1774 | 1774 | PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2) |
| 1775 | 1775 | |
| 1776 | PORT_START("MUSIC_ADJ") /* 3 */ | |
| 1777 | PORT_ADJUSTER( 40, "Music Volume" ) | |
| 1776 | PORT_START("R507") | |
| 1777 | PORT_ADJUSTER( 40, "R507 - Music Volume" ) | |
| 1778 | 1778 | INPUT_PORTS_END |
| 1779 | 1779 | |
| 1780 | 1780 | |
| r5955 | r5956 | |
| 1820 | 1820 | PORT_START(CLOWNS_CONTROLLER_P2_TAG) |
| 1821 | 1821 | PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2) |
| 1822 | 1822 | |
| 1823 | PORT_START("MUSIC_ADJ") /* 3 */ | |
| 1824 | PORT_ADJUSTER( 40, "Music Volume" ) | |
| 1823 | PORT_START("R507") | |
| 1824 | PORT_ADJUSTER( 40, "R507 - Music Volume" ) | |
| 1825 | 1825 | INPUT_PORTS_END |
| 1826 | 1826 | |
| 1827 | 1827 | |
| r5955 | r5956 | |
| 1857 | 1857 | |
| 1858 | 1858 | AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w) |
| 1859 | 1859 | AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w) |
| 1860 | AM_RANGE(0x03, 0x03) AM_WRITE(spacwalk_audio_1_w) | |
| 1860 | AM_RANGE(0x03, 0x03) AM_DEVWRITE("discrete", spacwalk_audio_1_w) | |
| 1861 | 1861 | AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w) |
| 1862 | AM_RANGE(0x05, 0x05) AM_DEVWRITE("discrete", midway_tone_generator_lo_w) | |
| 1863 | AM_RANGE(0x06, 0x06) AM_DEVWRITE("discrete", midway_tone_generator_hi_w) | |
| 1864 | AM_RANGE(0x07, 0x07) AM_DEVWRITE("discrete", spacwalk_audio_2_w) | |
| 1862 | 1865 | ADDRESS_MAP_END |
| 1863 | 1866 | |
| 1864 | 1867 | static INPUT_PORTS_START( spacwalk ) |
| r5955 | r5956 | |
| 1909 | 1912 | |
| 1910 | 1913 | PORT_START(CLOWNS_CONTROLLER_P2_TAG) |
| 1911 | 1914 | PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2) |
| 1915 | ||
| 1916 | PORT_START("R507") | |
| 1917 | PORT_ADJUSTER( 40, "R507 - Music Volume" ) | |
| 1912 | 1918 | INPUT_PORTS_END |
| 1913 | 1919 | |
| 1914 | 1920 | static MACHINE_DRIVER_START( spacwalk ) |
| r5955 | r5956 | |
| 1921 | 1927 | MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL))) |
| 1922 | 1928 | |
| 1923 | 1929 | /* audio hardware */ |
| 1924 | | |
| 1930 | | |
| 1925 | 1931 | |
| 1926 | 1932 | MACHINE_DRIVER_END |
| 1927 | 1933 | |
| r5955 | r5956 | |
| 3175 | 3181 | /* 626 */ GAME( 1977, m4, 0, m4, m4, 0, ROT0, "Midway", "M-4", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 3176 | 3182 | /* 630 */ GAMEL(1978, clowns, 0, clowns, clowns, 0, ROT0, "Midway", "Clowns (rev. 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE , layout_clowns ) |
| 3177 | 3183 | /* 630 */ GAMEL(1978, clowns1, clowns, clowns, clowns1, 0, ROT0, "Midway", "Clowns (rev. 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE , layout_clowns ) |
| 3178 | /* 640 */ GAMEL(1978, spacwalk, 0, spacwalk, spacwalk, 0, ROT0, "Midway", "Space Walk", GAME_ | |
| 3184 | /* 640 */ GAMEL(1978, spacwalk, 0, spacwalk, spacwalk, 0, ROT0, "Midway", "Space Walk", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_spacwalk ) | |
| 3179 | 3185 | /* 642 */ GAME( 1978, einning, 0, dplay, einning, 0, ROT0, "Midway", "Extra Inning", GAME_SUPPORTS_SAVE ) |
| 3180 | 3186 | /* 643 */ GAME( 1978, shuffle, 0, shuffle, shuffle, 0, ROT90, "Midway", "Shuffleboard", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 3181 | 3187 | /* 644 */ GAME( 1977, dogpatch, 0, dogpatch, dogpatch, 0, ROT0, "Midway", "Dog Patch", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| r5955 | r5956 | |
|---|---|---|
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | /* Initialise the palette */ |
| 75 | PALETTE_INIT( spectrum ) | |
| 75 | static PALETTE_INIT( spectrum ) | |
| 76 | 76 | { |
| 77 | 77 | palette_set_colors(machine, 0, spectrum_palette, ARRAY_LENGTH(spectrum_palette)); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | VIDEO_START( spectrum ) | |
| 80 | static VIDEO_START( spectrum ) | |
| 81 | 81 | { |
| 82 | 82 | spectrum_frame_number = 0; |
| 83 | 83 | spectrum_flash_invert = 0; |
| r5955 | r5956 | |
| 94 | 94 | |
| 95 | 95 | /* Code to change the FLASH status every 25 frames. Note this must be |
| 96 | 96 | independent of frame skip etc. */ |
| 97 | VIDEO_EOF( spectrum ) | |
| 97 | static VIDEO_EOF( spectrum ) | |
| 98 | 98 | { |
| 99 | 99 | spectrum_frame_number++; |
| 100 | 100 | if (spectrum_frame_number >= 25) |
| r5955 | r5956 | |
| 109 | 109 | *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | VIDEO_UPDATE( spectrum ) | |
| 112 | static VIDEO_UPDATE( spectrum ) | |
| 113 | 113 | { |
| 114 | 114 | /* for now do a full-refresh */ |
| 115 | 115 | int x, y, b, scrx, scry; |
| r5955 | r5956 | |
| 296 | 296 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | MACHINE_DRIVER_START( photon2 ) | |
| 299 | static MACHINE_DRIVER_START( photon2 ) | |
| 300 | 300 | /* basic machine hardware */ |
| 301 | 301 | MDRV_CPU_ADD("maincpu", Z80, 3500000) /* 3.5 MHz */ |
| 302 | 302 | MDRV_CPU_PROGRAM_MAP(spectrum_mem) |
| r5955 | r5956 | |
|---|---|---|
| 277 | 277 | /*********************************************************************/ |
| 278 | 278 | // Interrupt handlers common to all SNK triple Z80 games |
| 279 | 279 | |
| 280 | READ8_HANDLER ( snk_cpuA_nmi_trigger_r ) | |
| 280 | static READ8_HANDLER ( snk_cpuA_nmi_trigger_r ) | |
| 281 | 281 | { |
| 282 | 282 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 283 | 283 | return 0xff; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | WRITE8_HANDLER( snk_cpuA_nmi_ack_w ) | |
| 286 | static WRITE8_HANDLER( snk_cpuA_nmi_ack_w ) | |
| 287 | 287 | { |
| 288 | 288 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | READ8_HANDLER ( snk_cpuB_nmi_trigger_r ) | |
| 291 | static READ8_HANDLER ( snk_cpuB_nmi_trigger_r ) | |
| 292 | 292 | { |
| 293 | 293 | cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, ASSERT_LINE); |
| 294 | 294 | return 0xff; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | WRITE8_HANDLER( snk_cpuB_nmi_ack_w ) | |
| 297 | static WRITE8_HANDLER( snk_cpuB_nmi_ack_w ) | |
| 298 | 298 | { |
| 299 | 299 | cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, CLEAR_LINE); |
| 300 | 300 | } |
| r5955 | r5956 | |
|---|---|---|
| 281 | 281 | #define NB1_NVMEM_SIZE (0x800) |
| 282 | 282 | static UINT32 *nvmem32; |
| 283 | 283 | |
| 284 | UINT32 *namconb1_workram32; | |
| 285 | 284 | UINT32 *namconb1_spritebank32; |
| 286 | 285 | UINT32 *namconb1_tilebank32; |
| 287 | 286 | static UINT16 *namconb_shareram; |
| r0 | r5956 | |
|---|---|---|
| 1 | /* | |
| 2 | ||
| 3 | Othello (version 3.0) - Success 1984 | |
| 4 | ------------------------------------- | |
| 5 | ||
| 6 | driver by Tomasz Slanina | |
| 7 | ||
| 8 | CPU Board: | |
| 9 | D780C - main CPU (Z80) | |
| 10 | HD46505SP - CRTC | |
| 11 | D780-C - Sound CPU (Z80) | |
| 12 | AY-3-8910 x2 - Sound | |
| 13 | D7751C - ADPCM "Speech processor" | |
| 14 | D8243 - I/O Expander for D7751C (8048 based) | |
| 15 | ||
| 16 | Video Board: | |
| 17 | almost empty - 3/4 sodlering pins not populated | |
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | Todo: | |
| 22 | ||
| 23 | - hook up upd7751c sample player (it works correctly but there's main cpu side write(latch/command) missing) | |
| 24 | - correct colors (based on the color DAC (24 resistors) on pcb | |
| 25 | - cocktail mode | |
| 26 | - map a bunch of unknown read/writes (related to above i think) | |
| 27 | ||
| 28 | Notes: | |
| 29 | ||
| 30 | DSw 1:2 | |
| 31 | Limit for help/undo (matta): | |
| 32 | - when it's off, you can use each of them twice | |
| 33 | every time you win and advance to the next game | |
| 34 | - when it's on, you can only use them twice throughout the game | |
| 35 | ||
| 36 | */ | |
| 37 | ||
| 38 | #include "driver.h" | |
| 39 | #include "deprecat.h" | |
| 40 | #include "cpu/z80/z80.h" | |
| 41 | #include "sound/ay8910.h" | |
| 42 | #include "video/mc6845.h" | |
| 43 | #include "machine/i8243.h" | |
| 44 | #include "cpu/mcs48/mcs48.h" | |
| 45 | #include "sound/dac.h" | |
| 46 | ||
| 47 | static int ay_select=0; | |
| 48 | static int ack_data=0; | |
| 49 | ||
| 50 | static UINT8 n7751_command; | |
| 51 | //static UINT32 n7751_rom_address; | |
| 52 | ||
| 53 | static int tile_bank=0; | |
| 54 | ||
| 55 | static int sound_addr; | |
| 56 | static int n7751_busy; | |
| 57 | ||
| 58 | #define TILE_WIDTH 6 | |
| 59 | ||
| 60 | static MC6845_UPDATE_ROW( update_row ) | |
| 61 | { | |
| 62 | int cx,x; | |
| 63 | UINT32 data_address; | |
| 64 | UINT32 tmp; | |
| 65 | ||
| 66 | const UINT8 *gfx = memory_region(device->machine, "gfx"); | |
| 67 | ||
| 68 | for(cx=0;cx<x_count;++cx) | |
| 69 | { | |
| 70 | data_address=((videoram[ma+cx]+tile_bank)<<4)|ra; | |
| 71 | tmp=gfx[data_address]|(gfx[data_address+0x2000]<<8)|(gfx[data_address+0x4000]<<16); | |
| 72 | ||
| 73 | for(x=0;x<TILE_WIDTH;++x) | |
| 74 | { | |
| 75 | *BITMAP_ADDR16(bitmap, y, (cx*TILE_WIDTH+x)^1) = tmp&0x0f; | |
| 76 | tmp>>=4; | |
| 77 | } | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | static PALETTE_INIT( othello ) | |
| 82 | { | |
| 83 | int i; | |
| 84 | for (i = 0;i < machine->config->total_colors;i++) | |
| 85 | { | |
| 86 | palette_set_color(machine,i,MAKE_RGB(0xff,0x00,0xff)); | |
| 87 | } | |
| 88 | ||
| 89 | /* only colors 2,3,7,9,c,d,f are used */ | |
| 90 | palette_set_color(machine,0x02,MAKE_RGB(0x00,0xff,0x00)); | |
| 91 | palette_set_color(machine,0x03,MAKE_RGB(0xff,0x7f,0x00)); | |
| 92 | palette_set_color(machine,0x07,MAKE_RGB(0x00,0x00,0x00)); | |
| 93 | palette_set_color(machine,0x09,MAKE_RGB(0xff,0x00,0x00)); | |
| 94 | palette_set_color(machine,0x0c,MAKE_RGB(0x00,0x00,0xff)); | |
| 95 | palette_set_color(machine,0x0d,MAKE_RGB(0x7f,0x7f,0x00)); | |
| 96 | palette_set_color(machine,0x0f,MAKE_RGB(0xff,0xff,0xff)); | |
| 97 | } | |
| 98 | ||
| 99 | VIDEO_UPDATE( othello ) | |
| 100 | { | |
| 101 | const device_config *mc6845 = devtag_get_device(screen->machine, "crtc"); | |
| 102 | mc6845_update(mc6845, bitmap, cliprect); | |
| 103 | return 0; | |
| 104 | } | |
| 105 | ||
| 106 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 107 | AM_RANGE(0x0000, 0x1fff) AM_ROM | |
| 108 | AM_RANGE(0x8000, 0x97ff) AM_NOP /* not populated */ | |
| 109 | AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(&videoram) | |
| 110 | AM_RANGE(0xf000, 0xffff) AM_RAM | |
| 111 | ADDRESS_MAP_END | |
| 112 | ||
| 113 | static READ8_HANDLER( unk_87_r ) | |
| 114 | { | |
| 115 | /* n7751_status_r ? bit 7 = ack/status from device connected to port 8a? */ | |
| 116 | return mame_rand(space->machine); | |
| 117 | } | |
| 118 | ||
| 119 | static WRITE8_HANDLER(unk_8a_w) | |
| 120 | { | |
| 121 | /* | |
| 122 | n7751_command = (data & 0x07); | |
| 123 | cputag_set_input_line(space->machine, "n7751", 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE); | |
| 124 | //cputag_set_input_line(device->machine, "n7751", 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE); | |
| 125 | cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(100)); | |
| 126 | */ | |
| 127 | ||
| 128 | logerror("8a -> %x\n",data); | |
| 129 | } | |
| 130 | ||
| 131 | static WRITE8_HANDLER(unk_8c_w) | |
| 132 | { | |
| 133 | logerror("8c -> %x\n",data); | |
| 134 | } | |
| 135 | ||
| 136 | static READ8_HANDLER( unk_8c_r ) | |
| 137 | { | |
| 138 | return mame_rand(space->machine); | |
| 139 | } | |
| 140 | ||
| 141 | static READ8_HANDLER(sound_ack_r) | |
| 142 | { | |
| 143 | return ack_data; | |
| 144 | } | |
| 145 | ||
| 146 | static WRITE8_HANDLER(unk_8f_w) | |
| 147 | { | |
| 148 | logerror("8f -> %x\n",data); | |
| 149 | } | |
| 150 | ||
| 151 | static WRITE8_HANDLER(tilebank_w) | |
| 152 | { | |
| 153 | tile_bank=data==0x0f?0x100:0x00; | |
| 154 | logerror("tilebank -> %x\n",data); | |
| 155 | } | |
| 156 | ||
| 157 | static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 158 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 159 | AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_address_w) | |
| 160 | AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w) | |
| 161 | AM_RANGE(0x80, 0x80) AM_READ_PORT("INP") | |
| 162 | AM_RANGE(0x81, 0x81) AM_READ_PORT("SYSTEM") | |
| 163 | AM_RANGE(0x83, 0x83) AM_READ_PORT("DSW") | |
| 164 | AM_RANGE(0x86, 0x86) AM_WRITE(tilebank_w) | |
| 165 | AM_RANGE(0x87, 0x87) AM_READ(unk_87_r) | |
| 166 | AM_RANGE(0x8a, 0x8a) AM_WRITE(unk_8a_w) | |
| 167 | AM_RANGE(0x8c, 0x8c) AM_READWRITE(unk_8c_r, unk_8c_w) | |
| 168 | AM_RANGE(0x8d, 0x8d) AM_READWRITE(sound_ack_r, soundlatch_w) | |
| 169 | AM_RANGE(0x8f, 0x8f) AM_WRITE(unk_8f_w) | |
| 170 | ADDRESS_MAP_END | |
| 171 | ||
| 172 | static READ8_HANDLER(latch_r) | |
| 173 | { | |
| 174 | int retval=soundlatch_r(space,0); | |
| 175 | soundlatch_clear_w(space,0,0); | |
| 176 | return retval; | |
| 177 | } | |
| 178 | ||
| 179 | static WRITE8_HANDLER(ay_select_w) | |
| 180 | { | |
| 181 | ay_select=data; | |
| 182 | } | |
| 183 | ||
| 184 | static WRITE8_HANDLER(ack_w) | |
| 185 | { | |
| 186 | ack_data=data; | |
| 187 | } | |
| 188 | ||
| 189 | static WRITE8_HANDLER(ay_address_w) | |
| 190 | { | |
| 191 | if(ay_select&1) ay8910_address_w(devtag_get_device(space->machine, "ay1"),0,data); | |
| 192 | if(ay_select&2) ay8910_address_w(devtag_get_device(space->machine, "ay2"),0,data); | |
| 193 | } | |
| 194 | ||
| 195 | static WRITE8_HANDLER(ay_data_w) | |
| 196 | { | |
| 197 | if(ay_select&1) ay8910_data_w(devtag_get_device(space->machine, "ay1"),0,data); | |
| 198 | if(ay_select&2) ay8910_data_w(devtag_get_device(space->machine, "ay2"),0,data); | |
| 199 | ||
| 200 | } | |
| 201 | ||
| 202 | static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 203 | AM_RANGE(0x0000, 0x1fff) AM_ROM | |
| 204 | AM_RANGE(0x8000, 0x83ff) AM_RAM | |
| 205 | ADDRESS_MAP_END | |
| 206 | ||
| 207 | static ADDRESS_MAP_START( audio_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 208 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 209 | AM_RANGE(0x00, 0x00) AM_READ(latch_r) | |
| 210 | AM_RANGE(0x01, 0x01) AM_WRITE(ay_data_w) | |
| 211 | AM_RANGE(0x03, 0x03) AM_WRITE(ay_address_w) | |
| 212 | AM_RANGE(0x04, 0x04) AM_WRITE(ack_w) | |
| 213 | AM_RANGE(0x08, 0x08) AM_WRITE(ay_select_w) | |
| 214 | ADDRESS_MAP_END | |
| 215 | ||
| 216 | static WRITE8_DEVICE_HANDLER( n7751_rom_control_w ) | |
| 217 | { | |
| 218 | /* P4 - address lines 0-3 */ | |
| 219 | /* P5 - address lines 4-7 */ | |
| 220 | /* P6 - address lines 8-11 */ | |
| 221 | /* P7 - ROM selects */ | |
| 222 | switch (offset) | |
| 223 | { | |
| 224 | case 0: | |
| 225 | sound_addr = (sound_addr & ~0x00f) | ((data & 0x0f) << 0); | |
| 226 | break; | |
| 227 | ||
| 228 | case 1: | |
| 229 | sound_addr = (sound_addr & ~0x0f0) | ((data & 0x0f) << 4); | |
| 230 | break; | |
| 231 | ||
| 232 | case 2: | |
| 233 | sound_addr = (sound_addr & ~0xf00) | ((data & 0x0f) << 8); | |
| 234 | break; | |
| 235 | ||
| 236 | case 3: | |
| 237 | sound_addr &= 0xfff; | |
| 238 | { | |
| 239 | ||
| 240 | if (!(data & 0x01) ) sound_addr |= 0x0000; | |
| 241 | if (!(data & 0x02) ) sound_addr |= 0x1000; | |
| 242 | if (!(data & 0x04) ) sound_addr |= 0x2000; | |
| 243 | if (!(data & 0x08) ) sound_addr |= 0x3000; | |
| 244 | } | |
| 245 | break; | |
| 246 | } | |
| 247 | } | |
| 248 | ||
| 249 | static READ8_HANDLER( n7751_rom_r ) | |
| 250 | { | |
| 251 | return memory_region(space->machine, "n7751data")[sound_addr]; | |
| 252 | } | |
| 253 | ||
| 254 | static READ8_HANDLER( n7751_command_r ) | |
| 255 | { | |
| 256 | return 0x80 | ((n7751_command & 0x07) << 4); | |
| 257 | } | |
| 258 | ||
| 259 | static WRITE8_DEVICE_HANDLER( n7751_p2_w ) | |
| 260 | { | |
| 261 | /* write to P2; low 4 bits go to 8243 */ | |
| 262 | i8243_p2_w(device, offset, data & 0x0f); | |
| 263 | ||
| 264 | /* output of bit $80 indicates we are ready (1) or busy (0) */ | |
| 265 | /* no other outputs are used */ | |
| 266 | n7751_busy = data; | |
| 267 | } | |
| 268 | ||
| 269 | static READ8_HANDLER( n7751_t1_r ) | |
| 270 | { | |
| 271 | /* T1 - labelled as "TEST", connected to ground */ | |
| 272 | return 0; | |
| 273 | } | |
| 274 | ||
| 275 | static ADDRESS_MAP_START( n7751_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 276 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(n7751_t1_r) | |
| 277 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(n7751_command_r) | |
| 278 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(n7751_rom_r) | |
| 279 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE("dac", dac_w) | |
| 280 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE("n7751_8243", n7751_p2_w) | |
| 281 | AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("n7751_8243", i8243_prog_w) | |
| 282 | ADDRESS_MAP_END | |
| 283 | ||
| 284 | static INPUT_PORTS_START( othello ) | |
| 285 | PORT_START("DSW") | |
| 286 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:1") | |
| 287 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 288 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 289 | PORT_DIPNAME( 0x06, 0x06, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:2,3") | |
| 290 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) | |
| 291 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) | |
| 292 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_1C ) ) | |
| 293 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) | |
| 294 | PORT_DIPNAME( 0x08, 0x00, "Limit for Matta" ) PORT_DIPLOCATION("SW1:4") | |
| 295 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 296 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 297 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_DIPLOCATION("SW1:5") /* stored at $fd1e */ | |
| 298 | PORT_DIPNAME( 0x60, 0x60, "Timer (seconds)" ) PORT_DIPLOCATION("SW1:6,7") | |
| 299 | PORT_DIPSETTING( 0x00, "4" ) | |
| 300 | PORT_DIPSETTING( 0x20, "6" ) | |
| 301 | PORT_DIPSETTING( 0x40, "8" ) | |
| 302 | PORT_DIPSETTING( 0x60, "10" ) | |
| 303 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:8") | |
| 304 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) | |
| 305 | PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) | |
| 306 | ||
| 307 | PORT_START("INP") | |
| 308 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 309 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 310 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 311 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 312 | ||
| 313 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) | |
| 314 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) | |
| 315 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) | |
| 316 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) | |
| 317 | ||
| 318 | PORT_START("SYSTEM") | |
| 319 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 320 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 321 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 322 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 323 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 324 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 325 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) | |
| 326 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 327 | ||
| 328 | INPUT_PORTS_END | |
| 329 | ||
| 330 | static const mc6845_interface h46505_intf = | |
| 331 | { | |
| 332 | "screen", /* screen we are acting on */ | |
| 333 | TILE_WIDTH, /* number of pixels per video memory address */ | |
| 334 | NULL, /* before pixel update callback */ | |
| 335 | update_row, /* row update callback */ | |
| 336 | NULL, /* after pixel update callback */ | |
| 337 | DEVCB_NULL, /* callback for display state changes */ | |
| 338 | DEVCB_NULL, /* callback for cursor state changes */ | |
| 339 | DEVCB_NULL, /* HSYNC callback */ | |
| 340 | DEVCB_NULL, /* VSYNC callback */ | |
| 341 | NULL /* update address callback */ | |
| 342 | }; | |
| 343 | ||
| 344 | static MACHINE_DRIVER_START( othello ) | |
| 345 | ||
| 346 | /* basic machine hardware */ | |
| 347 | MDRV_CPU_ADD("maincpu",Z80,XTAL_8MHz/2) | |
| 348 | MDRV_CPU_PROGRAM_MAP(main_map) | |
| 349 | MDRV_CPU_IO_MAP(main_portmap) | |
| 350 | MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) | |
| 351 | ||
| 352 | MDRV_CPU_ADD("audiocpu",Z80,XTAL_3_579545MHz) | |
| 353 | MDRV_CPU_PROGRAM_MAP(audio_map) | |
| 354 | MDRV_CPU_IO_MAP(audio_portmap) | |
| 355 | ||
| 356 | MDRV_CPU_ADD("n7751", N7751, XTAL_6MHz) | |
| 357 | MDRV_CPU_IO_MAP(n7751_portmap) | |
| 358 | ||
| 359 | MDRV_I8243_ADD("n7751_8243", NULL, n7751_rom_control_w) | |
| 360 | ||
| 361 | ||
| 362 | /* video hardware */ | |
| 363 | MDRV_SCREEN_ADD("screen", RASTER) | |
| 364 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 365 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 366 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 367 | MDRV_SCREEN_SIZE(64*6, 64*8) | |
| 368 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*6-1, 0*8, 64*8-1) | |
| 369 | ||
| 370 | MDRV_PALETTE_LENGTH(0x10) | |
| 371 | MDRV_PALETTE_INIT(othello) | |
| 372 | ||
| 373 | MDRV_VIDEO_UPDATE(othello) | |
| 374 | ||
| 375 | MDRV_MC6845_ADD("crtc", H46505, 1000000 /* ? MHz */, h46505_intf) /* H46505 @ CPU clock */ | |
| 376 | ||
| 377 | /* sound hardware */ | |
| 378 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 379 | ||
| 380 | MDRV_SOUND_ADD("ay1", AY8910, 2000000) | |
| 381 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) | |
| 382 | ||
| 383 | MDRV_SOUND_ADD("ay2", AY8910, 2000000) | |
| 384 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) | |
| 385 | ||
| 386 | MDRV_SOUND_ADD("dac", DAC, 0) | |
| 387 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) | |
| 388 | MACHINE_DRIVER_END | |
| 389 | ||
| 390 | ROM_START( othello ) | |
| 391 | ROM_REGION( 0x10000, "maincpu", 0 ) | |
| 392 | ROM_LOAD( "4.ic59", 0x0000, 0x2000, CRC(9f82fe14) SHA1(59600264ccce787383827fc5aa0f2c23728f6946)) | |
| 393 | ||
| 394 | ROM_REGION( 0x10000, "audiocpu", 0 ) | |
| 395 | ROM_LOAD( "3.ic32", 0x0000, 0x2000, CRC(2bb4f75d) SHA1(29a659031acf0d50f374f440b8d353bcf98145a0)) | |
| 396 | ||
| 397 | ROM_REGION( 0x1000, "n7751", 0 ) /* 4k for 7751 onboard ROM */ | |
| 398 | ROM_LOAD( "7751.bin", 0x0000, 0x0400, CRC(6a9534fc) SHA1(67ad94674db5c2aab75785668f610f6f4eccd158) ) | |
| 399 | ||
| 400 | ROM_REGION( 0x4000, "n7751data", 0 ) /* 7751 sound data */ | |
| 401 | ROM_LOAD( "1.ic48", 0x0000, 0x2000, CRC(c3807dea) SHA1(d6339380e1239f3e20bcca2fbc673ad72e9ca608)) | |
| 402 | ROM_LOAD( "2.ic49", 0x2000, 0x2000, CRC(a945f3e7) SHA1(ea18efc18fda63ce1747287bbe2a9704b08daff8)) | |
| 403 | ||
| 404 | ROM_REGION( 0x6000, "gfx", 0 ) | |
| 405 | ROM_LOAD( "5.ic40", 0x0000, 0x2000, CRC(45fdc1ab) SHA1(f30f6002e3f34a647effac8b0116c8ed064e226a)) | |
| 406 | ROM_LOAD( "6.ic41", 0x2000, 0x2000, CRC(467a731f) SHA1(af80e854522e53fb1b9af7945b2c803a654c6f65)) | |
| 407 | ROM_LOAD( "7.ic42", 0x4000, 0x2000, CRC(a76705f7) SHA1(b7d2a65d65d065732ddd0b3b738749369b382b48)) | |
| 408 | ROM_END | |
| 409 | ||
| 410 | GAME( 1984, othello, 0, othello, othello, 0, ROT0, "Success", "Othello (version 3.0)", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND ) |
| r5955 | r5956 | |
|---|---|---|
| 811 | 811 | MDRV_CPU_PROGRAM_MAP(nsc_map) |
| 812 | 812 | |
| 813 | 813 | /* sound hardware */ |
| 814 | MDRV_SOUND_START( | |
| 814 | MDRV_SOUND_START(0 | |
| 815 | 815 | MDRV_DEVICE_REMOVE("cvsd") |
| 816 | 816 | |
| 817 | 817 | MDRV_SOUND_ADD("msm", MSM5205, XTAL_400kHz) |
| r5955 | r5956 | |
| 830 | 830 | MDRV_DEVICE_REMOVE("cpu1") |
| 831 | 831 | |
| 832 | 832 | /* sound hardware */ |
| 833 | MDRV_SOUND_START( | |
| 833 | MDRV_SOUND_START(0 | |
| 834 | 834 | MDRV_DEVICE_REMOVE("cvsd") |
| 835 | 835 | MACHINE_DRIVER_END |
| 836 | 836 |
| r5955 | r5956 | |
|---|---|---|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
| 259 | ||
| 259 | GAME | |
| 260 | 260 | |
| 261 | 261 | static READ8_HANDLER( zaccaria_prot1_r ) |
| 262 | 262 | { |
| r5955 | r5956 | |
| 269 | 269 | return 0x40; /* Jack Rabbit */ |
| 270 | 270 | |
| 271 | 271 | case 6: |
| 272 | if (space->machine->gamedrv == & | |
| 272 | if (space->machine->gamedrv == &GAME | |
| 273 | 273 | return 0x70; /* Money Money */ |
| 274 | 274 | return 0xa0; /* Jack Rabbit */ |
| 275 | 275 |
| r5955 | r5956 | |
|---|---|---|
| 891 | 891 | |
| 892 | 892 | ROM_START( warpwarp ) |
| 893 | 893 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 894 | ROM_LOAD( "g-n9601n.2r", 0x0000, 0x1000, CRC(f5262f38) SHA1(1c64d0282b0a209390a548ceeaaf8b7b55e50896) ) | |
| 895 | ROM_LOAD( "g-09602n.2m", 0x1000, 0x1000, CRC(de8355dd) SHA1(133d137711d79aaeb45cd3ee041c0be3b73e1b2f) ) | |
| 896 | ROM_LOAD( "g-09603n.1p", 0x2000, 0x1000, CRC(bdd1dec5) SHA1(bb3d9d1500e31bb271a394facaec7adc3c987e5e) ) | |
| 897 | ROM_LOAD( "g-09613n.1t", 0x3000, 0x0800, CRC(af3d77ef) SHA1(5b79aabbe14c2997e0b1a9276c483ae76814a63a) ) | |
| 894 | ROM_LOAD( "ww1_prg1.s10", 0x0000, 0x1000, CRC(f5262f38) SHA1(1c64d0282b0a209390a548ceeaaf8b7b55e50896) ) | |
| 895 | ROM_LOAD( "ww1_prg2.s8", 0x1000, 0x1000, CRC(de8355dd) SHA1(133d137711d79aaeb45cd3ee041c0be3b73e1b2f) ) | |
| 896 | ROM_LOAD( "ww1_prg3.s4", 0x2000, 0x1000, CRC(bdd1dec5) SHA1(bb3d9d1500e31bb271a394facaec7adc3c987e5e) ) | |
| 898 | 897 | |
| 899 | 898 | ROM_REGION( 0x800, "gfx1", 0 ) |
| 900 | ROM_LOAD( "g | |
| 899 | ROM_LOAD( "ww1_chg | |
| 901 | 900 | ROM_END |
| 902 | 901 | |
| 903 | 902 | ROM_START( warpwarpr ) |
| r5955 | r5956 | |
|---|---|---|
| 27 | 27 | ? (M6100430A) 89 U.S. Classic(2) Taito / RomStar |
| 28 | 28 | ? 88 Caliber 50 Taito / RomStar |
| 29 | 29 | ? 89 Arbalester Taito / RomStar |
| 30 | PO-047A ?? Seta Roulette Seta / Visco | |
| 30 | 31 | P1-036-A + P0-045-A + |
| 31 | 32 | P1-049-A 89 Meta Fox Taito / RomStar |
| 32 | 33 | P0-053-1 89 Castle of Dragon/Dragon Unit Taito / RomStar / Athena |
| r5955 | r5956 | |
| 2153 | 2154 | AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE(&spriteram16_2) // Sprites Code + X + Attr |
| 2154 | 2155 | ADDRESS_MAP_END |
| 2155 | 2156 | |
| 2157 | /*************************************************************************** | |
| 2158 | Seta Roulette | |
| 2159 | ***************************************************************************/ | |
| 2156 | 2160 | |
| 2161 | static ADDRESS_MAP_START( setaroul_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2162 | AM_RANGE(0x000000, 0x01ffff) AM_ROM // ROM | |
| 2163 | ||
| 2164 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM | |
| 2165 | AM_RANGE(0xf00000, 0xf03fff) AM_RAM | |
| 2166 | ADDRESS_MAP_END | |
| 2167 | ||
| 2157 | 2168 | /*************************************************************************** |
| 2158 | 2169 | Extreme Downhill / Sokonuke |
| 2159 | 2170 | ***************************************************************************/ |
| r5955 | r5956 | |
| 3551 | 3562 | INPUT_PORTS_END |
| 3552 | 3563 | |
| 3553 | 3564 | |
| 3565 | /*************************************************************************** | |
| 3566 | Seta Roulette | |
| 3567 | ***************************************************************************/ | |
| 3554 | 3568 | |
| 3569 | static INPUT_PORTS_START( setaroul ) | |
| 3570 | INPUT_PORTS_END | |
| 3571 | ||
| 3572 | ||
| 3555 | 3573 | /*************************************************************************** |
| 3556 | 3574 | DownTown |
| 3557 | 3575 | ***************************************************************************/ |
| r5955 | r5956 | |
| 6448 | 6466 | 16*16*2 |
| 6449 | 6467 | }; |
| 6450 | 6468 | |
| 6469 | static const gfx_layout layout_8bpp = | |
| 6470 | { | |
| 6471 | 16,16, | |
| 6472 | RGN_FRAC(1,4), | |
| 6473 | 8, | |
| 6474 | { RGN_FRAC(0,4)+0,RGN_FRAC(0,4)+4, RGN_FRAC(1,4)+0,RGN_FRAC(1,4)+4,RGN_FRAC(2,4)+0,RGN_FRAC(2,4)+4, RGN_FRAC(3,4)+0,RGN_FRAC(3,4)+4}, | |
| 6475 | {128+64,128+65,128+66,128+67, 128+0,128+1,128+2,128+3, | |
| 6476 | 8*8+0,8*8+1,8*8+2,8*8+3, 0,1,2,3}, | |
| 6477 | {0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, | |
| 6478 | 32*8,33*8,34*8,35*8,36*8,37*8,38*8,39*8}, | |
| 6479 | 16*16*2 | |
| 6480 | }; | |
| 6451 | 6481 | |
| 6452 | 6482 | |
| 6453 | 6483 | |
| r5955 | r5956 | |
| 6509 | 6539 | GFXDECODE_END |
| 6510 | 6540 | |
| 6511 | 6541 | /*************************************************************************** |
| 6542 | Seta Roulette | |
| 6543 | ***************************************************************************/ | |
| 6544 | ||
| 6545 | static GFXDECODE_START( setaroul ) | |
| 6546 | GFXDECODE_ENTRY( "gfx1", 0, layout_planes_2roms, 512*0, 32 ) // [0] Sprites | |
| 6547 | GFXDECODE_ENTRY( "gfx2", 0, layout_8bpp, 512*0, 32 ) // [1] Layer 1 | |
| 6548 | GFXDECODE_END | |
| 6549 | ||
| 6550 | /*************************************************************************** | |
| 6512 | 6551 | J.J.Squawkers |
| 6513 | 6552 | ***************************************************************************/ |
| 6514 | 6553 | |
| r5955 | r5956 | |
| 7209 | 7248 | MDRV_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 7210 | 7249 | MACHINE_DRIVER_END |
| 7211 | 7250 | |
| 7251 | /*************************************************************************** | |
| 7252 | Seta Roulette | |
| 7253 | ***************************************************************************/ | |
| 7212 | 7254 | |
| 7255 | static VIDEO_START( dummy_start ) | |
| 7256 | { | |
| 7257 | ||
| 7258 | } | |
| 7259 | ||
| 7260 | static VIDEO_UPDATE( dummy_update ) | |
| 7261 | { | |
| 7262 | return 0; | |
| 7263 | } | |
| 7264 | ||
| 7265 | static MACHINE_DRIVER_START( setaroul ) | |
| 7266 | ||
| 7267 | /* basic machine hardware */ | |
| 7268 | MDRV_CPU_ADD("maincpu", M68000, 16000000/2) /* 8 MHz */ | |
| 7269 | MDRV_CPU_PROGRAM_MAP(setaroul_map) | |
| 7270 | //MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) | |
| 7271 | ||
| 7272 | /* video hardware */ | |
| 7273 | MDRV_SCREEN_ADD("screen", RASTER) | |
| 7274 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 7275 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 7276 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 7277 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 7278 | MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1) | |
| 7279 | ||
| 7280 | MDRV_GFXDECODE(setaroul) | |
| 7281 | MDRV_PALETTE_LENGTH(512) | |
| 7282 | ||
| 7283 | MDRV_VIDEO_START(dummy_start) | |
| 7284 | //MDRV_VIDEO_EOF(seta_buffer_sprites) /* qzkklogy uses sprite buffering */ | |
| 7285 | MDRV_VIDEO_UPDATE(dummy_update) | |
| 7286 | ||
| 7287 | /* sound hardware */ | |
| 7288 | MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 7289 | ||
| 7290 | MDRV_SOUND_ADD("x1", X1_010, 16000000) /* 16 MHz */ | |
| 7291 | MDRV_SOUND_CONFIG(seta_sound_intf) | |
| 7292 | MDRV_SOUND_ROUTE(0, "lspeaker", 1.0) | |
| 7293 | MDRV_SOUND_ROUTE(1, "rspeaker", 1.0) | |
| 7294 | MACHINE_DRIVER_END | |
| 7295 | ||
| 7296 | ||
| 7213 | 7297 | /*************************************************************************** |
| 7214 | 7298 | Eight Force |
| 7215 | 7299 | ***************************************************************************/ |
| r5955 | r5956 | |
| 9474 | 9558 | ROM_LOAD( "ya_011_012.u64", 0x80000, 0x80000, CRC(a8015ce6) SHA1(bb0b589856ec82e1fd42be9af89b07ba1d17e595) ) |
| 9475 | 9559 | ROM_END |
| 9476 | 9560 | |
| 9561 | /* | |
| 9562 | PCB PO-047A | |
| 9477 | 9563 | |
| 9564 | 3x8 DSW | |
| 9565 | SETA X1-004 (826100) (input) | |
| 9566 | SETA X1-010 (811101) (sound) | |
| 9567 | MC68B50P (timer?) | |
| 9568 | M68000 | |
| 9569 | 16Mhz OSC, near CPU | |
| 9570 | SETA X1-002A (sprites? - near 005 - 008) | |
| 9571 | SETA X1-001A (sprites? ^) | |
| 9572 | SETA X1-007 (737100) | |
| 9573 | SETA X1-011 | |
| 9574 | SETA X1-012 | |
| 9575 | */ | |
| 9478 | 9576 | |
| 9577 | ROM_START( setaroul ) | |
| 9578 | ROM_REGION( 0x0c0000, "maincpu", 0 ) /* 68000 Code */ | |
| 9579 | ROM_LOAD16_BYTE( "uf1002.u14", 0x000000, 0x010000, CRC(b3a622b0) SHA1(bc4a02167002579149c19640e65e679b7c19fa66) ) | |
| 9580 | ROM_LOAD16_BYTE( "uf1003.u16", 0x000001, 0x010000, CRC(a6afd769) SHA1(82c54c8a2219f20d08faf9f7afcf821d83511660) ) | |
| 9581 | ||
| 9582 | ROM_REGION( 0x020000, "gfx1", 0 ) /* Sprites */ | |
| 9583 | ROM_LOAD16_BYTE( "uf0005.u3", 0x000000, 0x008000, CRC(383c2d57) SHA1(3bbf0464f80f657dfa275e885fbce064a0a08f4a) ) | |
| 9584 | ROM_LOAD16_BYTE( "uf0006.u4", 0x000001, 0x008000, CRC(90c9dae6) SHA1(a226aab82f5b8174644281fa3efab4f8a8f8d827) ) | |
| 9585 | ROM_LOAD16_BYTE( "uf0007.u5", 0x010000, 0x008000, CRC(e72c3dba) SHA1(aaebb484e76d8f3da0ecff26c3c1bad4f3f11ac0) ) | |
| 9586 | ROM_LOAD16_BYTE( "uf0008.u6", 0x010001, 0x008000, CRC(e198e602) SHA1(f53fa36d1ea51239e71fe1ea7432bb4b7b8b3466) ) | |
| 9587 | ||
| 9588 | ROM_REGION( 0x400000, "gfx2", 0 ) /* Layer 1 - 8bpp? */ | |
| 9589 | ROM_LOAD( "uf0010.u15", 0x000000, 0x080000, CRC(0af13a56) SHA1(c294b7947d004c0e0b280ca44636e4059e05a57e) ) | |
| 9590 | ROM_LOAD( "uf0009.u13", 0x080000, 0x080000, CRC(20f2d7f5) SHA1(343a8fac76d6ee7f845f9988c491698ebd0150d4) ) | |
| 9591 | ROM_LOAD( "uf0012.u29", 0x100000, 0x080000, CRC(cba2a6b7) SHA1(8627eda24c6980a0e786fd9dc06176893a33c58f) ) | |
| 9592 | ROM_LOAD( "uf0011.u22", 0x180000, 0x080000, CRC(af60adf9) SHA1(6505cbce6e066d75b779fdbe2c034ba4daabbefe) ) | |
| 9593 | ROM_LOAD( "uf0014.u38", 0x200000, 0x080000, CRC(da2bd4e4) SHA1(244af8705f2fa4ab3f3a002af16a0e4d60e03de8) ) | |
| 9594 | ROM_LOAD( "uf0013.u37", 0x280000, 0x080000, CRC(645ec3c3) SHA1(e9b8056c68bf33b0b7130a5ce2bafd11dfd6c29b) ) | |
| 9595 | ROM_LOAD( "uf0015.u40", 0x300000, 0x080000, CRC(11dc19fa) SHA1(e7084f61d075a61249d924a523c32e7993d9ae46) ) | |
| 9596 | ROM_LOAD( "uf0016.u48", 0x380000, 0x080000, CRC(10f99fa8) SHA1(7ef9a3f71dd071483cf3513ef57e2fcfe8702994) ) | |
| 9597 | ||
| 9598 | ROM_REGION( 0x100000, "x1", 0 ) /* Samples */ | |
| 9599 | ROM_LOAD( "uf1004.u52", 0x000000, 0x020000, CRC(d63ea334) SHA1(93aaf58c90c4f704caae19b63785e471b2c1281a) ) | |
| 9600 | ||
| 9601 | ROM_REGION( 0x400, "proms", 0 ) | |
| 9602 | ROM_LOAD16_BYTE( "uf-017", 0x000, 0x200, NO_DUMP ) | |
| 9603 | ROM_LOAD16_BYTE( "uf-018", 0x001, 0x200, NO_DUMP ) | |
| 9604 | ROM_END | |
| 9605 | ||
| 9479 | 9606 | static READ16_HANDLER( twineagl_debug_r ) |
| 9480 | 9607 | { |
| 9481 | 9608 | /* At several points in the code, the program checks if four |
| r5955 | r5956 | |
| 9762 | 9889 | GAME( 1989, metafox, 0, metafox, metafox, metafox, ROT270, "Seta", "Meta Fox" , 0) // Country/License: DSW |
| 9763 | 9890 | |
| 9764 | 9891 | /* 68000 */ |
| 9892 | GAME( 198?, setaroul, 0, setaroul, setaroul, 0, ROT270, "Seta / Visco", "Seta Roulette?", 0 ) // I can't see a title in the GFX roms or program but it seems to have roulette GFX | |
| 9765 | 9893 | GAME( 1989, drgnunit, 0, drgnunit, drgnunit, 0, ROT0, "Seta", "Dragon Unit / Castle of Dragon", 0 ) |
| 9766 | 9894 | GAME( 1989, wits, 0, wits, wits, 0, ROT0, "Athena (Visco license)", "Wit's (Japan)" , 0) // Country/License: DSW |
| 9767 | 9895 | GAME( 1990, thunderl, 0, thunderl, thunderl, 0, ROT270, "Seta", "Thunder & Lightning" , 0) // Country/License: DSW |
| r5955 | r5956 | |
|---|---|---|
| 4070 | 4070 | ROM_REGION( 0x200000, "maincpu", 0) |
| 4071 | 4071 | NAOMI_BIOS |
| 4072 | 4072 | |
| 4073 | ROM_REGION( 0x | |
| 4073 | ROM_REGION( 0x10000000, "user1", ROMREGION_ERASEFF) | |
| 4074 | 4074 | ROM_LOAD( "bhf1vere.2f", 0x0000000, 0x0800000, CRC(121ea283) SHA1(e4bf2b90fa3d42727b8393ffa2c5a8863914a630) ) |
| 4075 | 4075 | ROM_LOAD( "bhf1ma2.4m", 0x2000000, 0x1000000, CRC(8073dec7) SHA1(2d4173ff0de37b95a8cb02e1b572a9cdeb448c24) ) |
| 4076 | ROM_LOAD( "bhf1ma3.4l", 0x3000000, 0x1000000, CRC(43cd16a4) SHA1(86258df34b652a614129efd4c825c62ff1382318) ) | |
| 4077 | ROM_LOAD( "bhf1ma4.4k", 0x4000000, 0x1000000, CRC(f6aebed8) SHA1(687057aacb45ebffe3b5cf2b8dd52d24039392f1) ) | |
| 4078 | ROM_LOAD( "bhf1ma5.4j", 0x5000000, 0x1000000, CRC(b5e1b582) SHA1(47763113e6917bbf48840292c08d4f63c3ce085a) ) | |
| 4079 | ROM_LOAD( "bhf1ma6.4h", 0x6000000, 0x1000000, CRC(345fd824) SHA1(61ebc12c7cd7f2e2c5173cc0f57240855ec99c6f) ) | |
| 4080 | ROM_LOAD( "bhf1ma7.4f", 0x7000000, 0x1000000, CRC(465ecff1) SHA1(f9eabc77ed8135fa77c8e40335e6b3df1a64042c) ) | |
| 4081 | ROM_LOAD( "bhf1ma8.4d", 0x8000000, 0x1000000, CRC(76c92354) SHA1(0049b10144d65f574d14d9ad9d1d5380bf154532) ) | |
| 4082 | ROM_LOAD( "bhf1ma9.4e", 0x9000000, 0x1000000, CRC(d45a46ee) SHA1(c12764f5ba17f10fb309e47450bb89fbef51e252) ) | |
| 4083 | ROM_LOAD( "bhf1ma10.4c", 0xa000000, 0x1000000, CRC(8c38d1f7) SHA1(3fbc280590c49fa094c1fc1e23d6c9d0031298c5) ) | |
| 4084 | ROM_LOAD( "bhf1ma11.4b", 0xb000000, 0x1000000, CRC(f49153c4) SHA1(85d5583cac492317ba52dc7a31a443f5f26a67c9) ) | |
| 4085 | ROM_LOAD( "bhf1ma12.6p", 0xc000000, 0x1000000, CRC(0e2bdd9a) SHA1(e2f82d2c9e33da1a297d79a0324558d0ff614172) ) | |
| 4086 | ROM_LOAD( "bhf1ma13.6n", 0xd000000, 0x1000000, CRC(055718ad) SHA1(355c4780231a4361aa6237dd34819b60d9df0fc7) ) | |
| 4087 | ROM_LOAD( "bhf1ma14.6m", 0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) ) | |
| 4088 | ROM_LOAD( "bhf1ma15.6l", 0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) ) | |
| 4076 | 4089 | ROM_END |
| 4077 | 4090 | |
| 4091 | ||
| 4078 | 4092 | /* GD-ROM titles - a PIC supplies a decryption key |
| 4079 | 4093 | |
| 4080 | 4094 | PIC stuff |
| r5955 | r5956 | |
| 5280 | 5294 | ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) ) |
| 5281 | 5295 | ROM_END |
| 5282 | 5296 | |
| 5297 | /* | |
| 5298 | This is the same nonsense layout rom board as gram2000, and just like | |
| 5299 | that it tests IC1 which doesn't exist - is it a mirror, or protection | |
| 5300 | related? There is no physical rom for it, also note, the roms are | |
| 5301 | interleaved, so each test is testing 2 roms and the labeling / ic | |
| 5302 | positions on the cart don't relate to the display in test mode. | |
| 5303 | ||
| 5304 | Desired IC1 @ 0x800000 sums from the header = 9f39 fdc4 | |
| 5305 | ||
| 5306 | We need a USB dump of this from 0x800000 to 0x1000000. | |
| 5307 | */ | |
| 5308 | ROM_START( vf4evoct ) | |
| 5309 | NAOMI2_BIOS | |
| 5310 | ||
| 5311 | ROM_REGION( 0xb000000, "user1", ROMREGION_ERASEFF) | |
| 5312 | ROM_LOAD( "epr-23934.ic11", 0x0000000, 0x400000, CRC(656a7d84) SHA1(e407ddc923b399de99cb06a8831ef8fb328cfe64) ) | |
| 5313 | ROM_LOAD32_WORD( "mpr-23912.ic17s", 0x1000000, 0x800000, CRC(b2b13d97) SHA1(978bcdab7e4f220b464d5b9fa27870b5176283ca) ) | |
| 5314 | ROM_LOAD32_WORD( "mpr-23913.ic18", 0x1000002, 0x800000, CRC(560de9d2) SHA1(e065abb62346f5e50f654ac77beb54ee1bfc1a08) ) | |
| 5315 | ROM_LOAD32_WORD( "mpr-23914.ic19s", 0x2000000, 0x800000, CRC(a2104728) SHA1(48b752b6266b4d44fcb16fe179fb44ca58e11db0) ) | |
| 5316 | ROM_LOAD32_WORD( "mpr-23915.ic20", 0x2000002, 0x800000, CRC(295d32f0) SHA1(4cabb1ab54dad2cef7207f8d7a78f609d35800fb) ) | |
| 5317 | ROM_LOAD32_WORD( "mpr-23916.ic21s", 0x3000000, 0x800000, CRC(d725fdd3) SHA1(ab3a79dfcbaa65b5a085a429bcb76c1d3940d590) ) | |
| 5318 | ROM_LOAD32_WORD( "mpr-23917.ic22", 0x3000002, 0x800000, CRC(8794c8e8) SHA1(a2542ad8c063f77749fbc4429ec74bba26939556) ) | |
| 5319 | ROM_LOAD32_WORD( "mpr-23918.ic23s", 0x4000000, 0x800000, CRC(7a3da170) SHA1(72d05430cd8cd12c47ccd36bf171eaadfb987708) ) | |
| 5320 | ROM_LOAD32_WORD( "mpr-23919.ic24", 0x4000002, 0x800000, CRC(59601746) SHA1(514b00ee44d64593c2d257b48ac20b42ee2a402a) ) | |
| 5321 | ROM_LOAD32_WORD( "mpr-23920.ic25s", 0x5000000, 0x800000, CRC(6ae07021) SHA1(b018db4f868d9ebcde44759d8aea44d789958087) ) | |
| 5322 | ROM_LOAD32_WORD( "mpr-23921.ic26", 0x5000002, 0x800000, CRC(42028253) SHA1(aa5a3953e4306f4f69c1be568d515af249e6ab1e) ) | |
| 5323 | ROM_LOAD32_WORD( "mpr-23922.ic27s", 0x6000000, 0x800000, CRC(baf47df2) SHA1(d5c04e03a69a4ac8c8c066c0c750bef236e8c172) ) | |
| 5324 | ROM_LOAD32_WORD( "mpr-23923.ic28", 0x6000002, 0x800000, CRC(5c31b7e7) SHA1(cf1307400f7bd4b8dda840544a348eee34710256) ) | |
| 5325 | ROM_LOAD32_WORD( "mpr-23924.ic29", 0x7000000, 0x800000, CRC(6dfe19d9) SHA1(99b13ef752c7b8f7812ea5c3bce19cbf122008b6) ) | |
| 5326 | ROM_LOAD32_WORD( "mpr-23925.ic30s", 0x7000002, 0x800000, CRC(e9ec870a) SHA1(cdf385096e7fe15de98cea6ae5aabf3016e007a9) ) | |
| 5327 | ROM_LOAD32_WORD( "mpr-23926.ic31", 0x8000000, 0x800000, CRC(2c650728) SHA1(328748b2c786eb77c9d05280e88367cfb7b79777) ) | |
| 5328 | ROM_LOAD32_WORD( "mpr-23927.ic32s", 0x8000002, 0x800000, CRC(f36a765b) SHA1(ecd09db0961b0d11000c8744a2cfcf3fa473eea6) ) | |
| 5329 | ROM_LOAD32_WORD( "mpr-23928.ic33", 0x9000000, 0x800000, CRC(0ee92b02) SHA1(d0d26f4257a022b42b59cf4f9305a3cb2dc67f4b) ) | |
| 5330 | ROM_LOAD32_WORD( "mpr-23929.ic34s", 0x9000002, 0x800000, CRC(d768f242) SHA1(3ade29b094308d870ecac53cfe77b843d50af85a) ) | |
| 5331 | ROM_LOAD32_WORD( "mpr-23930.ic35", 0xa000000, 0x800000, CRC(0e45e4c4) SHA1(974b83d4cc35e8ac9f83d04ebd395f1e2196e829) ) | |
| 5332 | ROM_LOAD32_WORD( "mpr-23931.ic36s", 0xa000002, 0x800000, CRC(12ecd2f0) SHA1(3222d4d9d3e30c297a072a8888c28503306db40c) ) | |
| 5333 | ROM_END | |
| 5334 | ||
| 5283 | 5335 | ROM_START( clubkrte ) |
| 5284 | 5336 | NAOMI2_BIOS |
| 5285 | 5337 | |
| r5955 | r5956 | |
| 5532 | 5584 | /* Complete Dumps */ |
| 5533 | 5585 | GAME( 2001, vstrik3c, naomi2, naomi, naomi, 0, ROT0, "Sega", "Virtua Striker 3 (Cart) (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 5534 | 5586 | GAME( 2001, wldrider, naomi2, naomi, naomi, 0, ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 5535 | GAME( 2001, vf4cart, naomi2, naomi, naomi, 0, ROT0, "Sega", "Virtua Fighter 4 (Cart)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 5587 | GAME( 2001, vf4cart, naomi2, naomi, naomi, 0, ROT0, "Sega", "Virtua Fighter 4 (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 5588 | GAME( 2001, vf4evoct, naomi2, naomi, naomi, 0, ROT0, "Sega", "Virtua Fighter 4 Evolution (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) | |
| 5536 | 5589 | GAME( 2002, clubkrte, naomi2, naomi, naomi, 0, ROT0, "Sega", "Club Kart: European Session", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
| 5537 | 5590 | |
| 5538 | 5591 | /* GDS-xxxx (Sega first party games) */ |
| r5955 | r5956 | |
|---|---|---|
| 91 | 91 | #include "sound/sn76496.h" |
| 92 | 92 | #include "rendlay.h" |
| 93 | 93 | |
| 94 | #include "sega | |
| 94 | #include "segamsys.h" | |
| 95 | 95 | #include "genesis.h" |
| 96 | 96 | #include "megadriv.h" |
| 97 | 97 | |
| r5955 | r5956 | |
| 248 | 248 | return (mt_cart_select_reg); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | static READ8_HANDLER( z80_unmapped_port_r ) | |
| 252 | { | |
| 253 | printf("unmapped z80 port read %04x\n",offset); | |
| 254 | return 0; | |
| 255 | } | |
| 256 | ||
| 257 | static WRITE8_HANDLER( z80_unmapped_port_w ) | |
| 258 | { | |
| 259 | printf("unmapped z80 port write %04x\n",offset); | |
| 260 | } | |
| 261 | ||
| 262 | static READ8_HANDLER( z80_unmapped_r ) | |
| 263 | { | |
| 264 | printf("unmapped z80 read %04x\n",offset); | |
| 265 | return 0; | |
| 266 | } | |
| 267 | ||
| 268 | static WRITE8_HANDLER( z80_unmapped_w ) | |
| 269 | { | |
| 270 | printf("unmapped z80 write %04x\n",offset); | |
| 271 | } | |
| 272 | ||
| 273 | static UINT8* sms_mainram; | |
| 274 | static UINT8* sms_rom; | |
| 275 | ||
| 276 | ||
| 277 | static WRITE8_HANDLER( mt_sms_standard_rom_bank_w ) | |
| 278 | { | |
| 279 | int bank = data&0x1f; | |
| 280 | //logerror("bank w %02x %02x\n", offset, data); | |
| 281 | ||
| 282 | sms_mainram[0x1ffc+offset] = data; | |
| 283 | switch (offset) | |
| 284 | { | |
| 285 | case 0: | |
| 286 | logerror("bank w %02x %02x\n", offset, data); | |
| 287 | memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); | |
| 288 | ||
| 289 | //printf("bank ram??\n"); | |
| 290 | break; | |
| 291 | case 1: | |
| 292 | memcpy(sms_rom+0x0000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 293 | break; | |
| 294 | case 2: | |
| 295 | memcpy(sms_rom+0x4000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 296 | break; | |
| 297 | case 3: | |
| 298 | memcpy(sms_rom+0x8000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 299 | break; | |
| 300 | ||
| 301 | } | |
| 302 | } | |
| 303 | ||
| 304 | 251 | #ifdef UNUSED_FUNCTION |
| 305 | 252 | READ8_HANDLER( md_sms_ioport_dc_r ) |
| 306 | 253 | { |
| r5955 | r5956 | |
| 315 | 262 | |
| 316 | 263 | |
| 317 | 264 | |
| 318 | static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine) | |
| 319 | { | |
| 320 | /* INIT THE PORTS *********************************************************************************************/ | |
| 321 | 265 | |
| 322 | const address_space *io = cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_IO); | |
| 323 | const device_config *sn = devtag_get_device(machine, "sn"); | |
| 324 | ||
| 325 | memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); | |
| 326 | ||
| 327 | memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r); | |
| 328 | memory_install_write8_device_handler(io, sn, 0x7e, 0x7f, 0, 0, sn76496_w); | |
| 329 | memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w); | |
| 330 | memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w); | |
| 331 | ||
| 332 | memory_install_read8_handler (io, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris | |
| 333 | ||
| 334 | memory_install_read8_handler (io, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r); | |
| 335 | memory_install_read8_handler (io, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r); | |
| 336 | memory_install_read8_handler (io, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r); | |
| 337 | memory_install_read8_handler (io, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family | |
| 338 | } | |
| 339 | ||
| 340 | static void megatech_set_genz80_as_sms_standard_map(running_machine *machine) | |
| 341 | { | |
| 342 | /* INIT THE MEMMAP / BANKING *********************************************************************************/ | |
| 343 | ||
| 344 | /* catch any addresses that don't get mapped */ | |
| 345 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); | |
| 346 | ||
| 347 | /* fixed rom bank area */ | |
| 348 | sms_rom = auto_alloc_array(machine, UINT8, 0x400000); | |
| 349 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); | |
| 350 | memory_set_bankptr(machine, 5, sms_rom ); | |
| 351 | ||
| 352 | memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000); | |
| 353 | ||
| 354 | /* main ram area */ | |
| 355 | sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram | |
| 356 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); | |
| 357 | memory_set_bankptr(machine, 6, sms_mainram ); | |
| 358 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); | |
| 359 | memory_set_bankptr(machine, 7, sms_mainram ); | |
| 360 | memset(sms_mainram,0x00,0x2000); | |
| 361 | ||
| 362 | memory_install_write8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w); | |
| 363 | ||
| 364 | megatech_set_genz80_as_sms_standard_ports(machine); | |
| 365 | // smsgg_backupram = NULL; | |
| 366 | ||
| 367 | } | |
| 368 | ||
| 369 | 266 | static void megatech_select_game(running_machine *machine, int gameno) |
| 370 | 267 | { |
| 371 | 268 | UINT8* game_region; |
| r5955 | r5956 | |
| 402 | 299 | { |
| 403 | 300 | printf("SMS cart!!, CPU not running\n"); |
| 404 | 301 | current_game_is_sms = 1; |
| 405 | megatech_set_genz80_as_sms_standard_map(machine); | |
| 302 | megatech_set_genz80_as_sms_standard_map(machine, "genesis_snd_z80", MAPPER_STANDARD); | |
| 406 | 303 | cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, CLEAR_LINE); |
| 407 | 304 | cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, CLEAR_LINE); |
| 408 | 305 | |
| r5955 | r5956 | |
| 412 | 309 | { |
| 413 | 310 | printf("Genesis Cart, CPU0 running\n"); |
| 414 | 311 | current_game_is_sms = 0; |
| 415 | megatech_set_megadrive_z80_as_megadrive_z80(machine); | |
| 312 | megatech_set_megadrive_z80_as_megadrive_z80(machine, "genesis_snd_z80"); | |
| 416 | 313 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE); |
| 417 | 314 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 418 | 315 | } |
| r5955 | r5956 | |
|---|---|---|
| 975 | 975 | ROM_LOAD( "8e", 0x0000, 0x1000, CRC(277c1de5) SHA1(30bc57263e8dad870c501c76bce6f42d69ab9e00) ) |
| 976 | 976 | |
| 977 | 977 | ROM_REGION( 0x0100, "gfx2", 0 ) |
| 978 | ROM_LOAD( "rx-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 978 | ROM_LOAD( "rx1-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 979 | 979 | |
| 980 | 980 | ROM_REGION( 0x0160, "proms", 0 ) |
| 981 | ROM_LOAD( "rx-1.11n", 0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) ) /* Prom type: M3-7603-5 - palette */ | |
| 982 | ROM_LOAD( "rx-7.8p", 0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) ) /* Prom type: IM5623 - lookup table */ | |
| 983 | ROM_LOAD( "rx-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 984 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 981 | ROM_LOAD( "rx1-1.11n", 0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) ) /* Prom type: M3-7603-5 - palette */ | |
| 982 | ROM_LOAD( "rx1-7.8p", 0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) ) /* Prom type: IM5623 - lookup table */ | |
| 983 | ROM_LOAD( "rx1-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 984 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 985 | 985 | |
| 986 | 986 | ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */ |
| 987 | ROM_LOAD( "rx-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 988 | ROM_LOAD( "rx-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 987 | ROM_LOAD( "rx1-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 988 | ROM_LOAD( "rx1-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 989 | 989 | ROM_END |
| 990 | 990 | |
| 991 | ROM_START( rallyxa ) | |
| 992 | ROM_REGION( 0x10000, "maincpu", 0 ) | |
| 993 | ROM_LOAD( "rx1_prg_1.1b", 0x0000, 0x0800, CRC(ef9238db) SHA1(44313381652916a59a8d9959fb170184578472af) ) | |
| 994 | ROM_LOAD( "rx1_prg_2.1c", 0x0800, 0x0800, CRC(7cbeb656) SHA1(ff6e669f7d3e91c1cc835106cccefcd81aa28bb8) ) | |
| 995 | ROM_LOAD( "rx1_prg_3.1d", 0x1000, 0x0800, CRC(334b1042) SHA1(348a303eb8f03f19e5060d81f733d3145113abd5) ) | |
| 996 | ROM_LOAD( "rx1_prg_4.1e", 0x1800, 0x0800, CRC(d6618add) SHA1(4c66160996f3195a83628f486789721935d2cf5b) ) | |
| 997 | ROM_LOAD( "rx1_prg_5.bin", 0x2000, 0x0800, CRC(3d69f24e) SHA1(fe5a43b7144f62d28aaf0dd92e1d02ef9199b132) ) | |
| 998 | ROM_LOAD( "rx1_prg_6.bin", 0x2800, 0x0800, CRC(e9740f16) SHA1(02a134ccd3d6557d46492747b04da02e933aa6b4) ) | |
| 999 | ROM_LOAD( "rx1_prg_7.1k", 0x3000, 0x0800, CRC(843109f2) SHA1(7241d1025f249d23a0d15b5e31fdb2f5297ffbf4) ) | |
| 1000 | ROM_LOAD( "rx1_prg_8.1l", 0x3800, 0x0800, CRC(9b846ec9) SHA1(1fd8cce517f31a15e06cf250bc50b5a663424877) ) | |
| 1001 | ||
| 1002 | ROM_REGION( 0x1000, "gfx1", 0 ) | |
| 1003 | ROM_LOAD( "rx1_chg_1.8e", 0x0000, 0x0800, CRC(1fff38a4) SHA1(5f6ccce2e0daad5915d017e8d067f187eb2ed41d) ) | |
| 1004 | ROM_LOAD( "rx1_chg_2.8d", 0x0800, 0x0800, CRC(68dff552) SHA1(5dad38db45afbd79b5627a75b295fc920ad68856) ) | |
| 1005 | ||
| 1006 | ROM_REGION( 0x0100, "gfx2", 0 ) | |
| 1007 | ROM_LOAD( "rx1-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 1008 | ||
| 1009 | ROM_REGION( 0x0160, "proms", 0 ) | |
| 1010 | ROM_LOAD( "rx1-1.11n", 0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) ) /* Prom type: M3-7603-5 - palette */ | |
| 1011 | ROM_LOAD( "rx1-7.8p", 0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) ) /* Prom type: IM5623 - lookup table */ | |
| 1012 | ROM_LOAD( "rx1-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1013 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 1014 | ||
| 1015 | ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */ | |
| 1016 | ROM_LOAD( "rx1-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 1017 | ROM_LOAD( "rx1-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1018 | ROM_END | |
| 1019 | ||
| 991 | 1020 | ROM_START( rallyxm ) |
| 992 | 1021 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 993 | 1022 | ROM_LOAD( "1b", 0x0000, 0x1000, CRC(5882700d) SHA1(b6029e9730f1694894fe8b729ac0ba8d6712dea9) ) |
| r5955 | r5956 | |
| 999 | 1028 | ROM_LOAD( "8e", 0x0000, 0x1000, CRC(277c1de5) SHA1(30bc57263e8dad870c501c76bce6f42d69ab9e00) ) |
| 1000 | 1029 | |
| 1001 | 1030 | ROM_REGION( 0x0100, "gfx2", 0 ) |
| 1002 | ROM_LOAD( "rx-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 1031 | ROM_LOAD( "rx1-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 1003 | 1032 | |
| 1004 | 1033 | ROM_REGION( 0x0160, "proms", 0 ) |
| 1005 | ROM_LOAD( "rx-1.11n", 0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) ) /* Prom type: M3-7603-5 - palette */ | |
| 1006 | ROM_LOAD( "rx-7.8p", 0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) ) /* Prom type: IM5623 - lookup table */ | |
| 1007 | ROM_LOAD( "rx-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1008 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 1034 | ROM_LOAD( "rx1-1.11n", 0x0000, 0x0020, CRC(c7865434) SHA1(70c1c9610ba6f1ead77f347e7132958958bccb31) ) /* Prom type: M3-7603-5 - palette */ | |
| 1035 | ROM_LOAD( "rx1-7.8p", 0x0020, 0x0100, CRC(834d4fda) SHA1(617864d3df0917a513e8255ad8d96ae7a04da5a1) ) /* Prom type: IM5623 - lookup table */ | |
| 1036 | ROM_LOAD( "rx1-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1037 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 1009 | 1038 | |
| 1010 | 1039 | ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */ |
| 1011 | ROM_LOAD( "rx-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 1012 | ROM_LOAD( "rx-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1040 | ROM_LOAD( "rx1-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 1041 | ROM_LOAD( "rx1-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1013 | 1042 | ROM_END |
| 1014 | 1043 | |
| 1015 | 1044 | ROM_START( nrallyx ) |
| 1016 | 1045 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 1046 | ROM_LOAD( "nrx_prg1.1d", 0x0000, 0x0800, CRC(ba7de9fc) SHA1(2133ca327589600bcbd796c213f034daa0457f72) ) | |
| 1047 | ROM_CONTINUE( 0x1000, 0x0800 ) | |
| 1048 | ROM_LOAD( "nrx_prg2.1e", 0x0800, 0x0800, CRC(eedfccae) SHA1(9fca8500f724864a2b73e38bd40cbaeef41617d7) ) | |
| 1049 | ROM_CONTINUE( 0x1800, 0x0800 ) | |
| 1050 | ROM_LOAD( "nrx_prg3.1k", 0x2000, 0x0800, CRC(b4d5d34a) SHA1(c533470aac040b3471d79fd6d35beb4fd4b5bb19) ) | |
| 1051 | ROM_CONTINUE( 0x3000, 0x0800 ) | |
| 1052 | ROM_LOAD( "nrx_prg4.1l", 0x2800, 0x0800, CRC(7da5496d) SHA1(ffac2c07dda57285673073266712fa2987e3b34f) ) | |
| 1053 | ROM_CONTINUE( 0x3800, 0x0800 ) | |
| 1054 | ||
| 1055 | ROM_REGION( 0x1000, "gfx1", 0 ) | |
| 1056 | ROM_LOAD( "nrx_chg1.8e", 0x0000, 0x0800, CRC(1fff38a4) SHA1(5f6ccce2e0daad5915d017e8d067f187eb2ed41d) ) | |
| 1057 | ROM_LOAD( "nrx_chg2.8d", 0x0800, 0x0800, CRC(85d9fffd) SHA1(12dff66d98a808b9dc952b2d87a56308b46a973e) ) | |
| 1058 | ||
| 1059 | ROM_REGION( 0x0100, "gfx2", 0 ) | |
| 1060 | ROM_LOAD( "rx1-6.8m", 0x0000, 0x0100, CRC(3c16f62c) SHA1(7a3800be410e306cf85753b9953ffc5575afbcd6) ) /* Prom type: IM5623 - dots */ | |
| 1061 | ||
| 1062 | ROM_REGION( 0x0160, "proms", 0 ) | |
| 1063 | ROM_LOAD( "nrx1-1.11n", 0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) ) /* Prom type: M3-7603-5 - palette */ | |
| 1064 | ROM_LOAD( "nrx1-7.8p", 0x0020, 0x0100, CRC(4e46f485) SHA1(3f013aafba96a76d410f2db16d1d24d2fb257aaf) ) /* Prom type: IM5623 - lookup table */ | |
| 1065 | ROM_LOAD( "rx1-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1066 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ | |
| 1067 | ||
| 1068 | ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */ | |
| 1069 | ROM_LOAD( "rx1-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 1070 | ROM_LOAD( "rx1-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1071 | ROM_END | |
| 1072 | ||
| 1073 | ROM_START( nrallyxb ) | |
| 1074 | ROM_REGION( 0x10000, "maincpu", 0 ) | |
| 1017 | 1075 | ROM_LOAD( "nrallyx.1b", 0x0000, 0x1000, CRC(9404c8d6) SHA1(ee7e45c22a2fbf72d3ac5ac26ab1111a22623fc5) ) |
| 1018 | 1076 | ROM_LOAD( "nrallyx.1e", 0x1000, 0x1000, CRC(ac01bf3f) SHA1(8e1a7cce92ef709d18727db6ee7f89936f4b8df8) ) |
| 1019 | 1077 | ROM_LOAD( "nrallyx.1h", 0x2000, 0x1000, CRC(aeba29b5) SHA1(2a6e4568729b83c430bf70e43c4146ad6a556b1b) ) |
| r5955 | r5956 | |
| 1023 | 1081 | ROM_LOAD( "nrallyx.8e", 0x0000, 0x1000, CRC(ca7a174a) SHA1(dc553df18c45ba399661122be75b71d6cb54d6a2) ) |
| 1024 | 1082 | |
| 1025 | 1083 | ROM_REGION( 0x0100, "gfx2", 0 ) |
| 1026 | ROM_LOAD( "rx-6.8m", | |
| 1084 | ROM_LOAD( "rx1-6.8m", | |
| 1027 | 1085 | |
| 1028 | 1086 | ROM_REGION( 0x0160, "proms", 0 ) |
| 1029 | ROM_LOAD( "nrallyx.pr1", 0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) ) /* Prom type: M3-7603-5 - palette */ | |
| 1030 | ROM_LOAD( "nrallyx.pr2", 0x0020, 0x0100, CRC(b2b7ca15) SHA1(e604d58f2f20ebf042f28b01e74eddeacf5baba9) ) /* Prom type: IM5623 - lookup table */ | |
| 1031 | ROM_LOAD( "rx-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1087 | ROM_LOAD( "nrx1-1.11n", 0x0000, 0x0020, CRC(a0a49017) SHA1(494c920a157e9f876d533c1b0146275a366c4989) ) /* Prom type: M3-7603-5 - palette */ | |
| 1088 | ROM_LOAD( "nrx1-7.8p", 0x0020, 0x0100, CRC(4e46f485) SHA1(3f013aafba96a76d410f2db16d1d24d2fb257aaf) ) /* Prom type: IM5623 - lookup table */ | |
| 1089 | ROM_LOAD( "rx1-2.4n", 0x0120, 0x0020, CRC(8f574815) SHA1(4f84162db9d58b64742c67dc689eb665b9862fb3) ) /* Prom type: N82S123N - video layout (not used) */ | |
| 1032 | 1090 | ROM_LOAD( "rx1-3.7k", 0x0140, 0x0020, CRC(b8861096) SHA1(26fad384ed7a1a1e0ba719b5578e2dbb09334a25) ) /* Prom type: M3-7603-5 - video timing (not used) */ |
| 1033 | 1091 | |
| 1034 | 1092 | ROM_REGION( 0x0200, "namco", 0 ) /* sound proms */ |
| 1035 | ROM_LOAD( "nrallyx.spr", 0x0000, 0x0100, CRC(b75c4e87) SHA1(450f79a5ae09e34f7624d37769815baf93c0028e) ) /* Prom type: IM5623 */ | |
| 1036 | ROM_LOAD( "rx-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1093 | ROM_LOAD( "rx1-5.3p", 0x0000, 0x0100, CRC(4bad7017) SHA1(3e6da9d798f5e07fa18d6ce7d0b148be98c766d5) ) /* Prom type: IM5623 */ | |
| 1094 | ROM_LOAD( "rx1-4.2m", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* Prom type: IM5623 - not used */ | |
| 1037 | 1095 | ROM_END |
| 1038 | 1096 | |
| 1039 | ||
| 1040 | 1097 | ROM_START( jungler ) |
| 1041 | 1098 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 1042 | 1099 | ROM_LOAD( "jungr1", 0x0000, 0x1000, CRC(5bd6ad15) SHA1(608de86e19c6726bb7d21e7dc0e936f00121a3f4) ) |
| r5955 | r5956 | |
| 1272 | 1329 | |
| 1273 | 1330 | |
| 1274 | 1331 | |
| 1275 | GAME( 1980, rallyx, 0, rallyx, rallyx, 0, ROT0, "Namco", "Rally X", GAME_IMPERFECT_SOUND ) | |
| 1332 | GAME( 1980, rallyx, 0, rallyx, rallyx, 0, ROT0, "Namco", "Rally X (32k Ver.?)", GAME_IMPERFECT_SOUND ) | |
| 1333 | GAME( 1980, rallyxa, rallyx, rallyx, rallyx, 0, ROT0, "Namco", "Rally X", GAME_IMPERFECT_SOUND ) | |
| 1276 | 1334 | GAME( 1980, rallyxm, rallyx, rallyx, rallyx, 0, ROT0, "[Namco] (Midway license)", "Rally X (Midway)", GAME_IMPERFECT_SOUND ) |
| 1277 | 1335 | GAME( 1981, nrallyx, 0, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X", GAME_IMPERFECT_SOUND ) |
| 1336 | GAME( 1981, nrallyxb, nrallyx, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X (bootleg?) ", GAME_IMPERFECT_SOUND ) | |
| 1278 | 1337 | GAME( 1981, jungler, 0, jungler, jungler, 0, ROT90, "Konami", "Jungler", 0 ) |
| 1279 | 1338 | GAME( 1981, junglers, jungler, jungler, jungler, 0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", 0 ) |
| 1280 | 1339 | GAME( 1982, tactcian, 0, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", 0 ) |
| r5955 | r5956 | |
|---|---|---|
| 2918 | 2918 | ROM_LOAD( "uniwars.clr", 0x0000, 0x0020, CRC(25c79518) SHA1(e8f7e8b3d0cf1ed9d723948548f58abf0e2c6d1f) ) |
| 2919 | 2919 | ROM_END |
| 2920 | 2920 | |
| 2921 | ROM_START( spacempr ) | |
| 2922 | ROM_REGION( 0x4000, "maincpu", 0 ) | |
| 2923 | ROM_LOAD( "uw01", 0x0000, 0x0800, CRC(7c64fb92) SHA1(69f0923870cb8cbb7ae7a2a056c67a1da9b5588d) ) | |
| 2924 | ROM_LOAD( "uw02", 0x0800, 0x0800, CRC(b2ed14c3) SHA1(7668df11f64b8e296eedfee53437777dc53a56d5) ) | |
| 2925 | ROM_LOAD( "uw03", 0x1000, 0x0800, CRC(945f4160) SHA1(5fbe879f51e14c4c7ae551e5b3089f8e148770a4) ) | |
| 2926 | ROM_LOAD( "uw04", 0x1800, 0x0800, CRC(84885060) SHA1(a6ea3e272b426e86ff87e95c765362b44506228e) ) | |
| 2927 | ROM_LOAD( "uw05", 0x2000, 0x0800, CRC(e342371d) SHA1(f53caf7793df5788237d5e2f35242c0dd7a3085b) ) | |
| 2928 | ROM_LOAD( "uw06", 0x2800, 0x0800, CRC(d915a389) SHA1(0e2ff6eec9453856a1276889946b463cfae58eba) ) | |
| 2929 | ROM_LOAD( "uw07", 0x3000, 0x0800, CRC(c9245346) SHA1(239bad3fe64eaab2dfc3febd06d1124103a10504) ) | |
| 2930 | ROM_LOAD( "uw08", 0x3800, 0x0800, CRC(a237c394) SHA1(66dfa2aa39bd19f1f6ddb267d8f8bdbdba750d46) ) | |
| 2931 | ||
| 2932 | ROM_REGION( 0x2000, "gfx1", 0 ) | |
| 2933 | ROM_LOAD( "uw10", 0x0000, 0x0800, CRC(af069cba) SHA1(12b7d0a57f43613c80afd51c417628090740aabe) ) | |
| 2934 | ROM_LOAD( "uw12", 0x0800, 0x0800, CRC(c26132af) SHA1(7ae125a911dfd47aeca4f129f580762ce4d8d91a) ) | |
| 2935 | ROM_LOAD( "uw09", 0x1000, 0x0800, CRC(ff2c20d5) SHA1(48668dc4f008f44f5c15bdcc331cfe133da99cd4) ) | |
| 2936 | ROM_LOAD( "uw11", 0x1800, 0x0800, CRC(dcc2b33b) SHA1(c3a5ac935c519400dfabb28909f7e460769d1837) ) | |
| 2937 | ||
| 2938 | ROM_REGION( 0x0020, "proms", 0 ) | |
| 2939 | ROM_LOAD( "mmi6331", 0x0000, 0x0020, CRC(6a0c7d87) SHA1(140335d85c67c75b65689d4e76d29863c209cf32) ) | |
| 2940 | ROM_END | |
| 2941 | ||
| 2921 | 2942 | ROM_START( gteikoku ) |
| 2922 | 2943 | ROM_REGION( 0x4000, "maincpu", 0 ) |
| 2923 | 2944 | ROM_LOAD( "f07_1a.bin", 0x0000, 0x0800, CRC(d975af10) SHA1(a2e2a36a75db8fd09441308b08b6ae073c68b8cf) ) |
| r5955 | r5956 | |
| 3108 | 3129 | ROM_LOAD( "blpaccp", 0x0000, 0x0020, CRC(24652bc4) SHA1(d89575f3749c75dc963317fe451ffeffd9856e4d) ) /* same as pisces */ |
| 3109 | 3130 | ROM_END |
| 3110 | 3131 | |
| 3132 | /* content is the same as the above bootleg, but arranged differently in the roms */ | |
| 3133 | ROM_START( pacmanbla ) | |
| 3134 | ROM_REGION( 0x10000, "maincpu", 0 ) | |
| 3135 | ROM_LOAD( "rom1.bin", 0x0000, 0x0800, CRC(75e4f967) SHA1(8bdb5ab2b3f978c578f1498b64bb16d2cb292ef2) ) | |
| 3136 | ROM_CONTINUE(0x2000,0x800) | |
| 3137 | ROM_LOAD( "rom2.bin", 0x0800, 0x0800, CRC(5b2e4293) SHA1(bb925491e315d2e6bb9e756bdf664d173f83cd58) ) | |
| 3138 | ROM_CONTINUE(0x2800,0x800) | |
| 3139 | ROM_LOAD( "rom3.bin", 0x1000, 0x0800, CRC(c06e30a4) SHA1(00d8d114bd4e0b689e75e312c93f6c7b8492426e) ) | |
| 3140 | ROM_CONTINUE(0x3000,0x800) | |
| 3141 | ROM_LOAD( "rom4.bin", 0x1800, 0x0800, CRC(592b4ba8) SHA1(52a559344f70cd8a3a87de71de2bae57c885641a) ) | |
| 3142 | ROM_CONTINUE(0x3800,0x800) | |
| 3111 | 3143 | |
| 3144 | ROM_REGION( 0x2000, "tempgfx", 0 ) | |
| 3145 | ROM_LOAD( "rom5.bin", 0x0000, 0x1000, CRC(f2d8c01e) SHA1(d4a5789476fa7859bb936df10590775e97e87578) ) | |
| 3146 | ROM_LOAD( "rom6.bin", 0x1000, 0x1000, CRC(346a1720) SHA1(e152c9161f4e8ef53153b9c4a8ecef9fdbbe2463) ) | |
| 3147 | ||
| 3148 | ROM_REGION( 0x1000, "gfx1", 0 ) | |
| 3149 | ROM_COPY( "tempgfx", 0x0800, 0x0000, 0x0800 ) | |
| 3150 | ROM_COPY( "tempgfx", 0x1800, 0x0800, 0x0800 ) | |
| 3151 | ||
| 3152 | ROM_REGION( 0x1000, "gfx2", 0 ) | |
| 3153 | ROM_COPY( "tempgfx", 0x0000, 0x0000, 0x0800 ) | |
| 3154 | ROM_COPY( "tempgfx", 0x1000, 0x0800, 0x0800 ) | |
| 3155 | ||
| 3156 | ROM_REGION( 0x0020, "proms", 0 ) | |
| 3157 | ROM_LOAD( "blpaccp", 0x0000, 0x0020, CRC(24652bc4) SHA1(d89575f3749c75dc963317fe451ffeffd9856e4d) ) /* same as pisces */ | |
| 3158 | ROM_END | |
| 3159 | ||
| 3112 | 3160 | ROM_START( devilfsg ) |
| 3113 | 3161 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 3114 | 3162 | ROM_LOAD( "dfish1.7f", 0x2000, 0x0800, CRC(2ab19698) SHA1(8450981d3cf3fa8abf2fb5487aa98b03a4cf03a1) ) |
| r5955 | r5956 | |
| 5099 | 5147 | GAME( 1980, gteikob2, uniwars, galaxian, gteikob2, pisces, ROT90, "bootleg", "Gingateikoku No Gyakushu (bootleg set 2)", GAME_SUPPORTS_SAVE ) |
| 5100 | 5148 | GAME( 1980, spacbatt, uniwars, galaxian, spacbatt, pisces, ROT90, "bootleg", "Space Battle (bootleg set 1)", GAME_SUPPORTS_SAVE ) |
| 5101 | 5149 | GAME( 1980, spacbat2, uniwars, galaxian, spacbatt, pisces, ROT90, "bootleg", "Space Battle (bootleg set 2)", GAME_SUPPORTS_SAVE ) |
| 5150 | GAME( 1980, spacempr, uniwars, galaxian, spacbatt, pisces, ROT90, "bootleg", "Space Empire (bootleg)", GAME_SUPPORTS_SAVE ) | |
| 5102 | 5151 | GAME( 1980, skyraidr, uniwars, galaxian, superg, pisces, ROT90, "bootleg", "Sky Raiders", GAME_SUPPORTS_SAVE ) |
| 5103 | 5152 | |
| 5104 | 5153 | /* similar to pisces, but with different video banking characteristics */ |
| r5955 | r5956 | |
| 5106 | 5155 | |
| 5107 | 5156 | /* separate tile/sprite ROMs */ |
| 5108 | 5157 | GAME( 1981, streakng, 0, pacmanbl, streakng, galaxian, ROT90, "Shoei", "Streaking", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE ) |
| 5109 | GAME( 1981, pacmanbl, puckman, pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware)", GAME_SUPPORTS_SAVE ) | |
| 5158 | GAME( 1981, pacmanbl, puckman, pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware, set 1)", GAME_SUPPORTS_SAVE ) | |
| 5159 | GAME( 1981, pacmanbla,puckman, pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware, set 2)", GAME_SUPPORTS_SAVE ) | |
| 5110 | 5160 | |
| 5111 | 5161 | /* separate tile/sprite ROMs, plus INT instead of NMI */ |
| 5112 | 5162 | GAME( 1984, devilfsg, devilfsh, pacmanbl, devilfsg, devilfsg, ROT270, "Vision / Artic", "Devil Fish (Galaxian hardware, bootleg?)", GAME_SUPPORTS_SAVE ) |
| r5955 | r5956 | |
|---|---|---|
| 675 | 675 | #include "lucky74.lh" |
| 676 | 676 | |
| 677 | 677 | /* from video hardware */ |
| 678 | extern UINT8 *fg_videoram, *fg_colorram, *bg_videoram, *bg_colorram; | |
| 679 | WRITE8_HANDLER( fg_videoram_w ); | |
| 680 | WRITE8_HANDLER( fg_colorram_w ); | |
| 681 | WRITE8_HANDLER( bg_videoram_w ); | |
| 682 | WRITE8_HANDLER( bg_colorram_w ); | |
| 678 | extern UINT8 *lucky74_fg_videoram, *lucky74_fg_colorram, *lucky74_bg_videoram, *lucky74_bg_colorram; | |
| 679 | WRITE8_HANDLER( lucky74_fg_videoram_w ); | |
| 680 | WRITE8_HANDLER( lucky74_fg_colorram_w ); | |
| 681 | WRITE8_HANDLER( lucky74_bg_videoram_w ); | |
| 682 | WRITE8_HANDLER( lucky74_bg_colorram_w ); | |
| 683 | 683 | PALETTE_INIT( lucky74 ); |
| 684 | 684 | VIDEO_START( lucky74 ); |
| 685 | 685 | VIDEO_UPDATE( lucky74 ); |
| r5955 | r5956 | |
| 821 | 821 | static ADDRESS_MAP_START( lucky74_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 822 | 822 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 823 | 823 | AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) /* NVRAM */ |
| 824 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram) /* VRAM1-1 */ | |
| 825 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(fg_colorram_w) AM_BASE(&fg_colorram) /* VRAM1-2 */ | |
| 826 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram) /* VRAM2-1 */ | |
| 827 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(bg_colorram_w) AM_BASE(&bg_colorram) /* VRAM2-2 */ | |
| 824 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(lucky74_fg_videoram_w) AM_BASE(&lucky74_fg_videoram) /* VRAM1-1 */ | |
| 825 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(lucky74_fg_colorram_w) AM_BASE(&lucky74_fg_colorram) /* VRAM1-2 */ | |
| 826 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(lucky74_bg_videoram_w) AM_BASE(&lucky74_bg_videoram) /* VRAM2-1 */ | |
| 827 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(lucky74_bg_colorram_w) AM_BASE(&lucky74_bg_colorram) /* VRAM2-2 */ | |
| 828 | 828 | AM_RANGE(0xf000, 0xf003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports 0 & 1 */ |
| 829 | 829 | AM_RANGE(0xf080, 0xf083) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w) /* DSW 1, 2 & 3 */ |
| 830 | 830 | AM_RANGE(0xf0c0, 0xf0c3) AM_DEVREADWRITE("ppi8255_3", ppi8255_r, ppi8255_w) /* DSW 4 */ |
| r0 | r5956 | |
|---|---|---|
| 1 | /* | |
| 2 | SMS code from HazeMD | |
| 3 | - used by Syetem E | |
| 4 | - Megatech / Megaplay | |
| 5 | ||
| 6 | this contains common code to support those systems | |
| 7 | ||
| 8 | (not currently very good / accurate, should be rewritten) | |
| 9 | ||
| 10 | */ | |
| 11 | ||
| 12 | #include "driver.h" | |
| 13 | #include "cpu/z80/z80.h" | |
| 14 | #include "sound/sn76496.h" | |
| 15 | #include "machine/mc8123.h" | |
| 16 | #include "machine/segacrpt.h" | |
| 17 | #include "segamsys.h" | |
| 18 | ||
| 19 | ||
| 20 | //static UINT8* sms_rom; | |
| 21 | UINT8* sms_mainram; | |
| 22 | UINT8* smsgg_backupram = 0; | |
| 23 | static TIMER_CALLBACK( sms_scanline_timer_callback ); | |
| 24 | static struct sms_vdp *vdp2; | |
| 25 | static struct sms_vdp *vdp1; | |
| 26 | ||
| 27 | static struct sms_vdp *md_sms_vdp; | |
| 28 | ||
| 29 | /* All Accesses to VRAM go through here for safety */ | |
| 30 | #define SMS_VDP_VRAM(address) chip->vram[(address)&0x3fff] | |
| 31 | ||
| 32 | #ifdef UNUSED_FUNCTION | |
| 33 | static ADDRESS_MAP_START( sms_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 34 | // AM_RANGE(0x0000 , 0xbfff) AM_ROM | |
| 35 | // AM_RANGE(0xc000 , 0xdfff) AM_RAM AM_MIRROR(0x2000) | |
| 36 | ADDRESS_MAP_END | |
| 37 | #endif | |
| 38 | ||
| 39 | ||
| 40 | ADDRESS_MAP_START( sms_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 41 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 42 | ADDRESS_MAP_END | |
| 43 | ||
| 44 | static INPUT_PORTS_START( sms_common ) | |
| 45 | PORT_START("PAD1") /* Joypad 1 (2 button) NOT READ DIRECTLY */ | |
| 46 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 47 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 48 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 49 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 50 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 B") // a | |
| 51 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 C") // b | |
| 52 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 53 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 54 | ||
| 55 | PORT_START("PAD2") /* Joypad 2 (2 button) NOT READ DIRECTLY */ | |
| 56 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 57 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 58 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 59 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 60 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 B") // a | |
| 61 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 C") // b | |
| 62 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 63 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 64 | INPUT_PORTS_END | |
| 65 | ||
| 66 | INPUT_PORTS_START( sms ) | |
| 67 | PORT_INCLUDE( sms_common ) | |
| 68 | ||
| 69 | PORT_START("PAUSE") /* Buttons on SMS Console */ | |
| 70 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Pause Button") PORT_IMPULSE(1) | |
| 71 | INPUT_PORTS_END | |
| 72 | ||
| 73 | INPUT_PORTS_START( gamegear ) | |
| 74 | PORT_INCLUDE( sms_common ) | |
| 75 | ||
| 76 | PORT_START("GGSTART") /* Extra GameGear button */ | |
| 77 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Start Button") | |
| 78 | INPUT_PORTS_END | |
| 79 | ||
| 80 | /* Precalculated tables for H/V counters. Note the position the counter 'jumps' is marked with with | |
| 81 | an empty comment */ | |
| 82 | static const UINT8 hc_256[] = | |
| 83 | { | |
| 84 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 85 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 86 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 87 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 88 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 89 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 90 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 91 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 92 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 93 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 94 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 95 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 96 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 97 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 98 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,/**/0x94, 0x95, 0x96, 0x97, 0x98, 0x99, | |
| 99 | 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, | |
| 100 | 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, | |
| 101 | 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, | |
| 102 | 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, | |
| 103 | 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 104 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 105 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 106 | }; | |
| 107 | ||
| 108 | ||
| 109 | static const UINT8 vc_ntsc_192[] = | |
| 110 | { | |
| 111 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 112 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 113 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 114 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 115 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 116 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 117 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 118 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 119 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 120 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 121 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 122 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 123 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 124 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,/**/0xd5, 0xd6, 0xd7, 0xd8, 0xd9, | |
| 125 | 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 126 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 127 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 128 | }; | |
| 129 | ||
| 130 | static const UINT8 vc_ntsc_224[] = | |
| 131 | { | |
| 132 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 133 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 134 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 135 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 136 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 137 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 138 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 139 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 140 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 141 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 142 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 143 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 144 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 145 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 146 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,/**/0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 147 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 148 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 149 | }; | |
| 150 | ||
| 151 | static const UINT8 vc_ntsc_240[] = | |
| 152 | { | |
| 153 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 154 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 155 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 156 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 157 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 158 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 159 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 160 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 161 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 162 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 163 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 164 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 165 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 166 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 167 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 168 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 169 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 | |
| 170 | }; | |
| 171 | ||
| 172 | ||
| 173 | ||
| 174 | static const UINT8 vc_pal_192[] = | |
| 175 | { | |
| 176 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 177 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 178 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 179 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 180 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 181 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 182 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 183 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 184 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 185 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 186 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 187 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 188 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 189 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 190 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 191 | 0xf0, 0xf1, 0xf2,/**/0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, | |
| 192 | 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 193 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 194 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 195 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 196 | }; | |
| 197 | ||
| 198 | ||
| 199 | static const UINT8 vc_pal_224[] = | |
| 200 | { | |
| 201 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 202 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 203 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 204 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 205 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 206 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 207 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 208 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 209 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 210 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 211 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 212 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 213 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 214 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 215 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 216 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 217 | 0x00, 0x01, 0x02,/**/0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 218 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 219 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 220 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 221 | }; | |
| 222 | ||
| 223 | static const UINT8 vc_pal_240[] = | |
| 224 | { | |
| 225 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 226 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 227 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 228 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 229 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 230 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 231 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 232 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 233 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 234 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 235 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 236 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 237 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 238 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 239 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 240 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 241 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,/**/0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 242 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 243 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 244 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 245 | }; | |
| 246 | ||
| 247 | static const struct | |
| 248 | { | |
| 249 | UINT8 sms2_name[40]; | |
| 250 | int sms2_valid; | |
| 251 | int sms2_height; | |
| 252 | int sms2_tilemap_height; | |
| 253 | const UINT8* sms_vcounter_table; | |
| 254 | const UINT8* sms_hcounter_table; | |
| 255 | ||
| 256 | } sms_mode_table[] = | |
| 257 | { | |
| 258 | /* NTSC Modes */ | |
| 259 | { "Graphic 1 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 260 | { "Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 261 | { "Graphic 2 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 262 | { "Mode 1+2 (NTSC)" , 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 263 | { "Multicolor (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 264 | { "Mode 1+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 265 | { "Mode 2+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 266 | { "Mode 1+2+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 267 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 268 | { "Invalid Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 269 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 270 | { "Mode 4 (224-line) (NTSC)", 1, 224, 256, vc_ntsc_224, hc_256 }, | |
| 271 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 272 | { "Invalid Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 273 | { "Mode 4 (240-line) (NTSC)", 1, 240, 256, vc_ntsc_240, hc_256 }, | |
| 274 | { "Mode 4 (NTSC)", 1, 192, 244, vc_ntsc_192, hc_256 }, | |
| 275 | ||
| 276 | /* Pal Modes (different Vcounter) */ | |
| 277 | { "Graphic 1 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 278 | { "Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 279 | { "Graphic 2 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 280 | { "Mode 1+2 (PAL)" , 0, 192, 224, vc_pal_192, hc_256 }, | |
| 281 | { "Multicolor (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 282 | { "Mode 1+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 283 | { "Mode 2+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 284 | { "Mode 1+2+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 285 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 286 | { "Invalid Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 287 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 288 | { "Mode 4 (224-line) (PAL)", 1, 224, 256, vc_pal_224, hc_256 }, | |
| 289 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 290 | { "Invalid Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 291 | { "Mode 4 (240-line) (PAL)", 1, 240, 256, vc_pal_240, hc_256 }, | |
| 292 | { "Mode 4 (PAL)", 1, 192, 244, vc_pal_192, hc_256 } | |
| 293 | }; | |
| 294 | ||
| 295 | enum | |
| 296 | { | |
| 297 | SMS_VDP = 0, // SMS1 VDP | |
| 298 | SMS2_VDP = 1, // SMS2 VDP, or Game Gear VDP running in SMS2 Mode | |
| 299 | GG_VDP = 2, // Game Gear VDP running in Game Gear Mode | |
| 300 | GEN_VDP = 3 // Genesis VDP running in SMS2 Mode | |
| 301 | }; | |
| 302 | ||
| 303 | static int sms_vdp_null_irq_callback(running_machine *machine, int status) | |
| 304 | { | |
| 305 | return -1; | |
| 306 | } | |
| 307 | ||
| 308 | static int sms_vdp_cpu0_irq_callback(running_machine *machine, int status) | |
| 309 | { | |
| 310 | if (status == 1) | |
| 311 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); | |
| 312 | else | |
| 313 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); | |
| 314 | ||
| 315 | return 0; | |
| 316 | } | |
| 317 | ||
| 318 | static int sms_vdp_cpu1_irq_callback(running_machine *machine, int status) | |
| 319 | { | |
| 320 | if (status == 1) | |
| 321 | cputag_set_input_line(machine, "genesis_snd_z80", 0, HOLD_LINE); | |
| 322 | else | |
| 323 | cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE); | |
| 324 | ||
| 325 | return 0; | |
| 326 | } | |
| 327 | ||
| 328 | ||
| 329 | static int sms_vdp_cpu2_irq_callback(running_machine *machine, int status) | |
| 330 | { | |
| 331 | if (status == 1) | |
| 332 | cputag_set_input_line(machine, "mtbios", 0, HOLD_LINE); | |
| 333 | else | |
| 334 | cputag_set_input_line(machine, "mtbios", 0, CLEAR_LINE); | |
| 335 | ||
| 336 | return 0; | |
| 337 | } | |
| 338 | ||
| 339 | ||
| 340 | ||
| 341 | ||
| 342 | struct sms_vdp | |
| 343 | { | |
| 344 | UINT8 chip_id; | |
| 345 | ||
| 346 | UINT8 cmd_pend; | |
| 347 | UINT8 cmd_part1; | |
| 348 | UINT8 cmd_part2; | |
| 349 | UINT16 addr_reg; | |
| 350 | UINT8 cmd_reg; | |
| 351 | UINT8 regs[0x10]; | |
| 352 | UINT8 readbuf; | |
| 353 | UINT8* vram; | |
| 354 | UINT8* cram; | |
| 355 | UINT8 writemode; | |
| 356 | bitmap_t* r_bitmap; | |
| 357 | UINT8* tile_renderline; | |
| 358 | UINT8* sprite_renderline; | |
| 359 | ||
| 360 | UINT8 sprite_collision; | |
| 361 | UINT8 sprite_overflow; | |
| 362 | ||
| 363 | UINT8 yscroll; | |
| 364 | UINT8 hint_counter; | |
| 365 | ||
| 366 | UINT8 frame_irq_pending; | |
| 367 | UINT8 line_irq_pending; | |
| 368 | ||
| 369 | UINT8 vdp_type; | |
| 370 | ||
| 371 | UINT8 gg_cram_latch; // gamegear specific. | |
| 372 | ||
| 373 | /* below are MAME specific, to make things easier */ | |
| 374 | UINT8 screen_mode; | |
| 375 | UINT8 is_pal; | |
| 376 | int sms_scanline_counter; | |
| 377 | int sms_total_scanlines; | |
| 378 | int sms_framerate; | |
| 379 | emu_timer* sms_scanline_timer; | |
| 380 | UINT16* cram_mamecolours; // for use on RGB_DIRECT screen | |
| 381 | int (*set_irq)(running_machine *machine, int state); | |
| 382 | ||
| 383 | }; | |
| 384 | ||
| 385 | ||
| 386 | ||
| 387 | static void *start_vdp(running_machine *machine, int type) | |
| 388 | { | |
| 389 | struct sms_vdp *chip; | |
| 390 | ||
| 391 | chip = auto_alloc_clear(machine, struct sms_vdp); | |
| 392 | ||
| 393 | chip->vdp_type = type; | |
| 394 | ||
| 395 | chip->set_irq = sms_vdp_null_irq_callback; | |
| 396 | ||
| 397 | chip->cmd_pend = 0; | |
| 398 | chip->cmd_part1 = 0; | |
| 399 | chip->cmd_part2 = 0; | |
| 400 | chip->addr_reg = 0; | |
| 401 | chip->cmd_reg = 0; | |
| 402 | ||
| 403 | chip->regs[0x0] = 0x06; // mode 4 | |
| 404 | chip->regs[0x1] = 0x18; // mode 4 | |
| 405 | chip->regs[0x2] = 0; | |
| 406 | chip->regs[0x3] = 0; | |
| 407 | chip->regs[0x4] = 0; | |
| 408 | chip->regs[0x5] = 0; | |
| 409 | chip->regs[0x6] = 0; | |
| 410 | chip->regs[0x7] = 0; | |
| 411 | chip->regs[0x8] = 0; | |
| 412 | chip->regs[0x9] = 0; | |
| 413 | chip->regs[0xa] = 0; | |
| 414 | /* b-f don't matter */ | |
| 415 | chip->readbuf = 0; | |
| 416 | chip->vram = auto_alloc_array_clear(machine, UINT8, 0x4000); | |
| 417 | ||
| 418 | //printf("%d\n", (*chip->set_irq)(machine, 200)); | |
| 419 | ||
| 420 | if (chip->vdp_type==GG_VDP) | |
| 421 | { | |
| 422 | chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0040); | |
| 423 | chip->cram_mamecolours = auto_alloc_array_clear(machine, UINT16, 0x0080/2); | |
| 424 | chip->gg_cram_latch = 0; | |
| 425 | } | |
| 426 | else | |
| 427 | { | |
| 428 | chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0020); | |
| 429 | chip->cram_mamecolours = auto_alloc_array(machine, UINT16, 0x0040/2); | |
| 430 | } | |
| 431 | ||
| 432 | chip->tile_renderline = auto_alloc_array(machine, UINT8, 256+8); | |
| 433 | memset(chip->tile_renderline,0x00,256+8); | |
| 434 | ||
| 435 | chip->sprite_renderline = auto_alloc_array(machine, UINT8, 256+32); | |
| 436 | memset(chip->sprite_renderline,0x00,256+32); | |
| 437 | ||
| 438 | chip->writemode = 0; | |
| 439 | chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15); | |
| 440 | ||
| 441 | chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip); | |
| 442 | ||
| 443 | return chip; | |
| 444 | } | |
| 445 | ||
| 446 | /* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */ | |
| 447 | void segae_md_sms_stop_scanline_timer(void) | |
| 448 | { | |
| 449 | timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_never, 0); | |
| 450 | memset(md_sms_vdp->vram,0x00,0x4000); | |
| 451 | } | |
| 452 | ||
| 453 | ||
| 454 | #ifdef UNUSED_FUNCTION | |
| 455 | static READ8_HANDLER( z80_unmapped_r ) | |
| 456 | { | |
| 457 | printf("unmapped z80 read %04x\n",offset); | |
| 458 | return 0; | |
| 459 | } | |
| 460 | ||
| 461 | static WRITE8_HANDLER( z80_unmapped_w ) | |
| 462 | { | |
| 463 | printf("unmapped z80 write %04x\n",offset); | |
| 464 | } | |
| 465 | #endif | |
| 466 | ||
| 467 | static UINT8 vcounter_r(struct sms_vdp *chip) | |
| 468 | { | |
| 469 | // return vc_pal_224[sms_scanline_counter%(sizeof vc_pal_224)]; | |
| 470 | UINT8 retvalue; | |
| 471 | int scanline = chip->sms_scanline_counter%chip->sms_total_scanlines; | |
| 472 | ||
| 473 | retvalue = sms_mode_table[chip->screen_mode].sms_vcounter_table[scanline]; | |
| 474 | ||
| 475 | return retvalue; | |
| 476 | //printf("retvalue %d\n"; | |
| 477 | } | |
| 478 | ||
| 479 | ||
| 480 | static UINT8 vdp_data_r(struct sms_vdp *chip) | |
| 481 | { | |
| 482 | UINT8 retdata = chip->readbuf; | |
| 483 | chip->readbuf = SMS_VDP_VRAM(chip->addr_reg); | |
| 484 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 485 | return retdata; | |
| 486 | } | |
| 487 | ||
| 488 | static void vdp_data_w(const address_space *space, UINT8 data, struct sms_vdp* chip) | |
| 489 | { | |
| 490 | /* data writes clear the pending flag */ | |
| 491 | chip->cmd_pend = 0; | |
| 492 | ||
| 493 | if (chip->writemode==0) | |
| 494 | { /* Write to VRAM */ | |
| 495 | SMS_VDP_VRAM(chip->addr_reg)=data; | |
| 496 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 497 | chip->readbuf = data; // quirk of the VDP | |
| 498 | } | |
| 499 | else if (chip->writemode==1) | |
| 500 | { | |
| 501 | if (chip->vdp_type==GG_VDP) | |
| 502 | { | |
| 503 | if (!(chip->addr_reg&1)) | |
| 504 | { /* Even address, value latched */ | |
| 505 | chip->gg_cram_latch = data; | |
| 506 | } | |
| 507 | else | |
| 508 | { | |
| 509 | chip->cram[(chip->addr_reg&0x3e)+1]=data; | |
| 510 | chip->cram[(chip->addr_reg&0x3e)+0]=chip->gg_cram_latch; | |
| 511 | ||
| 512 | /* Set Colour */ | |
| 513 | { | |
| 514 | UINT16 palword; | |
| 515 | UINT8 r,g,b; | |
| 516 | ||
| 517 | palword = ((chip->cram[(chip->addr_reg&0x3e)+1])<<8)|(chip->cram[(chip->addr_reg&0x3e)+0]); | |
| 518 | ||
| 519 | //printf("addr %04x palword %04x\n", chip->addr_reg&0x3f, palword); | |
| 520 | ||
| 521 | r = (palword & 0x000f)>>0; | |
| 522 | g = (palword & 0x00f0)>>4; | |
| 523 | b = (palword & 0x0f00)>>8; | |
| 524 | palette_set_color_rgb(space->machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b)); | |
| 525 | chip->cram_mamecolours[(chip->addr_reg&0x3e)/2]=(b<<1)|(g<<6)|(r<<11); | |
| 526 | } | |
| 527 | } | |
| 528 | } | |
| 529 | else | |
| 530 | { | |
| 531 | chip->cram[chip->addr_reg&0x1f]=data; | |
| 532 | ||
| 533 | /* Set Colour */ | |
| 534 | { | |
| 535 | UINT8 r,g,b; | |
| 536 | r = (data & 0x03)>>0; | |
| 537 | g = (data & 0x0c)>>2; | |
| 538 | b = (data & 0x30)>>4; | |
| 539 | palette_set_color_rgb(space->machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b)); | |
| 540 | chip->cram_mamecolours[chip->addr_reg&0x1f]=(b<<3)|(g<<8)|(r<<13); | |
| 541 | } | |
| 542 | ||
| 543 | } | |
| 544 | ||
| 545 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 546 | chip->readbuf = data; // quirk of the VDP | |
| 547 | ||
| 548 | } | |
| 549 | ||
| 550 | } | |
| 551 | ||
| 552 | static UINT8 vdp_ctrl_r(const address_space *space, struct sms_vdp *chip) | |
| 553 | { | |
| 554 | UINT8 retvalue; | |
| 555 | ||
| 556 | retvalue = (chip->frame_irq_pending<<7) | | |
| 557 | (chip->sprite_overflow<<6) | | |
| 558 | (chip->sprite_collision<<5); | |
| 559 | ||
| 560 | chip->cmd_pend = 0; | |
| 561 | chip->frame_irq_pending = 0; | |
| 562 | chip->line_irq_pending = 0; | |
| 563 | chip->sprite_collision = 0; | |
| 564 | chip->sprite_overflow = 0; | |
| 565 | ||
| 566 | (chip->set_irq)(space->machine, 0); // clear IRQ; | |
| 567 | ||
| 568 | ||
| 569 | return retvalue; | |
| 570 | } | |
| 571 | ||
| 572 | /* check me */ | |
| 573 | static void vdp_update_code_addr_regs(struct sms_vdp *chip) | |
| 574 | { | |
| 575 | chip->addr_reg = ((chip->cmd_part2&0x3f)<<8) | chip->cmd_part1; | |
| 576 | chip->cmd_reg = (chip->cmd_part2&0xc0)>>6; | |
| 577 | } | |
| 578 | ||
| 579 | static void vdp_set_register(running_machine *machine, struct sms_vdp *chip) | |
| 580 | { | |
| 581 | UINT8 reg = chip->cmd_part2&0x0f; | |
| 582 | chip->regs[reg] = chip->cmd_part1; | |
| 583 | ||
| 584 | //if(reg==0) printf("setting reg 0 to %02x\n",chip->cmd_part1); | |
| 585 | ||
| 586 | //if (reg>0xa) printf("Invalid register write to register %01x\n",reg); | |
| 587 | ||
| 588 | if(reg==1) | |
| 589 | { | |
| 590 | if ((chip->regs[0x1]&0x20) && chip->frame_irq_pending) | |
| 591 | { | |
| 592 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 593 | } | |
| 594 | else | |
| 595 | { | |
| 596 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 597 | } | |
| 598 | } | |
| 599 | ||
| 600 | if(reg==0) | |
| 601 | { | |
| 602 | if ((chip->regs[0x0]&0x10) && chip->line_irq_pending) | |
| 603 | { | |
| 604 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 605 | } | |
| 606 | else | |
| 607 | { | |
| 608 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 609 | } | |
| 610 | } | |
| 611 | ||
| 612 | ||
| 613 | // printf("VDP: setting register %01x to %02x\n",reg, chip->cmd_part1); | |
| 614 | } | |
| 615 | ||
| 616 | static void vdp_ctrl_w(const address_space *space, UINT8 data, struct sms_vdp *chip) | |
| 617 | { | |
| 618 | if (chip->cmd_pend) | |
| 619 | { /* Part 2 of a command word write */ | |
| 620 | chip->cmd_pend = 0; | |
| 621 | chip->cmd_part2 = data; | |
| 622 | vdp_update_code_addr_regs(chip); | |
| 623 | ||
| 624 | switch (chip->cmd_reg) | |
| 625 | { | |
| 626 | case 0x0: /* VRAM read mode */ | |
| 627 | chip->readbuf = SMS_VDP_VRAM(chip->addr_reg); | |
| 628 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 629 | chip->writemode = 0; | |
| 630 | break; | |
| 631 | ||
| 632 | case 0x1: /* VRAM write mode */ | |
| 633 | chip->writemode = 0; | |
| 634 | break; | |
| 635 | ||
| 636 | case 0x2: /* REG setting */ | |
| 637 | vdp_set_register(space->machine, chip); | |
| 638 | chip->writemode = 0; | |
| 639 | break; | |
| 640 | ||
| 641 | case 0x3: /* CRAM write mode */ | |
| 642 | chip->writemode = 1; | |
| 643 | break; | |
| 644 | } | |
| 645 | } | |
| 646 | else | |
| 647 | { /* Part 1 of a command word write */ | |
| 648 | chip->cmd_pend = 1; | |
| 649 | chip->cmd_part1 = data; | |
| 650 | vdp_update_code_addr_regs(chip); | |
| 651 | } | |
| 652 | } | |
| 653 | ||
| 654 | /* for the Genesis */ | |
| 655 | ||
| 656 | READ8_HANDLER( md_sms_vdp_vcounter_r ) | |
| 657 | { | |
| 658 | return vcounter_r(md_sms_vdp); | |
| 659 | } | |
| 660 | ||
| 661 | READ8_HANDLER( md_sms_vdp_data_r ) | |
| 662 | { | |
| 663 | return vdp_data_r(md_sms_vdp); | |
| 664 | } | |
| 665 | ||
| 666 | WRITE8_HANDLER( md_sms_vdp_data_w ) | |
| 667 | { | |
| 668 | vdp_data_w(space, data, md_sms_vdp); | |
| 669 | } | |
| 670 | ||
| 671 | READ8_HANDLER( md_sms_vdp_ctrl_r ) | |
| 672 | { | |
| 673 | return vdp_ctrl_r(space, md_sms_vdp); | |
| 674 | } | |
| 675 | ||
| 676 | WRITE8_HANDLER( md_sms_vdp_ctrl_w ) | |
| 677 | { | |
| 678 | vdp_ctrl_w(space, data, md_sms_vdp); | |
| 679 | } | |
| 680 | ||
| 681 | ||
| 682 | /* Read / Write Handlers - call other functions */ | |
| 683 | ||
| 684 | READ8_HANDLER( sms_vcounter_r ) | |
| 685 | { | |
| 686 | return vcounter_r(vdp1); | |
| 687 | } | |
| 688 | ||
| 689 | READ8_HANDLER( sms_vdp_data_r ) | |
| 690 | { | |
| 691 | return vdp_data_r(vdp1); | |
| 692 | } | |
| 693 | ||
| 694 | WRITE8_HANDLER( sms_vdp_data_w ) | |
| 695 | { | |
| 696 | vdp_data_w(space, data, vdp1); | |
| 697 | } | |
| 698 | ||
| 699 | READ8_HANDLER( sms_vdp_ctrl_r ) | |
| 700 | { | |
| 701 | return vdp_ctrl_r(space, vdp1); | |
| 702 | } | |
| 703 | ||
| 704 | WRITE8_HANDLER( sms_vdp_ctrl_w ) | |
| 705 | { | |
| 706 | vdp_ctrl_w(space, data, vdp1); | |
| 707 | } | |
| 708 | ||
| 709 | static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip) | |
| 710 | { | |
| 711 | int xx; | |
| 712 | UINT32 gfxdata; | |
| 713 | UINT16 gfx_base = (tiledata & 0x01ff)<<5; | |
| 714 | UINT8 flipx = (tiledata & 0x0200)>>9; | |
| 715 | UINT8 flipy = (tiledata & 0x0400)>>10; | |
| 716 | UINT8 pal = (tiledata & 0x0800)>>11; | |
| 717 | UINT8 pri = (tiledata & 0x1000)>>12; | |
| 718 | ||
| 719 | if (flipy) | |
| 720 | { | |
| 721 | gfx_base+=(7-tileline)*4; | |
| 722 | } | |
| 723 | else | |
| 724 | { | |
| 725 | gfx_base+=tileline*4; | |
| 726 | } | |
| 727 | ||
| 728 | gfxdata = (SMS_VDP_VRAM(gfx_base)<<24)|(SMS_VDP_VRAM(gfx_base+1)<<16)|(SMS_VDP_VRAM(gfx_base+2)<<8)|(SMS_VDP_VRAM(gfx_base+3)<<0); | |
| 729 | ||
| 730 | for (xx=0;xx<8;xx++) | |
| 731 | { | |
| 732 | UINT8 pixel; | |
| 733 | ||
| 734 | if (flipx) | |
| 735 | { | |
| 736 | pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 737 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 738 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 739 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 740 | } | |
| 741 | else | |
| 742 | { | |
| 743 | pixel = (( (gfxdata>>(7-xx) ) &0x00000001)<<3)| | |
| 744 | (( (gfxdata>>(15-xx) ) &0x00000001)<<2)| | |
| 745 | (( (gfxdata>>(23-xx) ) &0x00000001)<<1)| | |
| 746 | (( (gfxdata>>(31-xx) ) &0x00000001)<<0); | |
| 747 | } | |
| 748 | ||
| 749 | pixel += pal*0x10; | |
| 750 | ||
| 751 | if (!pri) linebuf[drawxpos+xx] = pixel; | |
| 752 | else | |
| 753 | { | |
| 754 | if (pixel&0xf) | |
| 755 | linebuf[drawxpos+xx] = pixel|0x80; | |
| 756 | else | |
| 757 | linebuf[drawxpos+xx] = pixel; | |
| 758 | ||
| 759 | } | |
| 760 | } | |
| 761 | } | |
| 762 | ||
| 763 | static void sms_render_spriteline(int scanline, struct sms_vdp* chip) | |
| 764 | { | |
| 765 | int spritenum; | |
| 766 | int height = 8; | |
| 767 | int width = 8; | |
| 768 | int max_sprites = 8; | |
| 769 | int visible_line = 0; | |
| 770 | ||
| 771 | UINT16 table_base = (chip->regs[0x5]&0x7e) << 7; | |
| 772 | UINT8 pattern_bit = (chip->regs[0x6]&0x04) >> 2; // high bit of the tile # (because spriteram can only contain an 8-bit tile #) | |
| 773 | ||
| 774 | ||
| 775 | memset(chip->sprite_renderline, 0, 256+32); | |
| 776 | ||
| 777 | for (spritenum = 0;spritenum<64;spritenum++) | |
| 778 | { | |
| 779 | int xpos,ypos,num; | |
| 780 | /* | |
| 781 | 00: yyyyyyyyyyyyyyyy | |
| 782 | 10: yyyyyyyyyyyyyyyy | |
| 783 | 20: yyyyyyyyyyyyyyyy | |
| 784 | 30: yyyyyyyyyyyyyyyy | |
| 785 | 40: ???????????????? | |
| 786 | 50: ???????????????? | |
| 787 | 60: ???????????????? | |
| 788 | 70: ???????????????? | |
| 789 | 80: xnxnxnxnxnxnxnxn | |
| 790 | 90: xnxnxnxnxnxnxnxn | |
| 791 | A0: xnxnxnxnxnxnxnxn | |
| 792 | B0: xnxnxnxnxnxnxnxn | |
| 793 | C0: xnxnxnxnxnxnxnxn | |
| 794 | D0: xnxnxnxnxnxnxnxn | |
| 795 | E0: xnxnxnxnxnxnxnxn | |
| 796 | F0: xnxnxnxnxnxnxnxn | |
| 797 | */ | |
| 798 | ||
| 799 | ypos = SMS_VDP_VRAM(table_base+spritenum); | |
| 800 | xpos = SMS_VDP_VRAM(table_base+0x80+spritenum*2+0); | |
| 801 | num = SMS_VDP_VRAM(table_base+0x80+spritenum*2+1)|(pattern_bit<<8); | |
| 802 | ||
| 803 | if (chip->regs[0x1]&0x2) | |
| 804 | { | |
| 805 | num &=0x1fe; | |
| 806 | height=16; | |
| 807 | } | |
| 808 | else height = 8; | |
| 809 | ||
| 810 | ||
| 811 | xpos+=16; // allow room either side for clipping (avoids xdrawpos of -8 if bit below is set) | |
| 812 | ||
| 813 | if (chip->regs[0x0]&0x08) xpos-=8; | |
| 814 | ||
| 815 | if ((sms_mode_table[chip->screen_mode].sms2_height)==192) | |
| 816 | { | |
| 817 | if (ypos == 0xd0) | |
| 818 | return; | |
| 819 | } | |
| 820 | ||
| 821 | ypos++; | |
| 822 | ||
| 823 | num <<= 5; | |
| 824 | //num+=((scanline-ypos)&0x7)*4; | |
| 825 | ||
| 826 | visible_line = 0; | |
| 827 | ||
| 828 | if (ypos<=scanline && ypos+height>scanline) | |
| 829 | { | |
| 830 | visible_line = 1; | |
| 831 | num+=((scanline-ypos)&(height-1))*4; | |
| 832 | ||
| 833 | } | |
| 834 | else if (ypos+height>0x100) | |
| 835 | { | |
| 836 | if (scanline< ypos+height-0x100) | |
| 837 | { | |
| 838 | visible_line = 1; | |
| 839 | num+=((scanline-ypos)&(height-1))*4; | |
| 840 | ||
| 841 | } | |
| 842 | } | |
| 843 | ||
| 844 | if (visible_line) | |
| 845 | { | |
| 846 | int xx; | |
| 847 | UINT32 gfxdata; | |
| 848 | ||
| 849 | gfxdata = (SMS_VDP_VRAM(num&0x3fff)<<24)|(SMS_VDP_VRAM((num+1)&0x3fff)<<16)|(SMS_VDP_VRAM((num+2)&0x3fff)<<8)|(SMS_VDP_VRAM((num+3)&0x3fff)<<0); | |
| 850 | ||
| 851 | ||
| 852 | for (xx=0;xx<8;xx++) | |
| 853 | { | |
| 854 | UINT8 pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 855 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 856 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 857 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 858 | ||
| 859 | if (pixel) | |
| 860 | { | |
| 861 | if (!chip->sprite_renderline[xpos+((width-1)-xx)]) | |
| 862 | { | |
| 863 | chip->sprite_renderline[xpos+((width-1)-xx)] = pixel; | |
| 864 | } | |
| 865 | else | |
| 866 | { | |
| 867 | chip->sprite_collision = 1; | |
| 868 | } | |
| 869 | } | |
| 870 | } | |
| 871 | ||
| 872 | max_sprites--; | |
| 873 | ||
| 874 | if (max_sprites==0) | |
| 875 | { | |
| 876 | chip->sprite_overflow = 1; | |
| 877 | return; | |
| 878 | } | |
| 879 | ||
| 880 | } | |
| 881 | } | |
| 882 | } | |
| 883 | ||
| 884 | static void sms_render_tileline(int scanline, struct sms_vdp* chip) | |
| 885 | { | |
| 886 | int column = 0; | |
| 887 | int count = 32; | |
| 888 | int drawxpos; | |
| 889 | ||
| 890 | UINT8 xscroll = chip->regs[0x8]; | |
| 891 | UINT8 yscroll = chip->yscroll; | |
| 892 | UINT16 table_base = (chip->regs[0x2]&0x0e)<<10; | |
| 893 | UINT16 our_base; | |
| 894 | UINT8 our_line = (scanline+yscroll) & 0x7; | |
| 895 | ||
| 896 | /* In 224 and 240 line modes the table base is different */ | |
| 897 | if ((sms_mode_table[chip->screen_mode].sms2_height)!=192) | |
| 898 | { | |
| 899 | table_base &=0x3700; table_base|=0x700; | |
| 900 | } | |
| 901 | ||
| 902 | if ((chip->regs[0x0]&0x40) && scanline < 16) | |
| 903 | { | |
| 904 | xscroll = 0; | |
| 905 | } | |
| 906 | ||
| 907 | // xscroll = 0; | |
| 908 | ||
| 909 | // table_base -= 0x0100; | |
| 910 | ||
| 911 | our_base = table_base+(((scanline+yscroll)%sms_mode_table[chip->screen_mode].sms2_tilemap_height)>>3)*64;// + (yscroll>>3)*32; | |
| 912 | ||
| 913 | our_base &=0x3fff; | |
| 914 | ||
| 915 | memset(chip->tile_renderline, (chip->regs[0x7]&0x0f)+0x10, 256+8); | |
| 916 | ||
| 917 | drawxpos = xscroll&0x7; | |
| 918 | column = 32-(xscroll>>3); | |
| 919 | ||
| 920 | do | |
| 921 | { | |
| 922 | UINT16 tiledata = (SMS_VDP_VRAM((our_base+(column&0x1f)*2+1)&0x3fff) << 8) | | |
| 923 | (SMS_VDP_VRAM((our_base+(column&0x1f)*2+0)&0x3fff) << 0); | |
| 924 | ||
| 925 | // UINT16 pattern = ((column+((scanline>>3)*32)) & 0x01ff)<<5; | |
| 926 | ||
| 927 | draw_tile_line(drawxpos, our_line, tiledata, chip->tile_renderline, chip); | |
| 928 | ||
| 929 | drawxpos+=8; | |
| 930 | column++; | |
| 931 | column&=0x1f; | |
| 932 | count--; | |
| 933 | } while (count); | |
| 934 | ||
| 935 | } | |
| 936 | ||
| 937 | static void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip) | |
| 938 | { | |
| 939 | int x; | |
| 940 | UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, scanline, 0); | |
| 941 | ||
| 942 | for (x=0;x<256;x++) | |
| 943 | { | |
| 944 | UINT8 dat = chip->tile_renderline[x]; | |
| 945 | UINT8 col; | |
| 946 | ||
| 947 | ||
| 948 | col = (chip->regs[0x7]&0x0f)+0x10; | |
| 949 | lineptr[x] = chip->cram_mamecolours[col]; | |
| 950 | ||
| 951 | ||
| 952 | if ((x<8 && (chip->regs[0x0]&0x20)) || !(chip->regs[0x1]&0x40)) | |
| 953 | continue; | |
| 954 | ||
| 955 | ||
| 956 | if (!(dat & 0x80)) | |
| 957 | { | |
| 958 | lineptr[x] = chip->cram_mamecolours[dat&0x1f]; | |
| 959 | if ((dat&0xf)==0x0) lineptr[x]|=0x8000; | |
| 960 | ||
| 961 | } | |
| 962 | ||
| 963 | if (chip->sprite_renderline[x+16]) | |
| 964 | { | |
| 965 | lineptr[x] = chip->cram_mamecolours[chip->sprite_renderline[x+16]+0x10]; | |
| 966 | } | |
| 967 | ||
| 968 | if (dat & 0x80) | |
| 969 | { | |
| 970 | lineptr[x] = chip->cram_mamecolours[dat&0x1f]; | |
| 971 | if ((dat&0xf)==0x0) lineptr[x]|=0x8000; | |
| 972 | } | |
| 973 | ||
| 974 | } | |
| 975 | ||
| 976 | } | |
| 977 | ||
| 978 | static void sms_draw_scanline(int scanline, struct sms_vdp* chip) | |
| 979 | { | |
| 980 | ||
| 981 | if (scanline>=0 && scanline<sms_mode_table[chip->screen_mode].sms2_height) | |
| 982 | { | |
| 983 | sms_render_spriteline(scanline, chip); | |
| 984 | sms_render_tileline(scanline, chip); | |
| 985 | sms_copy_to_renderbuffer(scanline, chip); | |
| 986 | ||
| 987 | } | |
| 988 | } | |
| 989 | ||
| 990 | ||
| 991 | static TIMER_CALLBACK( sms_scanline_timer_callback ) | |
| 992 | { | |
| 993 | /* This function is called at the very start of every scanline starting at the very | |
| 994 | top-left of the screen. The first scanline is scanline 0 (we set scanline to -1 in | |
| 995 | VIDEO_EOF) */ | |
| 996 | ||
| 997 | /* Compensate for some rounding errors | |
| 998 | ||
| 999 | When the counter reaches 314 (or whatever the max lines is) we should have reached the | |
| 1000 | end of the frame, however due to rounding errors in the timer calculation we're not quite | |
| 1001 | there. Let's assume we are still in the previous scanline for now. | |
| 1002 | ||
| 1003 | The position to get the H position also has to compensate for a few errors | |
| 1004 | */ | |
| 1005 | // printf("num %d\n",num ); | |
| 1006 | struct sms_vdp *chip = (struct sms_vdp *)ptr; | |
| 1007 | ||
| 1008 | if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1)) | |
| 1009 | { | |
| 1010 | chip->sms_scanline_counter++; | |
| 1011 | timer_adjust_oneshot(chip->sms_scanline_timer, ATTOTIME_IN_HZ(chip->sms_framerate * chip->sms_total_scanlines), 0); | |
| 1012 | ||
| 1013 | if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height) | |
| 1014 | { | |
| 1015 | chip->hint_counter=chip->regs[0xa]; | |
| 1016 | } | |
| 1017 | ||
| 1018 | if (chip->sms_scanline_counter==0) | |
| 1019 | { | |
| 1020 | chip->hint_counter=chip->regs[0xa]; | |
| 1021 | } | |
| 1022 | ||
| 1023 | if (chip->sms_scanline_counter<=192) | |
| 1024 | { | |
| 1025 | chip->hint_counter--; | |
| 1026 | ||
| 1027 | if (chip->hint_counter==0xff) | |
| 1028 | { | |
| 1029 | //if (chip->chip_id==2) printf("irq triggerd on scanline %d %d\n", vdp1->sms_scanline_counter, vdp2->sms_scanline_counter); | |
| 1030 | ||
| 1031 | chip->line_irq_pending = 1; | |
| 1032 | chip->hint_counter=chip->regs[0xa]; | |
| 1033 | if (chip->regs[0x0]&0x10) | |
| 1034 | { | |
| 1035 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 1036 | } | |
| 1037 | else | |
| 1038 | { | |
| 1039 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 1040 | } | |
| 1041 | } | |
| 1042 | ||
| 1043 | } | |
| 1044 | ||
| 1045 | ||
| 1046 | sms_draw_scanline(chip->sms_scanline_counter, chip); | |
| 1047 | ||
| 1048 | //if(sms_scanline_counter==0) chip->sprite_collision = 0; | |
| 1049 | ||
| 1050 | if (chip->sms_scanline_counter==sms_mode_table[chip->screen_mode].sms2_height+1 ) | |
| 1051 | { | |
| 1052 | chip->frame_irq_pending = 1; | |
| 1053 | if (chip->regs[0x1]&0x20) | |
| 1054 | { | |
| 1055 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 1056 | } | |
| 1057 | else | |
| 1058 | { | |
| 1059 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 1060 | } | |
| 1061 | } | |
| 1062 | } | |
| 1063 | else | |
| 1064 | { /* if we're called passed the total number of scanlines then assume we're still on the last one. | |
| 1065 | this can happen due to rounding errors */ | |
| 1066 | chip->sms_scanline_counter = chip->sms_total_scanlines-1; | |
| 1067 | } | |
| 1068 | } | |
| 1069 | ||
| 1070 | #ifdef UNUSED_FUNCTION | |
| 1071 | static void show_tiles(struct sms_vdp* chip) | |
| 1072 | { | |
| 1073 | int x,y,xx,yy; | |
| 1074 | UINT16 count = 0; | |
| 1075 | ||
| 1076 | for (y=0;y<16;y++) | |
| 1077 | { | |
| 1078 | for (x=0;x<32;x++) | |
| 1079 | { | |
| 1080 | for (yy=0;yy<8;yy++) | |
| 1081 | { | |
| 1082 | int drawypos = y*8+yy; | |
| 1083 | UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, drawypos, 0); | |
| 1084 | ||
| 1085 | UINT32 gfxdata = (SMS_VDP_VRAM(count)<<24)|(SMS_VDP_VRAM(count+1)<<16)|(SMS_VDP_VRAM(count+2)<<8)|(SMS_VDP_VRAM(count+3)<<0); | |
| 1086 | ||
| 1087 | for (xx=0;xx<8;xx++) | |
| 1088 | { | |
| 1089 | int drawxpos = x*8+xx; | |
| 1090 | ||
| 1091 | UINT8 pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 1092 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 1093 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 1094 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 1095 | ||
| 1096 | lineptr[drawxpos] = chip->cram_mamecolours[pixel+16]; | |
| 1097 | ||
| 1098 | } | |
| 1099 | ||
| 1100 | ||
| 1101 | count+=4;count&=0x3fff; | |
| 1102 | } | |
| 1103 | } | |
| 1104 | } | |
| 1105 | } | |
| 1106 | #endif | |
| 1107 | ||
| 1108 | /* | |
| 1109 | Register $00 - Mode Control No. 1 | |
| 1110 | ||
| 1111 | D7 - 1= Disable vertical scrolling for columns 24-31 | |
| 1112 | D6 - 1= Disable horizontal scrolling for rows 0-1 | |
| 1113 | D5 - 1= Mask column 0 with overscan color from register #7 | |
| 1114 | D4 - (IE1) 1= Line interrupt enable | |
| 1115 | D3 - (EC) 1= Shift sprites left by 8 pixels | |
| 1116 | D2 - (M4) 1= Use Mode 4, 0= Use TMS9918 modes (selected with M1, M2, M3) | |
| 1117 | D1 - (M2) Must be 1 for M1/M3 to change screen height in Mode 4. | |
| 1118 | Otherwise has no effect. | |
| 1119 | D0 - 1= No sync, display is monochrome, 0= Normal display | |
| 1120 | ||
| 1121 | Bits 0 and 5 have no effect on the GameGear in either mode, while bit 6 | |
| 1122 | has no effect in GG mode but works normally in SMS mode. | |
| 1123 | */ | |
| 1124 | ||
| 1125 | /* | |
| 1126 | Register $01 - Mode Control No. 2 | |
| 1127 | ||
| 1128 | D7 - No effect | |
| 1129 | D6 - (BLK) 1= Display visible, 0= display blanked. | |
| 1130 | D5 - (IE0) 1= Frame interrupt enable. | |
| 1131 | D4 - (M1) Selects 224-line screen for Mode 4 if M2=1, else has no effect. | |
| 1132 | D3 - (M3) Selects 240-line screen for Mode 4 if M2=1, else has no effect. | |
| 1133 | D2 - No effect | |
| 1134 | D1 - Sprites are 1=16x16,0=8x8 (TMS9918), Sprites are 1=8x16,0=8x8 (Mode 4) | |
| 1135 | D0 - Sprite pixels are doubled in size. | |
| 1136 | ||
| 1137 | Even though some games set bit 7, it does nothing. | |
| 1138 | */ | |
| 1139 | ||
| 1140 | static void end_of_frame(running_machine *machine, struct sms_vdp *chip) | |
| 1141 | { | |
| 1142 | UINT8 m1 = (chip->regs[0x1]&0x10)>>4; | |
| 1143 | UINT8 m2 = (chip->regs[0x0]&0x02)>>1; | |
| 1144 | UINT8 m3 = (chip->regs[0x1]&0x08)>>3; | |
| 1145 | UINT8 m4 = (chip->regs[0x0]&0x04)>>2; | |
| 1146 | UINT8 m5 = chip->is_pal; | |
| 1147 | chip->screen_mode = m1|(m2<<1)|(m3<<2)|(m4<<3)|(m5<<4); | |
| 1148 | ||
| 1149 | if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */ | |
| 1150 | { | |
| 1151 | rectangle visarea; | |
| 1152 | ||
| 1153 | visarea.min_x = 0; | |
| 1154 | visarea.max_x = 256-1; | |
| 1155 | visarea.min_y = 0; | |
| 1156 | visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1; | |
| 1157 | ||
| 1158 | if (chip->chip_id==3) video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); | |
| 1159 | ||
| 1160 | } | |
| 1161 | else /* 160x144 */ | |
| 1162 | { | |
| 1163 | rectangle visarea; | |
| 1164 | visarea.min_x = (256-160)/2; | |
| 1165 | visarea.max_x = (256-160)/2+160-1; | |
| 1166 | visarea.min_y = (192-144)/2; | |
| 1167 | visarea.max_y = (192-144)/2+144-1; | |
| 1168 | ||
| 1169 | video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); | |
| 1170 | } | |
| 1171 | ||
| 1172 | ||
| 1173 | ||
| 1174 | // printf("Mode: %s is ok\n", sms_mode_table[chip->screen_mode].sms2_name); | |
| 1175 | ||
| 1176 | chip->sms_scanline_counter = -1; | |
| 1177 | chip->yscroll = chip->regs[0x9]; // this can't change mid-frame | |
| 1178 | timer_adjust_oneshot(chip->sms_scanline_timer, attotime_zero, 0); | |
| 1179 | } | |
| 1180 | ||
| 1181 | ||
| 1182 | VIDEO_EOF(sms) | |
| 1183 | { | |
| 1184 | end_of_frame(machine, md_sms_vdp); | |
| 1185 | ||
| 1186 | // the SMS has a 'RESET' button on the machine, it generates an NMI | |
| 1187 | if (input_port_read_safe(machine,"PAUSE",0x00)) | |
| 1188 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1189 | ||
| 1190 | } | |
| 1191 | ||
| 1192 | ||
| 1193 | VIDEO_START(sms) | |
| 1194 | { | |
| 1195 | ||
| 1196 | } | |
| 1197 | ||
| 1198 | ||
| 1199 | MACHINE_RESET(sms) | |
| 1200 | { | |
| 1201 | timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0); | |
| 1202 | } | |
| 1203 | ||
| 1204 | ||
| 1205 | ||
| 1206 | UINT8* vdp2_vram_bank0; | |
| 1207 | UINT8* vdp2_vram_bank1; | |
| 1208 | ||
| 1209 | UINT8* vdp1_vram_bank0; | |
| 1210 | UINT8* vdp1_vram_bank1; | |
| 1211 | ||
| 1212 | void segae_set_vram_banks(UINT8 data) | |
| 1213 | { | |
| 1214 | if (data&0x80) | |
| 1215 | { | |
| 1216 | vdp1->vram = vdp1_vram_bank1; | |
| 1217 | } | |
| 1218 | else | |
| 1219 | { | |
| 1220 | vdp1->vram = vdp1_vram_bank0; | |
| 1221 | } | |
| 1222 | ||
| 1223 | if (data&0x40) | |
| 1224 | { | |
| 1225 | vdp2->vram = vdp2_vram_bank1; | |
| 1226 | } | |
| 1227 | else | |
| 1228 | { | |
| 1229 | vdp2->vram = vdp2_vram_bank0; | |
| 1230 | } | |
| 1231 | ||
| 1232 | ||
| 1233 | } | |
| 1234 | ||
| 1235 | MACHINE_RESET(systeme) | |
| 1236 | { | |
| 1237 | timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0); | |
| 1238 | timer_adjust_oneshot(vdp2->sms_scanline_timer, attotime_zero, 0); | |
| 1239 | } | |
| 1240 | ||
| 1241 | MACHINE_RESET(megatech_md_sms) | |
| 1242 | { | |
| 1243 | timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0); | |
| 1244 | } | |
| 1245 | ||
| 1246 | MACHINE_RESET(megatech_bios) | |
| 1247 | { | |
| 1248 | timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0); | |
| 1249 | } | |
| 1250 | ||
| 1251 | VIDEO_EOF(systeme) | |
| 1252 | { | |
| 1253 | end_of_frame(machine, vdp1); | |
| 1254 | end_of_frame(machine, vdp2); | |
| 1255 | } | |
| 1256 | ||
| 1257 | ||
| 1258 | VIDEO_EOF(megatech_md_sms) | |
| 1259 | { | |
| 1260 | end_of_frame(machine, md_sms_vdp); | |
| 1261 | } | |
| 1262 | ||
| 1263 | VIDEO_EOF(megatech_bios) | |
| 1264 | { | |
| 1265 | end_of_frame(machine, vdp1); | |
| 1266 | } | |
| 1267 | ||
| 1268 | VIDEO_UPDATE(megatech_md_sms) | |
| 1269 | { | |
| 1270 | int x,y; | |
| 1271 | ||
| 1272 | for (y=0;y<224;y++) | |
| 1273 | { | |
| 1274 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1275 | UINT16* srcptr = BITMAP_ADDR16(md_sms_vdp->r_bitmap, y, 0); | |
| 1276 | ||
| 1277 | for (x=0;x<256;x++) | |
| 1278 | { | |
| 1279 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1280 | } | |
| 1281 | } | |
| 1282 | ||
| 1283 | return 0; | |
| 1284 | } | |
| 1285 | ||
| 1286 | ||
| 1287 | VIDEO_UPDATE(megatech_bios) | |
| 1288 | { | |
| 1289 | int x,y; | |
| 1290 | ||
| 1291 | for (y=0;y<224;y++) | |
| 1292 | { | |
| 1293 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1294 | UINT16* srcptr = BITMAP_ADDR16(vdp1->r_bitmap, y, 0); | |
| 1295 | ||
| 1296 | for (x=0;x<256;x++) | |
| 1297 | { | |
| 1298 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1299 | } | |
| 1300 | } | |
| 1301 | ||
| 1302 | return 0; | |
| 1303 | } | |
| 1304 | ||
| 1305 | VIDEO_UPDATE(megaplay_bios) | |
| 1306 | { | |
| 1307 | int x,y; | |
| 1308 | ||
| 1309 | for (y=0;y<224;y++) | |
| 1310 | { | |
| 1311 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y+16, 32); | |
| 1312 | UINT16* srcptr = BITMAP_ADDR16(vdp1->r_bitmap, y, 0); | |
| 1313 | ||
| 1314 | for (x=0;x<256;x++) | |
| 1315 | { | |
| 1316 | UINT16 src = srcptr[x]&0x7fff; | |
| 1317 | ||
| 1318 | if (src) | |
| 1319 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1320 | } | |
| 1321 | } | |
| 1322 | ||
| 1323 | return 0; | |
| 1324 | } | |
| 1325 | ||
| 1326 | VIDEO_UPDATE(systeme) | |
| 1327 | { | |
| 1328 | // show_tiles(); | |
| 1329 | int x,y; | |
| 1330 | ||
| 1331 | for (y=0;y<192;y++) | |
| 1332 | { | |
| 1333 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1334 | UINT16* srcptr = BITMAP_ADDR16(vdp1->r_bitmap, y, 0); | |
| 1335 | ||
| 1336 | for (x=0;x<256;x++) | |
| 1337 | { | |
| 1338 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1339 | } | |
| 1340 | ||
| 1341 | } | |
| 1342 | ||
| 1343 | for (y=0;y<192;y++) | |
| 1344 | { | |
| 1345 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1346 | UINT16* srcptr = BITMAP_ADDR16(vdp2->r_bitmap, y, 0); | |
| 1347 | ||
| 1348 | for (x=0;x<256;x++) | |
| 1349 | { | |
| 1350 | if(!(srcptr[x]&0x8000)) lineptr[x]=srcptr[x]&0x7fff; | |
| 1351 | } | |
| 1352 | } | |
| 1353 | ||
| 1354 | ||
| 1355 | return 0; | |
| 1356 | } | |
| 1357 | ||
| 1358 | ||
| 1359 | ||
| 1360 | ||
| 1361 | READ8_HANDLER( sms_vdp_2_data_r ) | |
| 1362 | { | |
| 1363 | return vdp_data_r(vdp2); | |
| 1364 | } | |
| 1365 | ||
| 1366 | WRITE8_HANDLER( sms_vdp_2_data_w ) | |
| 1367 | { | |
| 1368 | vdp_data_w(space, data, vdp2); | |
| 1369 | } | |
| 1370 | ||
| 1371 | READ8_HANDLER( sms_vdp_2_ctrl_r ) | |
| 1372 | { | |
| 1373 | return vdp_ctrl_r(space, vdp2); | |
| 1374 | } | |
| 1375 | ||
| 1376 | WRITE8_HANDLER( sms_vdp_2_ctrl_w ) | |
| 1377 | { | |
| 1378 | vdp_ctrl_w(space, data, vdp2); | |
| 1379 | } | |
| 1380 | ||
| 1381 | ||
| 1382 | void init_for_megadrive(running_machine *machine) | |
| 1383 | { | |
| 1384 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GEN_VDP); | |
| 1385 | md_sms_vdp->set_irq = sms_vdp_cpu1_irq_callback; | |
| 1386 | md_sms_vdp->is_pal = 0; | |
| 1387 | md_sms_vdp->sms_total_scanlines = 262; | |
| 1388 | md_sms_vdp->sms_framerate = 60; | |
| 1389 | md_sms_vdp->chip_id = 3; | |
| 1390 | } | |
| 1391 | ||
| 1392 | ||
| 1393 | ||
| 1394 | DRIVER_INIT( megatech_bios ) | |
| 1395 | { | |
| 1396 | vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1397 | vdp1->set_irq = sms_vdp_cpu2_irq_callback; | |
| 1398 | vdp1->is_pal = 0; | |
| 1399 | vdp1->sms_total_scanlines = 262; | |
| 1400 | vdp1->sms_framerate = 60; | |
| 1401 | vdp1->chip_id = 1; | |
| 1402 | ||
| 1403 | vdp1_vram_bank0 = vdp1->vram; | |
| 1404 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1405 | ||
| 1406 | smsgg_backupram = 0; | |
| 1407 | } | |
| 1408 | ||
| 1409 | DRIVER_INIT( smscm ) | |
| 1410 | { | |
| 1411 | megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_CODEMASTERS); | |
| 1412 | ||
| 1413 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1414 | md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1415 | md_sms_vdp->is_pal = 1; | |
| 1416 | md_sms_vdp->sms_total_scanlines = 313; | |
| 1417 | md_sms_vdp->sms_framerate = 50; | |
| 1418 | md_sms_vdp->chip_id = 3; | |
| 1419 | ||
| 1420 | vdp1_vram_bank0 = md_sms_vdp->vram; | |
| 1421 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1422 | ||
| 1423 | smsgg_backupram = 0; | |
| 1424 | } | |
| 1425 | ||
| 1426 | DRIVER_INIT( smspal ) | |
| 1427 | { | |
| 1428 | megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD); | |
| 1429 | ||
| 1430 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1431 | md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1432 | md_sms_vdp->is_pal = 1; | |
| 1433 | md_sms_vdp->sms_total_scanlines = 313; | |
| 1434 | md_sms_vdp->sms_framerate = 50; | |
| 1435 | md_sms_vdp->chip_id = 3; | |
| 1436 | ||
| 1437 | vdp1_vram_bank0 = md_sms_vdp->vram; | |
| 1438 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1439 | ||
| 1440 | smsgg_backupram = 0; | |
| 1441 | } | |
| 1442 | ||
| 1443 | DRIVER_INIT( sms ) | |
| 1444 | { | |
| 1445 | megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD); | |
| 1446 | ||
| 1447 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1448 | md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1449 | md_sms_vdp->is_pal = 0; | |
| 1450 | md_sms_vdp->sms_total_scanlines = 262; | |
| 1451 | md_sms_vdp->sms_framerate = 60; | |
| 1452 | md_sms_vdp->chip_id = 3; | |
| 1453 | ||
| 1454 | vdp1_vram_bank0 = md_sms_vdp->vram; | |
| 1455 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1456 | ||
| 1457 | smsgg_backupram = 0; | |
| 1458 | } | |
| 1459 | ||
| 1460 | static UINT8 ioport_gg00_r(running_machine* machine) | |
| 1461 | { | |
| 1462 | UINT8 GG_START_BUTTON = input_port_read_safe(machine,"GGSTART",0x00); | |
| 1463 | ||
| 1464 | return (GG_START_BUTTON << 7) | | |
| 1465 | (0 << 6) | | |
| 1466 | (0 << 5) | | |
| 1467 | (0 << 4) | | |
| 1468 | (0 << 3) | | |
| 1469 | (0 << 2) | | |
| 1470 | (0 << 1) | | |
| 1471 | (0 << 0); | |
| 1472 | } | |
| 1473 | ||
| 1474 | ||
| 1475 | READ8_HANDLER( sms_ioport_gg00_r ) | |
| 1476 | { | |
| 1477 | return ioport_gg00_r(space->machine); | |
| 1478 | } | |
| 1479 | ||
| 1480 | ||
| 1481 | void init_extra_gg_ports(running_machine* machine, const char* tag) | |
| 1482 | { | |
| 1483 | const address_space *io = cputag_get_address_space(machine, tag, ADDRESS_SPACE_IO); | |
| 1484 | memory_install_read8_handler (io, 0x00, 0x00, 0, 0, sms_ioport_gg00_r); | |
| 1485 | } | |
| 1486 | ||
| 1487 | DRIVER_INIT( smsgg ) | |
| 1488 | { | |
| 1489 | megatech_set_genz80_as_sms_standard_map(machine, "maincpu", MAPPER_STANDARD); | |
| 1490 | init_extra_gg_ports(machine, "maincpu"); | |
| 1491 | ||
| 1492 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GG_VDP); | |
| 1493 | md_sms_vdp->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1494 | md_sms_vdp->is_pal = 0; | |
| 1495 | md_sms_vdp->sms_total_scanlines = 262; | |
| 1496 | md_sms_vdp->sms_framerate = 60; | |
| 1497 | md_sms_vdp->chip_id = 3; | |
| 1498 | ||
| 1499 | smsgg_backupram = 0; | |
| 1500 | } | |
| 1501 | ||
| 1502 | ||
| 1503 | DRIVER_INIT( hazemd_segasyse ) | |
| 1504 | { | |
| 1505 | vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1506 | // vdp1->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1507 | vdp1->is_pal = 0; | |
| 1508 | vdp1->sms_total_scanlines = 262; | |
| 1509 | vdp1->sms_framerate = 60; | |
| 1510 | vdp1->chip_id = 1; | |
| 1511 | ||
| 1512 | vdp1_vram_bank0 = vdp1->vram; | |
| 1513 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1514 | ||
| 1515 | ||
| 1516 | vdp2 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 1517 | vdp2->set_irq = sms_vdp_cpu0_irq_callback; | |
| 1518 | vdp2->is_pal = 0; | |
| 1519 | vdp2->sms_total_scanlines = 262; | |
| 1520 | vdp2->sms_framerate = 60; | |
| 1521 | vdp2->chip_id = 2; | |
| 1522 | ||
| 1523 | vdp2_vram_bank0 = vdp2->vram; | |
| 1524 | vdp2_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1525 | } | |
| 1526 | ||
| 1527 | /* Functions to set up the Memory Map | |
| 1528 | ||
| 1529 | -- these are needed because on a Genesis the Sound Z80 becomes the SMS Z80 in comptibility mode | |
| 1530 | so we need to be able to dynamically change the mapping | |
| 1531 | ||
| 1532 | */ | |
| 1533 | ||
| 1534 | static READ8_HANDLER( z80_unmapped_port_r ) | |
| 1535 | { | |
| 1536 | // printf("unmapped z80 port read %04x\n",offset); | |
| 1537 | return 0; | |
| 1538 | } | |
| 1539 | ||
| 1540 | static WRITE8_HANDLER( z80_unmapped_port_w ) | |
| 1541 | { | |
| 1542 | // printf("unmapped z80 port write %04x\n",offset); | |
| 1543 | } | |
| 1544 | ||
| 1545 | static READ8_HANDLER( z80_unmapped_r ) | |
| 1546 | { | |
| 1547 | printf("unmapped z80 read %04x\n",offset); | |
| 1548 | return 0; | |
| 1549 | } | |
| 1550 | ||
| 1551 | static WRITE8_HANDLER( z80_unmapped_w ) | |
| 1552 | { | |
| 1553 | printf("unmapped z80 write %04x\n",offset); | |
| 1554 | } | |
| 1555 | ||
| 1556 | static UINT8* sms_rom; | |
| 1557 | ||
| 1558 | ||
| 1559 | /* the SMS inputs should be more complex, like the megadrive ones */ | |
| 1560 | READ8_HANDLER (megatech_sms_ioport_dc_r) | |
| 1561 | { | |
| 1562 | running_machine *machine = space->machine; | |
| 1563 | /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */ | |
| 1564 | /* bit 4: TL-A; bit 5: TR-A */ | |
| 1565 | return (input_port_read(machine, "PAD1") & 0x3f) | ((input_port_read(machine, "PAD2") & 0x03) << 6); | |
| 1566 | } | |
| 1567 | ||
| 1568 | READ8_HANDLER (megatech_sms_ioport_dd_r) | |
| 1569 | { | |
| 1570 | running_machine *machine = space->machine; | |
| 1571 | /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */ | |
| 1572 | /* bit 2: TL-B; bit 3: TR-B; bit 4: RESET; bit 5: unused; bit 6: TH-A; bit 7: TH-B*/ | |
| 1573 | return ((input_port_read(machine, "PAD2") & 0x3c) >> 2) | 0x10; | |
| 1574 | } | |
| 1575 | ||
| 1576 | ||
| 1577 | READ8_HANDLER( smsgg_backupram_r ) | |
| 1578 | { | |
| 1579 | return smsgg_backupram[offset]; | |
| 1580 | } | |
| 1581 | ||
| 1582 | WRITE8_HANDLER( smsgg_backupram_w ) | |
| 1583 | { | |
| 1584 | smsgg_backupram[offset] = data; | |
| 1585 | } | |
| 1586 | ||
| 1587 | ||
| 1588 | static WRITE8_HANDLER( mt_sms_standard_rom_bank_w ) | |
| 1589 | { | |
| 1590 | int bank = data&0x1f; | |
| 1591 | //logerror("bank w %02x %02x\n", offset, data); | |
| 1592 | ||
| 1593 | sms_mainram[0x1ffc+offset] = data; | |
| 1594 | switch (offset) | |
| 1595 | { | |
| 1596 | case 0: | |
| 1597 | logerror("bank w %02x %02x\n", offset, data); | |
| 1598 | if ((data & 0x08) && smsgg_backupram) | |
| 1599 | { | |
| 1600 | memory_install_readwrite8_handler(space, 0x8000, 0x9fff, 0, 0, smsgg_backupram_r, smsgg_backupram_w); | |
| 1601 | } | |
| 1602 | else | |
| 1603 | { | |
| 1604 | memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); | |
| 1605 | } | |
| 1606 | ||
| 1607 | //printf("bank ram??\n"); | |
| 1608 | break; | |
| 1609 | case 1: | |
| 1610 | memcpy(sms_rom+0x0000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 1611 | break; | |
| 1612 | case 2: | |
| 1613 | memcpy(sms_rom+0x4000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 1614 | break; | |
| 1615 | case 3: | |
| 1616 | memcpy(sms_rom+0x8000, memory_region(space->machine, "maincpu")+bank*0x4000, 0x4000); | |
| 1617 | break; | |
| 1618 | ||
| 1619 | } | |
| 1620 | } | |
| 1621 | ||
| 1622 | static WRITE8_HANDLER( codemasters_rom_bank_0000_w ) | |
| 1623 | { | |
| 1624 | int bank = data&0x1f; | |
| 1625 | memcpy(sms_rom+0x0000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000); | |
| 1626 | } | |
| 1627 | ||
| 1628 | static WRITE8_HANDLER( codemasters_rom_bank_4000_w ) | |
| 1629 | { | |
| 1630 | int bank = data&0x1f; | |
| 1631 | memcpy(sms_rom+0x4000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000); | |
| 1632 | } | |
| 1633 | ||
| 1634 | static WRITE8_HANDLER( codemasters_rom_bank_8000_w ) | |
| 1635 | { | |
| 1636 | int bank = data&0x1f; | |
| 1637 | memcpy(sms_rom+0x8000, memory_region(space->machine,"maincpu")+bank*0x4000, 0x4000); | |
| 1638 | } | |
| 1639 | ||
| 1640 | ||
| 1641 | static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine, const char* tag) | |
| 1642 | { | |
| 1643 | /* INIT THE PORTS *********************************************************************************************/ | |
| 1644 | ||
| 1645 | const address_space *io = cputag_get_address_space(machine, tag, ADDRESS_SPACE_IO); | |
| 1646 | const device_config *sn = devtag_get_device(machine, "sn"); | |
| 1647 | ||
| 1648 | memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); | |
| 1649 | ||
| 1650 | memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r); | |
| 1651 | memory_install_write8_device_handler(io, sn, 0x7e, 0x7f, 0, 0, sn76496_w); | |
| 1652 | memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w); | |
| 1653 | memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w); | |
| 1654 | ||
| 1655 | memory_install_read8_handler (io, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris | |
| 1656 | ||
| 1657 | memory_install_read8_handler (io, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r); | |
| 1658 | memory_install_read8_handler (io, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r); | |
| 1659 | memory_install_read8_handler (io, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r); | |
| 1660 | memory_install_read8_handler (io, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family | |
| 1661 | } | |
| 1662 | ||
| 1663 | void megatech_set_genz80_as_sms_standard_map(running_machine *machine, const char* tag, int mapper) | |
| 1664 | { | |
| 1665 | /* INIT THE MEMMAP / BANKING *********************************************************************************/ | |
| 1666 | ||
| 1667 | /* catch any addresses that don't get mapped */ | |
| 1668 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); | |
| 1669 | ||
| 1670 | /* main ram area */ | |
| 1671 | sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram | |
| 1672 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); | |
| 1673 | memory_set_bankptr(machine, 6, sms_mainram ); | |
| 1674 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); | |
| 1675 | memory_set_bankptr(machine, 7, sms_mainram ); | |
| 1676 | memset(sms_mainram,0x00,0x2000); | |
| 1677 | ||
| 1678 | megatech_set_genz80_as_sms_standard_ports(machine, tag); | |
| 1679 | ||
| 1680 | if (mapper == MAPPER_STANDARD ) | |
| 1681 | { | |
| 1682 | /* fixed rom bank area */ | |
| 1683 | sms_rom = auto_alloc_array(machine, UINT8, 0x400000); | |
| 1684 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); | |
| 1685 | memory_set_bankptr(machine, 5, sms_rom ); | |
| 1686 | ||
| 1687 | memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000); | |
| 1688 | ||
| 1689 | ||
| 1690 | memory_install_write8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w); | |
| 1691 | ||
| 1692 | } | |
| 1693 | else if (mapper == MAPPER_CODEMASTERS ) | |
| 1694 | { | |
| 1695 | /* fixed rom bank area */ | |
| 1696 | sms_rom = auto_alloc_array(machine, UINT8, 0xc000); | |
| 1697 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); | |
| 1698 | memory_set_bankptr(machine, 5, sms_rom ); | |
| 1699 | ||
| 1700 | memcpy(sms_rom, memory_region(machine, "maincpu"), 0xc000); | |
| 1701 | ||
| 1702 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x0000, 0, 0, codemasters_rom_bank_0000_w); | |
| 1703 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x4000, 0, 0, codemasters_rom_bank_4000_w); | |
| 1704 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, codemasters_rom_bank_8000_w); | |
| 1705 | } | |
| 1706 | // smsgg_backupram = NULL; | |
| 1707 | } | |
| 1708 | ||
| 1709 | static NVRAM_HANDLER( sms ) | |
| 1710 | { | |
| 1711 | if (smsgg_backupram!=NULL) | |
| 1712 | { | |
| 1713 | if (read_or_write) | |
| 1714 | mame_fwrite(file, smsgg_backupram, 0x2000); | |
| 1715 | else | |
| 1716 | { | |
| 1717 | if (file) | |
| 1718 | { | |
| 1719 | mame_fread(file, smsgg_backupram, 0x2000); | |
| 1720 | } | |
| 1721 | } | |
| 1722 | } | |
| 1723 | } | |
| 1724 | ||
| 1725 | MACHINE_DRIVER_START( sms ) | |
| 1726 | MDRV_CPU_ADD("maincpu", Z80, 3579540) | |
| 1727 | //MDRV_CPU_PROGRAM_MAP(sms_map) | |
| 1728 | MDRV_CPU_IO_MAP(sms_io_map) | |
| 1729 | ||
| 1730 | /* IRQ handled via the timers */ | |
| 1731 | MDRV_MACHINE_RESET(sms) | |
| 1732 | ||
| 1733 | MDRV_SCREEN_ADD("screen", RASTER) | |
| 1734 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 1735 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) // Vblank handled manually. | |
| 1736 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15) | |
| 1737 | MDRV_SCREEN_SIZE(256, 256) | |
| 1738 | MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 223) | |
| 1739 | // MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 191) | |
| 1740 | ||
| 1741 | MDRV_PALETTE_LENGTH(0x200) | |
| 1742 | ||
| 1743 | MDRV_VIDEO_START(sms) | |
| 1744 | MDRV_VIDEO_UPDATE(megatech_md_sms) /* Copies a bitmap */ | |
| 1745 | MDRV_VIDEO_EOF(sms) /* Used to Sync the timing */ | |
| 1746 | ||
| 1747 | MDRV_NVRAM_HANDLER( sms ) | |
| 1748 | ||
| 1749 | /* sound hardware */ | |
| 1750 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 1751 | ||
| 1752 | MDRV_SOUND_ADD("sn", SN76496, 3579540) | |
| 1753 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 1754 | MACHINE_DRIVER_END | |
| 1755 | ||
| 1756 |
| r5955 | r5956 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | changelog: |
| 4 | 4 | |
| 5 | 01 Oct 2009 - Converted to use the HazeMD SMS code so that old code | |
| 6 | can be removed, however this makes the text transparent, | |
| 7 | which IIRC is incorrect | |
| 8 | ||
| 5 | 9 | 22 Sept 2007 - Started updating this to use the new Megadrive code, |
| 6 | 10 | fixing issues with Mazin Wars + Grand Slam. |
| 7 | 11 | However I'm still not convinced that the handling of |
| r5955 | r5956 | |
| 37 | 41 | |
| 38 | 42 | Only a handful of games were released for this system. |
| 39 | 43 | |
| 44 | Bugs: | |
| 45 | Most of this is guesswork and should be verified on real hw. Sometims after inserting | |
| 46 | a coin and pressing start the 'press start' message remains on screen and no credit is | |
| 47 | deducted. (timing?) | |
| 48 | ||
| 49 | ||
| 40 | 50 | */ |
| 41 | 51 | |
| 42 | 52 | #include "driver.h" |
| r5955 | r5956 | |
| 46 | 56 | #include "deprecat.h" |
| 47 | 57 | #include "genesis.h" |
| 48 | 58 | #include "megadriv.h" |
| 59 | #include "segamsys.h" | |
| 49 | 60 | |
| 50 | 61 | #define MASTER_CLOCK 53693100 |
| 51 | 62 | |
| r5955 | r5956 | |
| 56 | 67 | static UINT32 bios_bank; // ROM bank selection |
| 57 | 68 | static UINT16 game_banksel; // Game bank selection |
| 58 | 69 | static UINT32 bios_mode = MP_ROM; // determines whether ROM banks or Game data |
| 59 | // is to read from 0x8000-0xffff | |
| 70 | // is to read from 0x8000-0xffff | |
| 71 | static UINT32 mp_bios_bank_addr; | |
| 72 | ||
| 60 | 73 | static UINT32 bios_width; // determines the way the game info ROM is read |
| 61 | 74 | UINT8 bios_ctrl[6]; |
| 62 | 75 | static UINT8 bios_6600; |
| r5955 | r5956 | |
| 71 | 84 | //static UINT8 ic36_ram[0x4000]; |
| 72 | 85 | |
| 73 | 86 | |
| 74 | static UINT8 hintcount; | |
| 87 | //static UINT8 hintcount; /* line interrupt counter, decreased each scanline */ | |
| 75 | 88 | extern UINT8 segae_vintpending; |
| 76 | 89 | extern UINT8 segae_hintpending; |
| 77 | 90 | extern UINT8 *segae_vdp_regs[]; /* pointer to vdp's registers */ |
| 78 | 91 | |
| 79 | 92 | // Interrupt handler - from drivers/segasyse.c |
| 93 | #if 0 | |
| 80 | 94 | static INTERRUPT_GEN (megaplay_bios_irq) |
| 81 | 95 | { |
| 82 | 96 | int sline; |
| r5955 | r5956 | |
| 116 | 130 | } |
| 117 | 131 | |
| 118 | 132 | } |
| 133 | #endif | |
| 119 | 134 | |
| 120 | ||
| 121 | 135 | static UINT32 readpos = 1; // serial bank selection position (9-bit) |
| 122 | 136 | |
| 123 | 137 | static INPUT_PORTS_START ( megaplay ) |
| r5955 | r5956 | |
| 564 | 578 | |
| 565 | 579 | static READ8_HANDLER( bank_r ) |
| 566 | 580 | { |
| 567 | UINT8* bank = memory_region(space->machine, "mpbios"); | |
| 568 | UINT8* game = memory_region(space->machine, "maincpu"); | |
| 581 | UINT32 fulladdress; | |
| 582 | UINT8* bank = memory_region(space->machine, "mtbios"); | |
| 569 | 583 | |
| 570 | if(game_banksel == 0x142) // Genesis I/O | |
| 571 | return OLD_megaplay_genesis_io_r(space, (offset & 0x1f) / 2, 0xffff); | |
| 584 | fulladdress = mp_bios_bank_addr + offset; | |
| 572 | 585 | |
| 573 | if(bios_mode & MP_ROM) | |
| 586 | ||
| 587 | if ((fulladdress >= 0x000000) && (fulladdress <= 0x3fffff)) // ROM Addresses | |
| 574 | 588 | { |
| 575 | int sel = (bios_bank >> 6) & 0x03; | |
| 589 | if(bios_mode & MP_ROM) | |
| 590 | { | |
| 591 | int sel = (bios_bank >> 6) & 0x03; | |
| 576 | 592 | |
| 577 | // popmessage("Reading from Bank %i",sel); | |
| 578 | ||
| 579 | if(sel == 0) | |
| 580 | return 0xff; | |
| 593 | if(sel == 0) | |
| 594 | return 0xff; | |
| 595 | else | |
| 596 | return bank[0x10000 + (sel-1)*0x8000 + offset]; | |
| 597 | } | |
| 598 | else if(bios_width & 0x08) | |
| 599 | { | |
| 600 | if(offset >= 0x2000) | |
| 601 | return ic36_ram[offset - 0x2000]; | |
| 602 | else | |
| 603 | return ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset]; | |
| 604 | } | |
| 581 | 605 | else |
| 582 | return bank[0x10000 + (sel-1)*0x8000 + offset]; | |
| 606 | { | |
| 607 | return memory_region(space->machine, "maincpu")[fulladdress^1]; | |
| 608 | } | |
| 583 | 609 | } |
| 610 | else if(fulladdress>=0xa10000 && fulladdress<=0xa1001f) // IO Acess | |
| 611 | { | |
| 612 | return OLD_megaplay_genesis_io_r(space, (offset & 0x1f) / 2, 0xffff); | |
| 613 | } | |
| 584 | 614 | else |
| 585 | 615 | { |
| 586 | if(game_banksel == 0x60 || game_banksel == 0x61) /* read game info ROM */ | |
| 587 | if(bios_width & 0x08) | |
| 588 | { | |
| 589 | if(offset >= 0x2000) | |
| 590 | return ic36_ram[offset - 0x2000]; | |
| 591 | else | |
| 592 | return ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset]; | |
| 593 | } | |
| 594 | else | |
| 595 | return game[((game_banksel)*0x8000 + offset)]; | |
| 596 | else | |
| 597 | return game[(game_banksel*0x8000 + (offset ^ 0x01))]; | |
| 616 | printf("bank_r fulladdress %08x\n",fulladdress); | |
| 617 | return 0x00; | |
| 598 | 618 | } |
| 619 | ||
| 599 | 620 | } |
| 600 | 621 | |
| 601 | 622 | static WRITE8_HANDLER ( bank_w ) |
| 602 | 623 | { |
| 603 | if(game_banksel == 0x142) // Genesis I/O | |
| 604 | OLD_megaplay_genesis_io_w(space, (offset & 0x1f) / 2, data, 0xffff); | |
| 624 | UINT32 fulladdress; | |
| 625 | fulladdress = mp_bios_bank_addr + offset; | |
| 605 | 626 | |
| 606 | if(offset <= 0x1fff && (bios_width & 0x08)) | |
| 607 | ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data; | |
| 627 | if ((fulladdress >= 0x000000) && (fulladdress <= 0x3fffff)) // ROM / Megaplay Custom Addresses | |
| 628 | { | |
| 629 | if(offset <= 0x1fff && (bios_width & 0x08)) | |
| 630 | { | |
| 631 | ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data; | |
| 632 | } | |
| 608 | 633 | |
| 609 | if(offset >= 0x2000 && (bios_width & 0x08)) | |
| 610 | // ic36_ram[offset] = data; | |
| 611 | ic36_ram[offset - 0x2000] = data; | |
| 634 | if(offset >= 0x2000 && (bios_width & 0x08)) | |
| 635 | { | |
| 636 | // ic36_ram[offset] = data; | |
| 637 | ic36_ram[offset - 0x2000] = data; | |
| 638 | } | |
| 639 | } | |
| 640 | else if(fulladdress>=0xa10000 && fulladdress<=0xa1001f) // IO Access | |
| 641 | { | |
| 642 | OLD_megaplay_genesis_io_w(space, (offset & 0x1f) / 2, data, 0xffff); | |
| 643 | } | |
| 644 | else | |
| 645 | { | |
| 646 | printf("bank_w fulladdress %08x\n",fulladdress); | |
| 647 | } | |
| 612 | 648 | } |
| 613 | 649 | |
| 614 | 650 | |
| r5955 | r5956 | |
| 686 | 722 | // popmessage("Game bank selected: 0x%03x",game_banksel); |
| 687 | 723 | logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n",cpu_get_previouspc(space->cpu),game_banksel); |
| 688 | 724 | } |
| 725 | ||
| 726 | mp_bios_bank_addr = ( ( mp_bios_bank_addr >> 1 ) | ( data << 23 ) ) & 0xff8000; | |
| 727 | ||
| 728 | ||
| 689 | 729 | } |
| 690 | 730 | |
| 691 | 731 | static ADDRESS_MAP_START( megaplay_bios_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r5955 | r5956 | |
| 714 | 754 | void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data ); |
| 715 | 755 | void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data ); |
| 716 | 756 | |
| 757 | #if 0 | |
| 717 | 758 | static READ8_HANDLER (megaplay_bios_port_be_bf_r) |
| 718 | 759 | { |
| 719 | 760 | UINT8 temp = 0; |
| r5955 | r5956 | |
| 738 | 779 | segae_vdp_ctrl_w(0, data); break; |
| 739 | 780 | } |
| 740 | 781 | } |
| 782 | #endif | |
| 741 | 783 | |
| 742 | ||
| 743 | 784 | static ADDRESS_MAP_START( megaplay_bios_io_map, ADDRESS_SPACE_IO, 8 ) |
| 744 | 785 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 745 | // AM_RANGE(0x3f, 0x3f) AM_WRITE(megatech_bios_port_ctrl_w) | |
| 746 | 786 | AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("sn2", sn76496_w) /* SN76489 */ |
| 747 | // AM_RANGE(0xdc, 0xdc) AM_READ(megatech_bios_port_dc_r) // player inputs | |
| 748 | // AM_RANGE(0xdd, 0xdd) AM_READ(megatech_bios_port_dd_r) // other player 2 inputs | |
| 749 | AM_RANGE(0xbe, 0xbf) AM_READWRITE(megaplay_bios_port_be_bf_r, megaplay_bios_port_be_bf_w) /* VDP */ | |
| 787 | AM_RANGE(0xbe, 0xbe) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w) /* VDP */ | |
| 788 | AM_RANGE(0xbf, 0xbf) AM_READWRITE(sms_vdp_ctrl_r, sms_vdp_ctrl_w) /* VDP */ | |
| 750 | 789 | ADDRESS_MAP_END |
| 751 | 790 | |
| 752 | /* in video/segasyse.c */ | |
| 753 | VIDEO_START( megaplay_normal ); | |
| 754 | VIDEO_UPDATE( megaplay_normal ); | |
| 755 | 791 | |
| 792 | ||
| 793 | ||
| 756 | 794 | static VIDEO_START(megplay) |
| 757 | 795 | { |
| 758 | 796 | //printf("megplay vs\n"); |
| 759 | 797 | VIDEO_START_CALL(megadriv); |
| 760 | ||
| 798 | // VIDEO_START_CALL(megaplay_normal); | |
| 761 | 799 | } |
| 762 | 800 | |
| 763 | 801 | static VIDEO_UPDATE(megplay) |
| 764 | 802 | { |
| 765 | 803 | //printf("megplay vu\n"); |
| 766 | 804 | VIDEO_UPDATE_CALL(megadriv); |
| 767 | VIDEO_UPDATE_CALL(megaplay_normal); | |
| 805 | // VIDEO_UPDATE_CALL(megaplay_normal); | |
| 806 | VIDEO_UPDATE_CALL(megaplay_bios); | |
| 768 | 807 | return 0; |
| 769 | 808 | } |
| 770 | 809 | |
| 771 | 810 | |
| 772 | 811 | //extern VIDEO_EOF(megadriv); |
| 812 | static MACHINE_RESET( mpnew ) | |
| 813 | { | |
| 814 | mp_bios_bank_addr = 0; | |
| 815 | MACHINE_RESET_CALL(megadriv); | |
| 816 | MACHINE_RESET_CALL(megatech_bios); | |
| 817 | } | |
| 773 | 818 | |
| 819 | static VIDEO_EOF( mpnew ) | |
| 820 | { | |
| 821 | VIDEO_EOF_CALL(megadriv); | |
| 822 | VIDEO_EOF_CALL(megatech_bios); | |
| 823 | } | |
| 824 | ||
| 774 | 825 | static MACHINE_DRIVER_START( mpnew ) |
| 775 | 826 | |
| 776 | 827 | /* basic machine hardware */ |
| r5955 | r5956 | |
| 778 | 829 | |
| 779 | 830 | /* The Megaplay has an extra BIOS cpu which drives an SMS VDP |
| 780 | 831 | which includes an SN76496 for sound */ |
| 781 | MDRV_CPU_ADD("m | |
| 832 | MDRV_CPU_ADD("mtbios", Z80, MASTER_CLOCK / 15) /* ?? */ | |
| 782 | 833 | MDRV_CPU_PROGRAM_MAP(megaplay_bios_map) |
| 783 | 834 | MDRV_CPU_IO_MAP(megaplay_bios_io_map) |
| 784 | MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262) | |
| 835 | //MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262) | |
| 785 | 836 | |
| 837 | MDRV_MACHINE_RESET( mpnew ) | |
| 838 | MDRV_VIDEO_EOF( mpnew ) | |
| 839 | ||
| 786 | 840 | MDRV_QUANTUM_TIME(HZ(6000)) |
| 787 | 841 | |
| 788 | 842 | MDRV_SOUND_ADD("sn2", SN76496, MASTER_CLOCK/15) |
| r5955 | r5956 | |
| 811 | 865 | |
| 812 | 866 | ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) |
| 813 | 867 | |
| 814 | ROM_REGION( 0x28000, "m | |
| 868 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 815 | 869 | MEGAPLAY_BIOS |
| 816 | 870 | ROM_END |
| 817 | 871 | |
| 872 | /* The system appears to access the instruction rom at | |
| 873 | 0x300000 in the 68k space (rom window from z80 side) | |
| 874 | ||
| 875 | This probably means the maximum 68k rom size is 0x2fffff for MegaPlay | |
| 876 | */ | |
| 877 | ||
| 818 | 878 | ROM_START( mp_sonic ) /* Sonic */ |
| 819 | 879 | ROM_REGION( 0x400000, "maincpu", 0 ) |
| 820 | 880 | ROM_LOAD16_BYTE( "ep15177.ic2", 0x000000, 0x040000, CRC(a389b03b) SHA1(8e9e1cf3dd65ddf08757f5a1ce472130c902ea2c) ) |
| r5955 | r5956 | |
| 824 | 884 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 825 | 885 | ROM_LOAD( "ep15175-01.ic3", 0x000000, 0x08000, CRC(99246889) SHA1(184aa3b7fdedcf578c5e34edb7ed44f57f832258) ) |
| 826 | 886 | |
| 827 | ROM_REGION( 0x28000, "m | |
| 887 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 828 | 888 | MEGAPLAY_BIOS |
| 829 | 889 | ROM_END |
| 830 | 890 | |
| r5955 | r5956 | |
| 840 | 900 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 841 | 901 | ROM_LOAD( "1.ic3", 0x000000, 0x08000, CRC(dac9bf91) SHA1(0117972a7181f8aaf942a259cc8764b821031253) ) |
| 842 | 902 | |
| 843 | ROM_REGION( 0x28000, "m | |
| 903 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 844 | 904 | MEGAPLAY_BIOS |
| 845 | 905 | ROM_END |
| 846 | 906 | |
| r5955 | r5956 | |
| 853 | 913 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 854 | 914 | ROM_LOAD( "ep15175-02b.ic3", 0x000000, 0x08000, CRC(3039b653) SHA1(b19874c74d0fc0cca1169f62e5e74f0e8ca83679) ) // 15175-02b.ic3 |
| 855 | 915 | |
| 856 | ROM_REGION( 0x28000, "m | |
| 916 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 857 | 917 | MEGAPLAY_BIOS |
| 858 | 918 | ROM_END |
| 859 | 919 | |
| r5955 | r5956 | |
| 866 | 926 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 867 | 927 | ROM_LOAD( "epr-15175-03.ic3", 0x000000, 0x08000, CRC(70ea1aec) SHA1(0d9d82a1f8aa51d02707f7b343e7cfb6591efccd) ) // 15175-02b.ic3 |
| 868 | 928 | |
| 869 | ROM_REGION( 0x28000, "m | |
| 929 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 870 | 930 | MEGAPLAY_BIOS |
| 871 | 931 | ROM_END |
| 872 | 932 | |
| r5955 | r5956 | |
| 880 | 940 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 881 | 941 | ROM_LOAD( "ep15175-04.ic3", 0x000000, 0x08000, CRC(faf7c030) SHA1(16ef405335b4d3ecb0b7d97b088dafc4278d4726) ) |
| 882 | 942 | |
| 883 | ROM_REGION( 0x28000, "m | |
| 943 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 884 | 944 | MEGAPLAY_BIOS |
| 885 | 945 | ROM_END |
| 886 | 946 | |
| r5955 | r5956 | |
| 892 | 952 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 893 | 953 | ROM_LOAD( "epr-15175-05.ic2", 0x000000, 0x08000, CRC(1df5347c) SHA1(faced2e875e1914392f61577b5256d006eebeef9) ) |
| 894 | 954 | |
| 895 | ROM_REGION( 0x28000, "m | |
| 955 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 896 | 956 | MEGAPLAY_BIOS |
| 897 | 957 | ROM_END |
| 898 | 958 | |
| r5955 | r5956 | |
| 904 | 964 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 905 | 965 | ROM_LOAD( "epr-15175-06.ic2", 0x000000, 0x08000, CRC(1ef64e41) SHA1(13984b714b014ea41963b70de74a5358ed223bc5) ) |
| 906 | 966 | |
| 907 | ROM_REGION( 0x28000, "m | |
| 967 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 908 | 968 | MEGAPLAY_BIOS |
| 909 | 969 | ROM_END |
| 910 | 970 | |
| r5955 | r5956 | |
| 916 | 976 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 917 | 977 | ROM_LOAD( "epr-15175-07.ic1", 0x000000, 0x08000, CRC(bb5f67f0) SHA1(33b7a5d14015a5fcf41976a8f648f8f48ce9bb03) ) |
| 918 | 978 | |
| 919 | ROM_REGION( 0x28000, "m | |
| 979 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 920 | 980 | MEGAPLAY_BIOS |
| 921 | 981 | ROM_END |
| 922 | 982 | |
| r5955 | r5956 | |
| 928 | 988 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 929 | 989 | ROM_LOAD( "epr-15175-11.ic2", 0x000000, 0x08000, CRC(bb651120) SHA1(81cb736f2732373e260dde162249c1d29a3489c3) ) |
| 930 | 990 | |
| 931 | ROM_REGION( 0x28000, "m | |
| 991 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 932 | 992 | MEGAPLAY_BIOS |
| 933 | 993 | ROM_END |
| 934 | 994 | |
| r5955 | r5956 | |
| 940 | 1000 | ROM_REGION( 0x8000, "user1", 0 ) /* Game Instructions */ |
| 941 | 1001 | ROM_LOAD( "epr-15175-09.ic2", 0x000000, 0x08000, CRC(6254e45a) SHA1(8667922a6eade03c964ce224f7fa39ba871c60a4) ) |
| 942 | 1002 | |
| 943 | ROM_REGION( 0x28000, "m | |
| 1003 | ROM_REGION( 0x28000, "mtbios", 0 ) /* Bios */ | |
| 944 | 1004 | MEGAPLAY_BIOS |
| 945 | 1005 | ROM_END |
| 946 | 1006 | |
| 947 | 1007 | |
| 948 | 1008 | static void megplay_stat(running_machine *machine) |
| 949 | 1009 | { |
| 950 | UINT8 *src = memory_region(machine, "m | |
| 1010 | UINT8 *src = memory_region(machine, "mtbios"); | |
| 951 | 1011 | UINT8 *instruction_rom = memory_region(machine, "user1"); |
| 952 | 1012 | UINT8 *game_rom = memory_region(machine, "maincpu"); |
| 953 | 1013 | int offs; |
| r5955 | r5956 | |
| 1010 | 1070 | |
| 1011 | 1071 | /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */ |
| 1012 | 1072 | memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram); |
| 1073 | ||
| 1074 | DRIVER_INIT_CALL(megatech_bios); // create the SMS vdp etc. | |
| 1075 | ||
| 1013 | 1076 | } |
| 1014 | 1077 | |
| 1015 | 1078 | /* |
| r0 | r5956 | |
|---|---|---|
| 1 | /* System E stuff */ | |
| 2 | ||
| 3 | enum sms_mapper | |
| 4 | { | |
| 5 | MAPPER_STANDARD = 0, | |
| 6 | MAPPER_CODEMASTERS = 1 | |
| 7 | }; | |
| 8 | ||
| 9 | ||
| 10 | extern VIDEO_UPDATE(megatech_bios); | |
| 11 | extern VIDEO_UPDATE(megaplay_bios); | |
| 12 | extern VIDEO_UPDATE(megatech_md_sms); | |
| 13 | extern DRIVER_INIT( megatech_bios ); | |
| 14 | extern DRIVER_INIT( hazemd_segasyse ); | |
| 15 | extern MACHINE_RESET(megatech_bios); | |
| 16 | extern MACHINE_RESET(megatech_md_sms); | |
| 17 | extern VIDEO_EOF(megatech_bios); | |
| 18 | extern VIDEO_EOF(megatech_md_sms); | |
| 19 | ||
| 20 | extern READ8_HANDLER( sms_vcounter_r ); | |
| 21 | extern READ8_HANDLER( sms_vdp_data_r ); | |
| 22 | extern WRITE8_HANDLER( sms_vdp_data_w ); | |
| 23 | extern READ8_HANDLER( sms_vdp_ctrl_r ); | |
| 24 | extern WRITE8_HANDLER( sms_vdp_ctrl_w ); | |
| 25 | ||
| 26 | extern void init_for_megadrive(running_machine *machine); | |
| 27 | extern void segae_md_sms_stop_scanline_timer(void); | |
| 28 | ||
| 29 | ||
| 30 | extern READ8_HANDLER( md_sms_vdp_vcounter_r ); | |
| 31 | extern READ8_HANDLER( md_sms_vdp_data_r ); | |
| 32 | extern WRITE8_HANDLER( md_sms_vdp_data_w ); | |
| 33 | extern READ8_HANDLER( md_sms_vdp_ctrl_r ); | |
| 34 | extern WRITE8_HANDLER( md_sms_vdp_ctrl_w ); | |
| 35 | ||
| 36 | extern VIDEO_START(sms); | |
| 37 | extern READ8_HANDLER( sms_vdp_2_data_r ); | |
| 38 | extern WRITE8_HANDLER( sms_vdp_2_data_w ); | |
| 39 | extern READ8_HANDLER( sms_vdp_2_ctrl_r ); | |
| 40 | extern WRITE8_HANDLER( sms_vdp_2_ctrl_w ); | |
| 41 | extern VIDEO_EOF(systeme); | |
| 42 | extern VIDEO_UPDATE(systeme); | |
| 43 | extern MACHINE_RESET(systeme); | |
| 44 | extern UINT8* sms_mainram; | |
| 45 | extern UINT8* vdp2_vram_bank0; | |
| 46 | extern UINT8* vdp2_vram_bank1; | |
| 47 | extern UINT8* vdp1_vram_bank0; | |
| 48 | extern UINT8* vdp1_vram_bank1; | |
| 49 | extern void segae_set_vram_banks(UINT8 data); | |
| 50 | extern void megatech_set_genz80_as_sms_standard_map(running_machine *machine, const char* tag, int mapper); | |
| 51 | MACHINE_DRIVER_EXTERN(sms); | |
| 52 | extern DRIVER_INIT(sms); | |
| 53 | extern DRIVER_INIT(smspal); | |
| 54 | extern DRIVER_INIT(smscm); | |
| 55 | extern DRIVER_INIT( smsgg ); | |
| 56 | ||
| 57 | INPUT_PORTS_EXTERN(sms); | |
| 58 | INPUT_PORTS_EXTERN(gamegear); | |
| 59 | extern UINT8* smsgg_backupram; | |
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 |
| r5955 | r5956 | |
|---|---|---|
| 1 | /* Sega System E */ | |
| 2 | ||
| 1 | 3 | /* |
| 2 | 4 | |
| 3 | Sega System E | |
| 4 | -- this is a modified version of the sms.c from HazeMD | |
| 5 | it really needs some improvements | |
| 6 | 5 | |
| 7 | ||
| 8 | 6 | Sega System 'E' is a piece of hardware used for a couple of Arcade Games |
| 9 | 7 | produced by Sega in the Mid 80's, its roughly based on their Sega Master System |
| 10 | 8 | home console unit, using the same '315-5124' VDP (actually in this case 2 of |
| r5955 | r5956 | |
| 285 | 283 | |
| 286 | 284 | Known issues: |
| 287 | 285 | |
| 288 | sometimes hangonjr has corrupt gfx when you start a game, I don't know why | |
| 286 | sometimes hangonjr has corrupt gfx when you start a game, I don't know why (timing?) | |
| 289 | 287 | |
| 290 | 288 | todo: |
| 291 | 289 | |
| r5955 | r5956 | |
| 300 | 298 | #include "sound/sn76496.h" |
| 301 | 299 | #include "machine/mc8123.h" |
| 302 | 300 | #include "machine/segacrpt.h" |
| 303 | #include "sega | |
| 301 | #include "segamsys.h" | |
| 304 | 302 | |
| 303 | /**************************************************************************************** | |
| 304 | Memory Maps | |
| 305 | 305 | |
| 306 | //static UINT8* sms_rom; | |
| 307 | static UINT8* sms_mainram; | |
| 308 | //static UINT8* smsgg_backupram; | |
| 309 | static TIMER_CALLBACK( sms_scanline_timer_callback ); | |
| 310 | static struct sms_vdp *vdp2; | |
| 311 | static struct sms_vdp *vdp1; | |
| 306 | most of the memory map / IO maps are filled in at run time - this is due to the SMS | |
| 307 | code that this is based on being designed that way due to weird features of the MD. | |
| 312 | 308 | |
| 313 | ||
| 309 | ||
| 314 | 310 | |
| 315 | /* All Accesses to VRAM go through here for safety */ | |
| 316 | #define SMS_VDP_VRAM(address) chip->vram[(address)&0x3fff] | |
| 311 | static UINT8 f7_bank_value; | |
| 317 | 312 | |
| 318 | #ifdef UNUSED_FUNCTION | |
| 319 | static ADDRESS_MAP_START( sms_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 320 | // AM_RANGE(0x0000 , 0xbfff) AM_ROM | |
| 321 | // AM_RANGE(0xc000 , 0xdfff) AM_RAM AM_MIRROR(0x2000) | |
| 322 | ADDRESS_MAP_END | |
| 323 | #endif | |
| 324 | ||
| 325 | 313 | /* we have to fill in the ROM addresses for systeme due to the encrypted games */ |
| 326 | 314 | static ADDRESS_MAP_START( systeme_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 327 | 315 | AM_RANGE(0x0000, 0x7fff) AM_ROM /* Fixed ROM */ |
| 328 | 316 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) /* Banked ROM */ |
| 329 | ||
| 330 | // AM_RANGE(0x0000 , 0xbfff) AM_ROM | |
| 331 | // AM_RANGE(0xc000 , 0xdfff) AM_RAM AM_MIRROR(0x2000) | |
| 332 | 317 | ADDRESS_MAP_END |
| 333 | 318 | |
| 334 | static ADDRESS_MAP_START( sms_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 335 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 336 | ADDRESS_MAP_END | |
| 337 | 319 | |
| 338 | /* Precalculated tables for H/V counters. Note the position the counter 'jumps' is marked with with | |
| 339 | an empty comment */ | |
| 340 | static const UINT8 hc_256[] = | |
| 320 | static WRITE8_HANDLER( segasyse_videoram_w ) | |
| 341 | 321 | { |
| 342 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 343 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 344 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 345 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 346 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 347 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 348 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 349 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 350 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 351 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 352 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 353 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 354 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 355 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 356 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,/**/0x94, 0x95, 0x96, 0x97, 0x98, 0x99, | |
| 357 | 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, | |
| 358 | 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, | |
| 359 | 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, | |
| 360 | 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, | |
| 361 | 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 362 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 363 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 364 | }; | |
| 365 | ||
| 366 | ||
| 367 | static const UINT8 vc_ntsc_192[] = | |
| 368 | { | |
| 369 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 370 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 371 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 372 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 373 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 374 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 375 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 376 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 377 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 378 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 379 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 380 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 381 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 382 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,/**/0xd5, 0xd6, 0xd7, 0xd8, 0xd9, | |
| 383 | 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 384 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 385 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 386 | }; | |
| 387 | ||
| 388 | static const UINT8 vc_ntsc_224[] = | |
| 389 | { | |
| 390 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 391 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 392 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 393 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 394 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 395 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 396 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 397 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 398 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 399 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 400 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 401 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 402 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 403 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 404 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,/**/0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | |
| 405 | 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, | |
| 406 | 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 407 | }; | |
| 408 | ||
| 409 | static const UINT8 vc_ntsc_240[] = | |
| 410 | { | |
| 411 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 412 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 413 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 414 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 415 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 416 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 417 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 418 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 419 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 420 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 421 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 422 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 423 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 424 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 425 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 426 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 427 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 | |
| 428 | }; | |
| 429 | ||
| 430 | ||
| 431 | ||
| 432 | static const UINT8 vc_pal_192[] = | |
| 433 | { | |
| 434 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 435 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 436 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 437 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 438 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 439 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 440 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 441 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 442 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 443 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 444 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 445 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 446 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 447 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 448 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 449 | 0xf0, 0xf1, 0xf2,/**/0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, | |
| 450 | 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 451 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 452 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 453 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 454 | }; | |
| 455 | ||
| 456 | ||
| 457 | static const UINT8 vc_pal_224[] = | |
| 458 | { | |
| 459 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 460 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 461 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 462 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 463 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 464 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 465 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 466 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 467 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 468 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 469 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 470 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 471 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 472 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 473 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 474 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 475 | 0x00, 0x01, 0x02,/**/0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 476 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 477 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 478 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 479 | }; | |
| 480 | ||
| 481 | static const UINT8 vc_pal_240[] = | |
| 482 | { | |
| 483 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 484 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, | |
| 485 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, | |
| 486 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, | |
| 487 | 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
| 488 | 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | |
| 489 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
| 490 | 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, | |
| 491 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, | |
| 492 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, | |
| 493 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, | |
| 494 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, | |
| 495 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, | |
| 496 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, | |
| 497 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, | |
| 498 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 499 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,/**/0xd2, 0xd3, 0xd4, 0xd5, 0xd6, | |
| 500 | 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | |
| 501 | 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, | |
| 502 | 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, | |
| 503 | }; | |
| 504 | ||
| 505 | static const struct | |
| 506 | { | |
| 507 | UINT8 sms2_name[40]; | |
| 508 | int sms2_valid; | |
| 509 | int sms2_height; | |
| 510 | int sms2_tilemap_height; | |
| 511 | const UINT8* sms_vcounter_table; | |
| 512 | const UINT8* sms_hcounter_table; | |
| 513 | ||
| 514 | } sms_mode_table[] = | |
| 515 | { | |
| 516 | /* NTSC Modes */ | |
| 517 | { "Graphic 1 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 518 | { "Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 519 | { "Graphic 2 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 520 | { "Mode 1+2 (NTSC)" , 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 521 | { "Multicolor (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 522 | { "Mode 1+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 523 | { "Mode 2+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 524 | { "Mode 1+2+3 (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 525 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 526 | { "Invalid Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 527 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 528 | { "Mode 4 (224-line) (NTSC)", 1, 224, 256, vc_ntsc_224, hc_256 }, | |
| 529 | { "Mode 4 (NTSC)", 1, 192, 224, vc_ntsc_192, hc_256 }, | |
| 530 | { "Invalid Text (NTSC)", 0, 192, 224, vc_ntsc_192, hc_256 }, | |
| 531 | { "Mode 4 (240-line) (NTSC)", 1, 240, 256, vc_ntsc_240, hc_256 }, | |
| 532 | { "Mode 4 (NTSC)", 1, 192, 244, vc_ntsc_192, hc_256 }, | |
| 533 | ||
| 534 | /* Pal Modes (different Vcounter) */ | |
| 535 | { "Graphic 1 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 536 | { "Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 537 | { "Graphic 2 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 538 | { "Mode 1+2 (PAL)" , 0, 192, 224, vc_pal_192, hc_256 }, | |
| 539 | { "Multicolor (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 540 | { "Mode 1+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 541 | { "Mode 2+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 542 | { "Mode 1+2+3 (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 543 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 544 | { "Invalid Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 545 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 546 | { "Mode 4 (224-line) (PAL)", 1, 224, 256, vc_pal_224, hc_256 }, | |
| 547 | { "Mode 4 (PAL)", 1, 192, 224, vc_pal_192, hc_256 }, | |
| 548 | { "Invalid Text (PAL)", 0, 192, 224, vc_pal_192, hc_256 }, | |
| 549 | { "Mode 4 (240-line) (PAL)", 1, 240, 256, vc_pal_240, hc_256 }, | |
| 550 | { "Mode 4 (PAL)", 1, 192, 244, vc_pal_192, hc_256 } | |
| 551 | }; | |
| 552 | ||
| 553 | enum | |
| 554 | { | |
| 555 | SMS_VDP = 0, // SMS1 VDP | |
| 556 | SMS2_VDP = 1, // SMS2 VDP, or Game Gear VDP running in SMS2 Mode | |
| 557 | GG_VDP = 2, // Game Gear VDP running in Game Gear Mode | |
| 558 | GEN_VDP = 3 // Genesis VDP running in SMS2 Mode | |
| 559 | }; | |
| 560 | ||
| 561 | static int sms_vdp_null_irq_callback(running_machine *machine, int status) | |
| 562 | { | |
| 563 | return -1; | |
| 564 | } | |
| 565 | ||
| 566 | static int sms_vdp_cpu0_irq_callback(running_machine *machine, int status) | |
| 567 | { | |
| 568 | if (status == 1) | |
| 569 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); | |
| 570 | else | |
| 571 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); | |
| 572 | ||
| 573 | return 0; | |
| 574 | } | |
| 575 | ||
| 576 | static int sms_vdp_cpu1_irq_callback(running_machine *machine, int status) | |
| 577 | { | |
| 578 | if (status == 1) | |
| 579 | cputag_set_input_line(machine, "genesis_snd_z80", 0, HOLD_LINE); | |
| 580 | else | |
| 581 | cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE); | |
| 582 | ||
| 583 | return 0; | |
| 584 | } | |
| 585 | ||
| 586 | ||
| 587 | static int sms_vdp_cpu2_irq_callback(running_machine *machine, int status) | |
| 588 | { | |
| 589 | if (status == 1) | |
| 590 | cputag_set_input_line(machine, "mtbios", 0, HOLD_LINE); | |
| 591 | else | |
| 592 | cputag_set_input_line(machine, "mtbios", 0, CLEAR_LINE); | |
| 593 | ||
| 594 | return 0; | |
| 595 | } | |
| 596 | ||
| 597 | ||
| 598 | ||
| 599 | ||
| 600 | struct sms_vdp | |
| 601 | { | |
| 602 | UINT8 chip_id; | |
| 603 | ||
| 604 | UINT8 cmd_pend; | |
| 605 | UINT8 cmd_part1; | |
| 606 | UINT8 cmd_part2; | |
| 607 | UINT16 addr_reg; | |
| 608 | UINT8 cmd_reg; | |
| 609 | UINT8 regs[0x10]; | |
| 610 | UINT8 readbuf; | |
| 611 | UINT8* vram; | |
| 612 | UINT8* cram; | |
| 613 | UINT8 writemode; | |
| 614 | bitmap_t* r_bitmap; | |
| 615 | UINT8* tile_renderline; | |
| 616 | UINT8* sprite_renderline; | |
| 617 | ||
| 618 | UINT8 sprite_collision; | |
| 619 | UINT8 sprite_overflow; | |
| 620 | ||
| 621 | UINT8 yscroll; | |
| 622 | UINT8 hint_counter; | |
| 623 | ||
| 624 | UINT8 frame_irq_pending; | |
| 625 | UINT8 line_irq_pending; | |
| 626 | ||
| 627 | UINT8 vdp_type; | |
| 628 | ||
| 629 | UINT8 gg_cram_latch; // gamegear specific. | |
| 630 | ||
| 631 | /* below are MAME specific, to make things easier */ | |
| 632 | UINT8 screen_mode; | |
| 633 | UINT8 is_pal; | |
| 634 | int sms_scanline_counter; | |
| 635 | int sms_total_scanlines; | |
| 636 | int sms_framerate; | |
| 637 | emu_timer* sms_scanline_timer; | |
| 638 | UINT16* cram_mamecolours; // for use on RGB_DIRECT screen | |
| 639 | int (*set_irq)(running_machine *machine, int state); | |
| 640 | ||
| 641 | }; | |
| 642 | ||
| 643 | ||
| 644 | ||
| 645 | static void *start_vdp(running_machine *machine, int type) | |
| 646 | { | |
| 647 | struct sms_vdp *chip; | |
| 648 | ||
| 649 | chip = auto_alloc_clear(machine, struct sms_vdp); | |
| 650 | ||
| 651 | chip->vdp_type = type; | |
| 652 | ||
| 653 | chip->set_irq = sms_vdp_null_irq_callback; | |
| 654 | ||
| 655 | chip->cmd_pend = 0; | |
| 656 | chip->cmd_part1 = 0; | |
| 657 | chip->cmd_part2 = 0; | |
| 658 | chip->addr_reg = 0; | |
| 659 | chip->cmd_reg = 0; | |
| 660 | ||
| 661 | chip->regs[0x0] = 0x06; // mode 4 | |
| 662 | chip->regs[0x1] = 0x18; // mode 4 | |
| 663 | chip->regs[0x2] = 0; | |
| 664 | chip->regs[0x3] = 0; | |
| 665 | chip->regs[0x4] = 0; | |
| 666 | chip->regs[0x5] = 0; | |
| 667 | chip->regs[0x6] = 0; | |
| 668 | chip->regs[0x7] = 0; | |
| 669 | chip->regs[0x8] = 0; | |
| 670 | chip->regs[0x9] = 0; | |
| 671 | chip->regs[0xa] = 0; | |
| 672 | /* b-f don't matter */ | |
| 673 | chip->readbuf = 0; | |
| 674 | chip->vram = auto_alloc_array_clear(machine, UINT8, 0x4000); | |
| 675 | ||
| 676 | //printf("%d\n", (*chip->set_irq)(machine, 200)); | |
| 677 | ||
| 678 | if (chip->vdp_type==GG_VDP) | |
| 679 | { | |
| 680 | chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0040); | |
| 681 | chip->cram_mamecolours = auto_alloc_array_clear(machine, UINT16, 0x0080/2); | |
| 682 | chip->gg_cram_latch = 0; | |
| 683 | } | |
| 684 | else | |
| 685 | { | |
| 686 | chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0020); | |
| 687 | chip->cram_mamecolours = auto_alloc_array(machine, UINT16, 0x0040/2); | |
| 688 | } | |
| 689 | ||
| 690 | chip->tile_renderline = auto_alloc_array(machine, UINT8, 256+8); | |
| 691 | memset(chip->tile_renderline,0x00,256+8); | |
| 692 | ||
| 693 | chip->sprite_renderline = auto_alloc_array(machine, UINT8, 256+32); | |
| 694 | memset(chip->sprite_renderline,0x00,256+32); | |
| 695 | ||
| 696 | chip->writemode = 0; | |
| 697 | chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15); | |
| 698 | ||
| 699 | chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip); | |
| 700 | ||
| 701 | return chip; | |
| 702 | } | |
| 703 | ||
| 704 | /* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */ | |
| 705 | void segae_md_sms_stop_scanline_timer(void) | |
| 706 | { | |
| 707 | timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_never, 0); | |
| 708 | memset(md_sms_vdp->vram,0x00,0x4000); | |
| 709 | } | |
| 710 | ||
| 711 | ||
| 712 | #ifdef UNUSED_FUNCTION | |
| 713 | static READ8_HANDLER( z80_unmapped_r ) | |
| 714 | { | |
| 715 | printf("unmapped z80 read %04x\n",offset); | |
| 716 | return 0; | |
| 717 | } | |
| 718 | ||
| 719 | static WRITE8_HANDLER( z80_unmapped_w ) | |
| 720 | { | |
| 721 | printf("unmapped z80 write %04x\n",offset); | |
| 722 | } | |
| 723 | #endif | |
| 724 | ||
| 725 | static UINT8 vcounter_r(struct sms_vdp *chip) | |
| 726 | { | |
| 727 | // return vc_pal_224[sms_scanline_counter%(sizeof vc_pal_224)]; | |
| 728 | UINT8 retvalue; | |
| 729 | int scanline = chip->sms_scanline_counter%chip->sms_total_scanlines; | |
| 730 | ||
| 731 | retvalue = sms_mode_table[chip->screen_mode].sms_vcounter_table[scanline]; | |
| 732 | ||
| 733 | return retvalue; | |
| 734 | //printf("retvalue %d\n"; | |
| 735 | } | |
| 736 | ||
| 737 | ||
| 738 | static UINT8 vdp_data_r(struct sms_vdp *chip) | |
| 739 | { | |
| 740 | UINT8 retdata = chip->readbuf; | |
| 741 | chip->readbuf = SMS_VDP_VRAM(chip->addr_reg); | |
| 742 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 743 | return retdata; | |
| 744 | } | |
| 745 | ||
| 746 | static void vdp_data_w(const address_space *space, UINT8 data, struct sms_vdp* chip) | |
| 747 | { | |
| 748 | /* data writes clear the pending flag */ | |
| 749 | chip->cmd_pend = 0; | |
| 750 | ||
| 751 | if (chip->writemode==0) | |
| 752 | { /* Write to VRAM */ | |
| 753 | SMS_VDP_VRAM(chip->addr_reg)=data; | |
| 754 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 755 | chip->readbuf = data; // quirk of the VDP | |
| 756 | } | |
| 757 | else if (chip->writemode==1) | |
| 758 | { | |
| 759 | if (chip->vdp_type==GG_VDP) | |
| 322 | if (f7_bank_value & 0x20) | |
| 323 | { // to vdp1 vram | |
| 324 | if (f7_bank_value & 0x80) | |
| 760 | 325 | { |
| 761 | if (!(chip->addr_reg&1)) | |
| 762 | { /* Even address, value latched */ | |
| 763 | chip->gg_cram_latch = data; | |
| 764 | } | |
| 765 | else | |
| 766 | { | |
| 767 | chip->cram[(chip->addr_reg&0x3e)+1]=data; | |
| 768 | chip->cram[(chip->addr_reg&0x3e)+0]=chip->gg_cram_latch; | |
| 769 | ||
| 770 | /* Set Colour */ | |
| 771 | { | |
| 772 | UINT16 palword; | |
| 773 | UINT8 r,g,b; | |
| 774 | ||
| 775 | palword = ((chip->cram[(chip->addr_reg&0x3e)+1])<<8)|(chip->cram[(chip->addr_reg&0x3e)+0]); | |
| 776 | ||
| 777 | //printf("addr %04x palword %04x\n", chip->addr_reg&0x3f, palword); | |
| 778 | ||
| 779 | r = (palword & 0x000f)>>0; | |
| 780 | g = (palword & 0x00f0)>>4; | |
| 781 | b = (palword & 0x0f00)>>8; | |
| 782 | palette_set_color_rgb(space->machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b)); | |
| 783 | chip->cram_mamecolours[(chip->addr_reg&0x3e)/2]=(b<<1)|(g<<6)|(r<<11); | |
| 784 | } | |
| 785 | } | |
| 326 | vdp1_vram_bank0[offset] = data; | |
| 786 | 327 | } |
| 787 | 328 | else |
| 788 | 329 | { |
| 789 | chip->cram[chip->addr_reg&0x1f]=data; | |
| 790 | ||
| 791 | /* Set Colour */ | |
| 792 | { | |
| 793 | UINT8 r,g,b; | |
| 794 | r = (data & 0x03)>>0; | |
| 795 | g = (data & 0x0c)>>2; | |
| 796 | b = (data & 0x30)>>4; | |
| 797 | palette_set_color_rgb(space->machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b)); | |
| 798 | chip->cram_mamecolours[chip->addr_reg&0x1f]=(b<<3)|(g<<8)|(r<<13); | |
| 799 | } | |
| 800 | ||
| 330 | vdp1_vram_bank1[offset] = data; | |
| 801 | 331 | } |
| 802 | ||
| 803 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 804 | chip->readbuf = data; // quirk of the VDP | |
| 805 | ||
| 806 | 332 | } |
| 807 | ||
| 808 | } | |
| 809 | ||
| 810 | static UINT8 vdp_ctrl_r(const address_space *space, struct sms_vdp *chip) | |
| 811 | { | |
| 812 | UINT8 retvalue; | |
| 813 | ||
| 814 | retvalue = (chip->frame_irq_pending<<7) | | |
| 815 | (chip->sprite_overflow<<6) | | |
| 816 | (chip->sprite_collision<<5); | |
| 817 | ||
| 818 | chip->cmd_pend = 0; | |
| 819 | chip->frame_irq_pending = 0; | |
| 820 | chip->line_irq_pending = 0; | |
| 821 | chip->sprite_collision = 0; | |
| 822 | chip->sprite_overflow = 0; | |
| 823 | ||
| 824 | (chip->set_irq)(space->machine, 0); // clear IRQ; | |
| 825 | ||
| 826 | ||
| 827 | return retvalue; | |
| 828 | } | |
| 829 | ||
| 830 | /* check me */ | |
| 831 | static void vdp_update_code_addr_regs(struct sms_vdp *chip) | |
| 832 | { | |
| 833 | chip->addr_reg = ((chip->cmd_part2&0x3f)<<8) | chip->cmd_part1; | |
| 834 | chip->cmd_reg = (chip->cmd_part2&0xc0)>>6; | |
| 835 | } | |
| 836 | ||
| 837 | static void vdp_set_register(running_machine *machine, struct sms_vdp *chip) | |
| 838 | { | |
| 839 | UINT8 reg = chip->cmd_part2&0x0f; | |
| 840 | chip->regs[reg] = chip->cmd_part1; | |
| 841 | ||
| 842 | //if(reg==0) printf("setting reg 0 to %02x\n",chip->cmd_part1); | |
| 843 | ||
| 844 | //if (reg>0xa) printf("Invalid register write to register %01x\n",reg); | |
| 845 | ||
| 846 | if(reg==1) | |
| 847 | { | |
| 848 | if ((chip->regs[0x1]&0x20) && chip->frame_irq_pending) | |
| 849 | { | |
| 850 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 851 | } | |
| 852 | else | |
| 853 | { | |
| 854 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 855 | } | |
| 856 | } | |
| 857 | ||
| 858 | if(reg==0) | |
| 859 | { | |
| 860 | if ((chip->regs[0x0]&0x10) && chip->line_irq_pending) | |
| 861 | { | |
| 862 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 863 | } | |
| 864 | else | |
| 865 | { | |
| 866 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 867 | } | |
| 868 | } | |
| 869 | ||
| 870 | ||
| 871 | // printf("VDP: setting register %01x to %02x\n",reg, chip->cmd_part1); | |
| 872 | } | |
| 873 | ||
| 874 | static void vdp_ctrl_w(const address_space *space, UINT8 data, struct sms_vdp *chip) | |
| 875 | { | |
| 876 | if (chip->cmd_pend) | |
| 877 | { /* Part 2 of a command word write */ | |
| 878 | chip->cmd_pend = 0; | |
| 879 | chip->cmd_part2 = data; | |
| 880 | vdp_update_code_addr_regs(chip); | |
| 881 | ||
| 882 | switch (chip->cmd_reg) | |
| 883 | { | |
| 884 | case 0x0: /* VRAM read mode */ | |
| 885 | chip->readbuf = SMS_VDP_VRAM(chip->addr_reg); | |
| 886 | chip->addr_reg++; chip->addr_reg&=0x3fff; | |
| 887 | chip->writemode = 0; | |
| 888 | break; | |
| 889 | ||
| 890 | case 0x1: /* VRAM write mode */ | |
| 891 | chip->writemode = 0; | |
| 892 | break; | |
| 893 | ||
| 894 | case 0x2: /* REG setting */ | |
| 895 | vdp_set_register(space->machine, chip); | |
| 896 | chip->writemode = 0; | |
| 897 | break; | |
| 898 | ||
| 899 | case 0x3: /* CRAM write mode */ | |
| 900 | chip->writemode = 1; | |
| 901 | break; | |
| 902 | } | |
| 903 | } | |
| 904 | 333 | else |
| 905 | { /* Part 1 of a command word write */ | |
| 906 | chip->cmd_pend = 1; | |
| 907 | chip->cmd_part1 = data; | |
| 908 | vdp_update_code_addr_regs(chip); | |
| 909 | } | |
| 910 | } | |
| 911 | ||
| 912 | /* for the Genesis */ | |
| 913 | ||
| 914 | READ8_HANDLER( md_sms_vdp_vcounter_r ) | |
| 915 | { | |
| 916 | return vcounter_r(md_sms_vdp); | |
| 917 | } | |
| 918 | ||
| 919 | READ8_HANDLER( md_sms_vdp_data_r ) | |
| 920 | { | |
| 921 | return vdp_data_r(md_sms_vdp); | |
| 922 | } | |
| 923 | ||
| 924 | WRITE8_HANDLER( md_sms_vdp_data_w ) | |
| 925 | { | |
| 926 | vdp_data_w(space, data, md_sms_vdp); | |
| 927 | } | |
| 928 | ||
| 929 | READ8_HANDLER( md_sms_vdp_ctrl_r ) | |
| 930 | { | |
| 931 | return vdp_ctrl_r(space, md_sms_vdp); | |
| 932 | } | |
| 933 | ||
| 934 | WRITE8_HANDLER( md_sms_vdp_ctrl_w ) | |
| 935 | { | |
| 936 | vdp_ctrl_w(space, data, md_sms_vdp); | |
| 937 | } | |
| 938 | ||
| 939 | ||
| 940 | /* Read / Write Handlers - call other functions */ | |
| 941 | ||
| 942 | READ8_HANDLER( sms_vcounter_r ) | |
| 943 | { | |
| 944 | return vcounter_r(vdp1); | |
| 945 | } | |
| 946 | ||
| 947 | READ8_HANDLER( sms_vdp_data_r ) | |
| 948 | { | |
| 949 | return vdp_data_r(vdp1); | |
| 950 | } | |
| 951 | ||
| 952 | WRITE8_HANDLER( sms_vdp_data_w ) | |
| 953 | { | |
| 954 | vdp_data_w(space, data, vdp1); | |
| 955 | } | |
| 956 | ||
| 957 | READ8_HANDLER( sms_vdp_ctrl_r ) | |
| 958 | { | |
| 959 | return vdp_ctrl_r(space, vdp1); | |
| 960 | } | |
| 961 | ||
| 962 | WRITE8_HANDLER( sms_vdp_ctrl_w ) | |
| 963 | { | |
| 964 | vdp_ctrl_w(space, data, vdp1); | |
| 965 | } | |
| 966 | ||
| 967 | static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip) | |
| 968 | { | |
| 969 | int xx; | |
| 970 | UINT32 gfxdata; | |
| 971 | UINT16 gfx_base = (tiledata & 0x01ff)<<5; | |
| 972 | UINT8 flipx = (tiledata & 0x0200)>>9; | |
| 973 | UINT8 flipy = (tiledata & 0x0400)>>10; | |
| 974 | UINT8 pal = (tiledata & 0x0800)>>11; | |
| 975 | UINT8 pri = (tiledata & 0x1000)>>12; | |
| 976 | ||
| 977 | if (flipy) | |
| 978 | { | |
| 979 | gfx_base+=(7-tileline)*4; | |
| 980 | } | |
| 981 | else | |
| 982 | { | |
| 983 | gfx_base+=tileline*4; | |
| 984 | } | |
| 985 | ||
| 986 | gfxdata = (SMS_VDP_VRAM(gfx_base)<<24)|(SMS_VDP_VRAM(gfx_base+1)<<16)|(SMS_VDP_VRAM(gfx_base+2)<<8)|(SMS_VDP_VRAM(gfx_base+3)<<0); | |
| 987 | ||
| 988 | for (xx=0;xx<8;xx++) | |
| 989 | { | |
| 990 | UINT8 pixel; | |
| 991 | ||
| 992 | if (flipx) | |
| 334 | { // to vdp2 vram | |
| 335 | if (f7_bank_value & 0x40) | |
| 993 | 336 | { |
| 994 | pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 995 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 996 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 997 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 337 | vdp2_vram_bank0[offset] = data; | |
| 998 | 338 | } |
| 999 | 339 | else |
| 1000 | 340 | { |
| 1001 | pixel = (( (gfxdata>>(7-xx) ) &0x00000001)<<3)| | |
| 1002 | (( (gfxdata>>(15-xx) ) &0x00000001)<<2)| | |
| 1003 | (( (gfxdata>>(23-xx) ) &0x00000001)<<1)| | |
| 1004 | (( (gfxdata>>(31-xx) ) &0x00000001)<<0); | |
| 341 | vdp2_vram_bank1[offset] = data; | |
| 1005 | 342 | } |
| 1006 | ||
| 1007 | pixel += pal*0x10; | |
| 1008 | ||
| 1009 | if (!pri) linebuf[drawxpos+xx] = pixel; | |
| 1010 | else | |
| 1011 | { | |
| 1012 | if (pixel&0xf) | |
| 1013 | linebuf[drawxpos+xx] = pixel|0x80; | |
| 1014 | else | |
| 1015 | linebuf[drawxpos+xx] = pixel; | |
| 1016 | ||
| 1017 | } | |
| 1018 | 343 | } |
| 1019 | } | |
| 1020 | 344 | |
| 1021 | static void sms_render_spriteline(int scanline, struct sms_vdp* chip) | |
| 1022 | { | |
| 1023 | int spritenum; | |
| 1024 | int height = 8; | |
| 1025 | int width = 8; | |
| 1026 | int max_sprites = 8; | |
| 1027 | int visible_line = 0; | |
| 1028 | ||
| 1029 | UINT16 table_base = (chip->regs[0x5]&0x7e) << 7; | |
| 1030 | UINT8 pattern_bit = (chip->regs[0x6]&0x04) >> 2; // high bit of the tile # (because spriteram can only contain an 8-bit tile #) | |
| 1031 | ||
| 1032 | ||
| 1033 | memset(chip->sprite_renderline, 0, 256+32); | |
| 1034 | ||
| 1035 | for (spritenum = 0;spritenum<64;spritenum++) | |
| 1036 | { | |
| 1037 | int xpos,ypos,num; | |
| 1038 | /* | |
| 1039 | 00: yyyyyyyyyyyyyyyy | |
| 1040 | 10: yyyyyyyyyyyyyyyy | |
| 1041 | 20: yyyyyyyyyyyyyyyy | |
| 1042 | 30: yyyyyyyyyyyyyyyy | |
| 1043 | 40: ???????????????? | |
| 1044 | 50: ???????????????? | |
| 1045 | 60: ???????????????? | |
| 1046 | 70: ???????????????? | |
| 1047 | 80: xnxnxnxnxnxnxnxn | |
| 1048 | 90: xnxnxnxnxnxnxnxn | |
| 1049 | A0: xnxnxnxnxnxnxnxn | |
| 1050 | B0: xnxnxnxnxnxnxnxn | |
| 1051 | C0: xnxnxnxnxnxnxnxn | |
| 1052 | D0: xnxnxnxnxnxnxnxn | |
| 1053 | E0: xnxnxnxnxnxnxnxn | |
| 1054 | F0: xnxnxnxnxnxnxnxn | |
| 1055 | */ | |
| 1056 | ||
| 1057 | ypos = SMS_VDP_VRAM(table_base+spritenum); | |
| 1058 | xpos = SMS_VDP_VRAM(table_base+0x80+spritenum*2+0); | |
| 1059 | num = SMS_VDP_VRAM(table_base+0x80+spritenum*2+1)|(pattern_bit<<8); | |
| 1060 | ||
| 1061 | if (chip->regs[0x1]&0x2) | |
| 1062 | { | |
| 1063 | num &=0x1fe; | |
| 1064 | height=16; | |
| 1065 | } | |
| 1066 | else height = 8; | |
| 1067 | ||
| 1068 | ||
| 1069 | xpos+=16; // allow room either side for clipping (avoids xdrawpos of -8 if bit below is set) | |
| 1070 | ||
| 1071 | if (chip->regs[0x0]&0x08) xpos-=8; | |
| 1072 | ||
| 1073 | if ((sms_mode_table[chip->screen_mode].sms2_height)==192) | |
| 1074 | { | |
| 1075 | if (ypos == 0xd0) | |
| 1076 | return; | |
| 1077 | } | |
| 1078 | ||
| 1079 | ypos++; | |
| 1080 | ||
| 1081 | num <<= 5; | |
| 1082 | //num+=((scanline-ypos)&0x7)*4; | |
| 1083 | ||
| 1084 | visible_line = 0; | |
| 1085 | ||
| 1086 | if (ypos<=scanline && ypos+height>scanline) | |
| 1087 | { | |
| 1088 | visible_line = 1; | |
| 1089 | num+=((scanline-ypos)&(height-1))*4; | |
| 1090 | ||
| 1091 | } | |
| 1092 | else if (ypos+height>0x100) | |
| 1093 | { | |
| 1094 | if (scanline< ypos+height-0x100) | |
| 1095 | { | |
| 1096 | visible_line = 1; | |
| 1097 | num+=((scanline-ypos)&(height-1))*4; | |
| 1098 | ||
| 1099 | } | |
| 1100 | } | |
| 1101 | ||
| 1102 | if (visible_line) | |
| 1103 | { | |
| 1104 | int xx; | |
| 1105 | UINT32 gfxdata; | |
| 1106 | ||
| 1107 | gfxdata = (SMS_VDP_VRAM(num&0x3fff)<<24)|(SMS_VDP_VRAM((num+1)&0x3fff)<<16)|(SMS_VDP_VRAM((num+2)&0x3fff)<<8)|(SMS_VDP_VRAM((num+3)&0x3fff)<<0); | |
| 1108 | ||
| 1109 | ||
| 1110 | for (xx=0;xx<8;xx++) | |
| 1111 | { | |
| 1112 | UINT8 pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 1113 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 1114 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 1115 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 1116 | ||
| 1117 | if (pixel) | |
| 1118 | { | |
| 1119 | if (!chip->sprite_renderline[xpos+((width-1)-xx)]) | |
| 1120 | { | |
| 1121 | chip->sprite_renderline[xpos+((width-1)-xx)] = pixel; | |
| 1122 | } | |
| 1123 | else | |
| 1124 | { | |
| 1125 | chip->sprite_collision = 1; | |
| 1126 | } | |
| 1127 | } | |
| 1128 | } | |
| 1129 | ||
| 1130 | max_sprites--; | |
| 1131 | ||
| 1132 | if (max_sprites==0) | |
| 1133 | { | |
| 1134 | chip->sprite_overflow = 1; | |
| 1135 | return; | |
| 1136 | } | |
| 1137 | ||
| 1138 | } | |
| 1139 | } | |
| 1140 | 345 | } |
| 1141 | 346 | |
| 1142 | static | |
| 347 | static WRITE8_HANDLER( sys | |
| 1143 | 348 | { |
| 1144 | int column = 0; | |
| 1145 | int count = 32; | |
| 1146 | int drawxpos; | |
| 349 | int rombank; | |
| 350 | f7_bank_value = data; | |
| 1147 | 351 | |
| 1148 | UINT8 xscroll = chip->regs[0x8]; | |
| 1149 | UINT8 yscroll = chip->yscroll; | |
| 1150 | UINT16 table_base = (chip->regs[0x2]&0x0e)<<10; | |
| 1151 | UINT16 our_base; | |
| 1152 | UINT8 our_line = (scanline+yscroll) & 0x7; | |
| 352 | rombank = data & 0x0f; | |
| 1153 | 353 | |
| 1154 | /* In 224 and 240 line modes the table base is different */ | |
| 1155 | if ((sms_mode_table[chip->screen_mode].sms2_height)!=192) | |
| 1156 | { | |
| 1157 | table_base &=0x3700; table_base|=0x700; | |
| 1158 | } | |
| 354 | segae_set_vram_banks(data); | |
| 1159 | 355 | |
| 1160 | if ((chip->regs[0x0]&0x40) && scanline < 16) | |
| 1161 | { | |
| 1162 | xscroll = 0; | |
| 1163 | } | |
| 356 | //memcpy(sms_rom+0x8000, memory_region(space->machine, "user1")+0x10000+rombank*0x4000, 0x4000); | |
| 357 | memory_set_bank(space->machine, 1, rombank); | |
| 1164 | 358 | |
| 1165 | // xscroll = 0; | |
| 1166 | ||
| 1167 | // table_base -= 0x0100; | |
| 1168 | ||
| 1169 | our_base = table_base+(((scanline+yscroll)%sms_mode_table[chip->screen_mode].sms2_tilemap_height)>>3)*64;// + (yscroll>>3)*32; | |
| 1170 | ||
| 1171 | our_base &=0x3fff; | |
| 1172 | ||
| 1173 | memset(chip->tile_renderline, (chip->regs[0x7]&0x0f)+0x10, 256+8); | |
| 1174 | ||
| 1175 | drawxpos = xscroll&0x7; | |
| 1176 | column = 32-(xscroll>>3); | |
| 1177 | ||
| 1178 | do | |
| 1179 | { | |
| 1180 | UINT16 tiledata = (SMS_VDP_VRAM((our_base+(column&0x1f)*2+1)&0x3fff) << 8) | | |
| 1181 | (SMS_VDP_VRAM((our_base+(column&0x1f)*2+0)&0x3fff) << 0); | |
| 1182 | ||
| 1183 | // UINT16 pattern = ((column+((scanline>>3)*32)) & 0x01ff)<<5; | |
| 1184 | ||
| 1185 | draw_tile_line(drawxpos, our_line, tiledata, chip->tile_renderline, chip); | |
| 1186 | ||
| 1187 | drawxpos+=8; | |
| 1188 | column++; | |
| 1189 | column&=0x1f; | |
| 1190 | count--; | |
| 1191 | } while (count); | |
| 1192 | ||
| 1193 | 359 | } |
| 1194 | 360 | |
| 1195 | static void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip) | |
| 1196 | { | |
| 1197 | int x; | |
| 1198 | UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, scanline, 0); | |
| 1199 | 361 | |
| 1200 | for (x=0;x<256;x++) | |
| 1201 | { | |
| 1202 | UINT8 dat = chip->tile_renderline[x]; | |
| 1203 | UINT8 col; | |
| 1204 | ||
| 1205 | ||
| 1206 | col = (chip->regs[0x7]&0x0f)+0x10; | |
| 1207 | lineptr[x] = chip->cram_mamecolours[col]; | |
| 1208 | ||
| 1209 | ||
| 1210 | if ((x<8 && (chip->regs[0x0]&0x20)) || !(chip->regs[0x1]&0x40)) | |
| 1211 | continue; | |
| 1212 | ||
| 1213 | ||
| 1214 | if (!(dat & 0x80)) | |
| 1215 | { | |
| 1216 | lineptr[x] = chip->cram_mamecolours[dat&0x1f]; | |
| 1217 | if ((dat&0xf)==0x0) lineptr[x]|=0x8000; | |
| 1218 | ||
| 1219 | } | |
| 1220 | ||
| 1221 | if (chip->sprite_renderline[x+16]) | |
| 1222 | { | |
| 1223 | lineptr[x] = chip->cram_mamecolours[chip->sprite_renderline[x+16]+0x10]; | |
| 1224 | } | |
| 1225 | ||
| 1226 | if (dat & 0x80) | |
| 1227 | { | |
| 1228 | lineptr[x] = chip->cram_mamecolours[dat&0x1f]; | |
| 1229 | if ((dat&0xf)==0x0) lineptr[x]|=0x8000; | |
| 1230 | } | |
| 1231 | ||
| 1232 | } | |
| 1233 | ||
| 1234 | } | |
| 1235 | ||
| 1236 | static void sms_draw_scanline(int scanline, struct sms_vdp* chip) | |
| 362 | static void init_ports_systeme(running_machine *machine) | |
| 1237 | 363 | { |
| 364 | /* INIT THE PORTS *********************************************************************************************/ | |
| 1238 | 365 | |
| 1239 | if (scanline>=0 && scanline<sms_mode_table[chip->screen_mode].sms2_height) | |
| 1240 | { | |
| 1241 | sms_render_spriteline(scanline, chip); | |
| 1242 | sms_render_tileline(scanline, chip); | |
| 1243 | sms_copy_to_renderbuffer(scanline, chip); | |
| 366 | const address_space *io = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO); | |
| 367 | const device_config *sn1 = devtag_get_device(machine, "sn1"); | |
| 368 | const device_config *sn2 = devtag_get_device(machine, "sn2"); | |
| 1244 | 369 | |
| 1245 | } | |
| 1246 | } | |
| 370 | memory_install_write8_device_handler(io, sn2, 0x7b, 0x7b, 0, 0, sn76496_w); | |
| 371 | memory_install_write8_device_handler(io, sn1, 0x7e, 0x7f, 0, 0, sn76496_w); | |
| 372 | memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, sms_vcounter_r); | |
| 1247 | 373 | |
| 374 | memory_install_readwrite8_handler(io, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w); | |
| 375 | memory_install_readwrite8_handler(io, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w); | |
| 1248 | 376 | |
| 1249 | static TIMER_CALLBACK( sms_scanline_timer_callback ) | |
| 1250 | { | |
| 1251 | /* This function is called at the very start of every scanline starting at the very | |
| 1252 | top-left of the screen. The first scanline is scanline 0 (we set scanline to -1 in | |
| 1253 | VIDEO_EOF) */ | |
| 377 | memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w); | |
| 378 | memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w); | |
| 1254 | 379 | |
| 1255 | /* Compensate for some rounding errors | |
| 380 | memory_install_read_port_handler (io, 0xe0, 0xe0, 0, 0, "e0"); | |
| 381 | memory_install_read_port_handler (io, 0xe1, 0xe1, 0, 0, "e1"); | |
| 382 | memory_install_read_port_handler (io, 0xe2, 0xe2, 0, 0, "e2"); | |
| 383 | memory_install_read_port_handler (io, 0xf2, 0xf2, 0, 0, "f2"); | |
| 384 | memory_install_read_port_handler (io, 0xf3, 0xf3, 0, 0, "f3"); | |
| 1256 | 385 | |
| 1257 | When the counter reaches 314 (or whatever the max lines is) we should have reached the | |
| 1258 | end of the frame, however due to rounding errors in the timer calculation we're not quite | |
| 1259 | there. Let's assume we are still in the previous scanline for now. | |
| 1260 | ||
| 1261 | The position to get the H position also has to compensate for a few errors | |
| 1262 | */ | |
| 1263 | // printf("num %d\n",num ); | |
| 1264 | struct sms_vdp *chip = (struct sms_vdp *)ptr; | |
| 1265 | ||
| 1266 | if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1)) | |
| 1267 | { | |
| 1268 | chip->sms_scanline_counter++; | |
| 1269 | timer_adjust_oneshot(chip->sms_scanline_timer, ATTOTIME_IN_HZ(chip->sms_framerate * chip->sms_total_scanlines), 0); | |
| 1270 | ||
| 1271 | if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height) | |
| 1272 | { | |
| 1273 | chip->hint_counter=chip->regs[0xa]; | |
| 1274 | } | |
| 1275 | ||
| 1276 | if (chip->sms_scanline_counter==0) | |
| 1277 | { | |
| 1278 | chip->hint_counter=chip->regs[0xa]; | |
| 1279 | } | |
| 1280 | ||
| 1281 | if (chip->sms_scanline_counter<=192) | |
| 1282 | { | |
| 1283 | chip->hint_counter--; | |
| 1284 | ||
| 1285 | if (chip->hint_counter==0xff) | |
| 1286 | { | |
| 1287 | //if (chip->chip_id==2) printf("irq triggerd on scanline %d %d\n", vdp1->sms_scanline_counter, vdp2->sms_scanline_counter); | |
| 1288 | ||
| 1289 | chip->line_irq_pending = 1; | |
| 1290 | chip->hint_counter=chip->regs[0xa]; | |
| 1291 | if (chip->regs[0x0]&0x10) | |
| 1292 | { | |
| 1293 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 1294 | } | |
| 1295 | else | |
| 1296 | { | |
| 1297 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 1298 | } | |
| 1299 | } | |
| 1300 | ||
| 1301 | } | |
| 1302 | ||
| 1303 | ||
| 1304 | sms_draw_scanline(chip->sms_scanline_counter, chip); | |
| 1305 | ||
| 1306 | //if(sms_scanline_counter==0) chip->sprite_collision = 0; | |
| 1307 | ||
| 1308 | if (chip->sms_scanline_counter==sms_mode_table[chip->screen_mode].sms2_height+1 ) | |
| 1309 | { | |
| 1310 | chip->frame_irq_pending = 1; | |
| 1311 | if (chip->regs[0x1]&0x20) | |
| 1312 | { | |
| 1313 | (chip->set_irq)(machine, 1); // set IRQ; | |
| 1314 | } | |
| 1315 | else | |
| 1316 | { | |
| 1317 | (chip->set_irq)(machine, 0); // clear IRQ; | |
| 1318 | } | |
| 1319 | } | |
| 1320 | } | |
| 1321 | else | |
| 1322 | { /* if we're called passed the total number of scanlines then assume we're still on the last one. | |
| 1323 | this can happen due to rounding errors */ | |
| 1324 | chip->sms_scanline_counter = chip->sms_total_scanlines-1; | |
| 1325 | } | |
| 386 | memory_install_write8_handler (io, 0xf7, 0xf7, 0, 0, systeme_bank_w ); | |
| 1326 | 387 | } |
| 1327 | 388 | |
| 1328 | #ifdef UNUSED_FUNCTION | |
| 1329 | static void show_tiles(struct sms_vdp* chip) | |
| 1330 | { | |
| 1331 | int x,y,xx,yy; | |
| 1332 | UINT16 count = 0; | |
| 1333 | 389 | |
| 1334 | for (y=0;y<16;y++) | |
| 1335 | { | |
| 1336 | for (x=0;x<32;x++) | |
| 1337 | { | |
| 1338 | for (yy=0;yy<8;yy++) | |
| 1339 | { | |
| 1340 | int drawypos = y*8+yy; | |
| 1341 | UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, drawypos, 0); | |
| 1342 | 390 | |
| 1343 | UINT32 gfxdata = (SMS_VDP_VRAM(count)<<24)|(SMS_VDP_VRAM(count+1)<<16)|(SMS_VDP_VRAM(count+2)<<8)|(SMS_VDP_VRAM(count+3)<<0); | |
| 1344 | ||
| 1345 | for (xx=0;xx<8;xx++) | |
| 1346 | { | |
| 1347 | int drawxpos = x*8+xx; | |
| 1348 | ||
| 1349 | UINT8 pixel = (( (gfxdata>>(0+xx) ) &0x00000001)<<3)| | |
| 1350 | (( (gfxdata>>(8+xx) ) &0x00000001)<<2)| | |
| 1351 | (( (gfxdata>>(16+xx) ) &0x00000001)<<1)| | |
| 1352 | (( (gfxdata>>(24+xx) ) &0x00000001)<<0); | |
| 1353 | ||
| 1354 | lineptr[drawxpos] = chip->cram_mamecolours[pixel+16]; | |
| 1355 | ||
| 1356 | } | |
| 1357 | ||
| 1358 | ||
| 1359 | count+=4;count&=0x3fff; | |
| 1360 | } | |
| 1361 | } | |
| 1362 | } | |
| 1363 | } | |
| 1364 | #endif | |
| 1365 | ||
| 1366 | /* | |
| 1367 | Register $00 - Mode Control No. 1 | |
| 1368 | ||
| 1369 | D7 - 1= Disable vertical scrolling for columns 24-31 | |
| 1370 | D6 - 1= Disable horizontal scrolling for rows 0-1 | |
| 1371 | D5 - 1= Mask column 0 with overscan color from register #7 | |
| 1372 | D4 - (IE1) 1= Line interrupt enable | |
| 1373 | D3 - (EC) 1= Shift sprites left by 8 pixels | |
| 1374 | D2 - (M4) 1= Use Mode 4, 0= Use TMS9918 modes (selected with M1, M2, M3) | |
| 1375 | D1 - (M2) Must be 1 for M1/M3 to change screen height in Mode 4. | |
| 1376 | Otherwise has no effect. | |
| 1377 | D0 - 1= No sync, display is monochrome, 0= Normal display | |
| 1378 | ||
| 1379 | Bits 0 and 5 have no effect on the GameGear in either mode, while bit 6 | |
| 1380 | has no effect in GG mode but works normally in SMS mode. | |
| 1381 | */ | |
| 1382 | ||
| 1383 | /* | |
| 1384 | Register $01 - Mode Control No. 2 | |
| 1385 | ||
| 1386 | D7 - No effect | |
| 1387 | D6 - (BLK) 1= Display visible, 0= display blanked. | |
| 1388 | D5 - (IE0) 1= Frame interrupt enable. | |
| 1389 | D4 - (M1) Selects 224-line screen for Mode 4 if M2=1, else has no effect. | |
| 1390 | D3 - (M3) Selects 240-line screen for Mode 4 if M2=1, else has no effect. | |
| 1391 | D2 - No effect | |
| 1392 | D1 - Sprites are 1=16x16,0=8x8 (TMS9918), Sprites are 1=8x16,0=8x8 (Mode 4) | |
| 1393 | D0 - Sprite pixels are doubled in size. | |
| 1394 | ||
| 1395 | Even though some games set bit 7, it does nothing. | |
| 1396 | */ | |
| 1397 | ||
| 1398 | static void end_of_frame(running_machine *machine, struct sms_vdp *chip) | |
| 391 | static void init_systeme_map(running_machine *machine) | |
| 1399 | 392 | { |
| 1400 | UINT8 m1 = (chip->regs[0x1]&0x10)>>4; | |
| 1401 | UINT8 m2 = (chip->regs[0x0]&0x02)>>1; | |
| 1402 | UINT8 m3 = (chip->regs[0x1]&0x08)>>3; | |
| 1403 | UINT8 m4 = (chip->regs[0x0]&0x04)>>2; | |
| 1404 | UINT8 m5 = chip->is_pal; | |
| 1405 | chip->screen_mode = m1|(m2<<1)|(m3<<2)|(m4<<3)|(m5<<4); | |
| 393 | memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000); | |
| 1406 | 394 | |
| 1407 | if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */ | |
| 1408 | { | |
| 1409 | rectangle visarea; | |
| 395 | /* alternate way of accessing video ram */ | |
| 396 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, segasyse_videoram_w); | |
| 1410 | 397 | |
| 1411 | visarea.min_x = 0; | |
| 1412 | visarea.max_x = 256-1; | |
| 1413 | visarea.min_y = 0; | |
| 1414 | visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1; | |
| 398 | /* main ram area */ | |
| 399 | sms_mainram = auto_alloc_array(machine, UINT8, 0x4000); | |
| 400 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); | |
| 401 | memory_set_bankptr(machine, 2, sms_mainram ); | |
| 402 | memset(sms_mainram,0x00,0x4000); | |
| 1415 | 403 | |
| 1416 | if (chip->chip_id==3) video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); | |
| 1417 | ||
| 1418 | } | |
| 1419 | else /* 160x144 */ | |
| 1420 | { | |
| 1421 | rectangle visarea; | |
| 1422 | visarea.min_x = (256-160)/2; | |
| 1423 | visarea.max_x = (256-160)/2+160-1; | |
| 1424 | visarea.min_y = (192-144)/2; | |
| 1425 | visarea.max_y = (192-144)/2+144-1; | |
| 1426 | } | |
| 1427 | ||
| 1428 | ||
| 1429 | ||
| 1430 | // printf("Mode: %s is ok\n", sms_mode_table[chip->screen_mode].sms2_name); | |
| 1431 | ||
| 1432 | chip->sms_scanline_counter = -1; | |
| 1433 | chip->yscroll = chip->regs[0x9]; // this can't change mid-frame | |
| 1434 | timer_adjust_oneshot(chip->sms_scanline_timer, attotime_zero, 0); | |
| 404 | init_ports_systeme(machine); | |
| 1435 | 405 | } |
| 1436 | 406 | |
| 1437 | #ifdef UNUSED_FUNCTION | |
| 1438 | VIDEO_EOF(sms) | |
| 407 | DRIVER_INIT( segasyse ) | |
| 1439 | 408 | { |
| 1440 | end_of_frame(machine, vdp1); | |
| 1441 | //if (SMS_PAUSE_BUTTON) cputag_set_input_line(machine, , "maincpu", INPUT_LINE_NMI, PULSE_LINE); // not on systeme!!! | |
| 409 | init_systeme_map(machine); | |
| 410 | DRIVER_INIT_CALL(hazemd_segasyse); | |
| 1442 | 411 | } |
| 1443 | #endif | |
| 1444 | 412 | |
| 1445 | static VIDEO_START(sms) | |
| 1446 | { | |
| 1447 | 413 | |
| 1448 | // vdp->is_pal = 1; | |
| 1449 | // vdp->sms_total_scanlines = 313; | |
| 1450 | // vdp->sms_framerate = 50; | |
| 1451 | } | |
| 1452 | ||
| 1453 | #ifdef UNUSED_FUNCTION | |
| 1454 | MACHINE_RESET(sms) | |
| 1455 | { | |
| 1456 | timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0); | |
| 1457 | } | |
| 1458 | #endif | |
| 1459 | ||
| 1460 | /* Sega System E */ | |
| 1461 | ||
| 1462 | 414 | /******************************************************************************* |
| 1463 | 415 | Input Ports |
| 1464 | 416 | ******************************************************************************** |
| r5955 | r5956 | |
| 1911 | 863 | ROM_LOAD( "317-0042.key", 0x0000, 0x2000, CRC(d6312538) SHA1(494ac7f080775c21dc7d369e6ea78f3299e6975a) ) |
| 1912 | 864 | ROM_END |
| 1913 | 865 | |
| 866 | ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 ) | |
| 867 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 868 | ADDRESS_MAP_END | |
| 1914 | 869 | |
| 1915 | static UINT8* vdp2_vram_bank0; | |
| 1916 | static UINT8* vdp2_vram_bank1; | |
| 1917 | ||
| 1918 | static UINT8* vdp1_vram_bank0; | |
| 1919 | static UINT8* vdp1_vram_bank1; | |
| 1920 | static UINT8 f7_bank_value; | |
| 1921 | ||
| 1922 | static MACHINE_RESET(systeme) | |
| 1923 | { | |
| 1924 | timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0); | |
| 1925 | timer_adjust_oneshot(vdp2->sms_scanline_timer, attotime_zero, 0); | |
| 1926 | } | |
| 1927 | ||
| 1928 | MACHINE_RESET(megatech_md_sms) | |
| 1929 | { | |
| 1930 | timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_zero, 0); | |
| 1931 | } | |
| 1932 | ||
| 1933 | MACHINE_RESET(megatech_bios) | |
| 1934 | { | |
| 1935 | timer_adjust_oneshot(vdp1->sms_scanline_timer, attotime_zero, 0); | |
| 1936 | } | |
| 1937 | ||
| 1938 | static VIDEO_EOF(systeme) | |
| 1939 | { | |
| 1940 | end_of_frame(machine, vdp1); | |
| 1941 | end_of_frame(machine, vdp2); | |
| 1942 | } | |
| 1943 | ||
| 1944 | ||
| 1945 | VIDEO_EOF(megatech_md_sms) | |
| 1946 | { | |
| 1947 | end_of_frame(machine, md_sms_vdp); | |
| 1948 | } | |
| 1949 | ||
| 1950 | VIDEO_EOF(megatech_bios) | |
| 1951 | { | |
| 1952 | end_of_frame(machine, vdp1); | |
| 1953 | } | |
| 1954 | ||
| 1955 | VIDEO_UPDATE(megatech_md_sms) | |
| 1956 | { | |
| 1957 | int x,y; | |
| 1958 | ||
| 1959 | for (y=0;y<224;y++) | |
| 1960 | { | |
| 1961 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1962 | UINT16* srcptr = BITMAP_ADDR16(md_sms_vdp->r_bitmap, y, 0); | |
| 1963 | ||
| 1964 | for (x=0;x<256;x++) | |
| 1965 | { | |
| 1966 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1967 | } | |
| 1968 | } | |
| 1969 | ||
| 1970 | return 0; | |
| 1971 | } | |
| 1972 | ||
| 1973 | ||
| 1974 | VIDEO_UPDATE(megatech_bios) | |
| 1975 | { | |
| 1976 | int x,y; | |
| 1977 | ||
| 1978 | for (y=0;y<224;y++) | |
| 1979 | { | |
| 1980 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1981 | UINT16* srcptr = BITMAP_ADDR16(vdp1->r_bitmap, y, 0); | |
| 1982 | ||
| 1983 | for (x=0;x<256;x++) | |
| 1984 | { | |
| 1985 | lineptr[x]=srcptr[x]&0x7fff; | |
| 1986 | } | |
| 1987 | } | |
| 1988 | ||
| 1989 | return 0; | |
| 1990 | } | |
| 1991 | ||
| 1992 | static VIDEO_UPDATE(systeme) | |
| 1993 | { | |
| 1994 | // show_tiles(); | |
| 1995 | int x,y; | |
| 1996 | ||
| 1997 | for (y=0;y<192;y++) | |
| 1998 | { | |
| 1999 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 2000 | UINT16* srcptr = BITMAP_ADDR16(vdp1->r_bitmap, y, 0); | |
| 2001 | ||
| 2002 | for (x=0;x<256;x++) | |
| 2003 | { | |
| 2004 | lineptr[x]=srcptr[x]&0x7fff; | |
| 2005 | } | |
| 2006 | ||
| 2007 | } | |
| 2008 | ||
| 2009 | for (y=0;y<192;y++) | |
| 2010 | { | |
| 2011 | UINT16* lineptr = BITMAP_ADDR16(bitmap, y, 0); | |
| 2012 | UINT16* srcptr = BITMAP_ADDR16(vdp2->r_bitmap, y, 0); | |
| 2013 | ||
| 2014 | for (x=0;x<256;x++) | |
| 2015 | { | |
| 2016 | if(!(srcptr[x]&0x8000)) lineptr[x]=srcptr[x]&0x7fff; | |
| 2017 | } | |
| 2018 | } | |
| 2019 | ||
| 2020 | ||
| 2021 | return 0; | |
| 2022 | } | |
| 2023 | ||
| 2024 | ||
| 2025 | 870 | static MACHINE_DRIVER_START( systeme ) |
| 2026 | MDRV_CPU_ADD("maincpu", Z80, 10738600/2) /* correct | |
| 871 | MDRV_CPU_ADD("maincpu", Z80, 10738600/2) /* correct? | |
| 2027 | 872 | MDRV_CPU_PROGRAM_MAP(systeme_map) |
| 2028 | MDRV_CPU_IO_MAP( | |
| 873 | MDRV_CPU_IO_MAP( | |
| 2029 | 874 | |
| 2030 | 875 | /* IRQ handled via the timers */ |
| 2031 | 876 | MDRV_MACHINE_RESET(systeme) |
| r5955 | r5956 | |
| 2057 | 902 | MACHINE_DRIVER_END |
| 2058 | 903 | |
| 2059 | 904 | |
| 2060 | static READ8_HANDLER( sms_vdp_2_data_r ) | |
| 2061 | { | |
| 2062 | return vdp_data_r(vdp2); | |
| 2063 | } | |
| 2064 | ||
| 2065 | static WRITE8_HANDLER( sms_vdp_2_data_w ) | |
| 2066 | { | |
| 2067 | vdp_data_w(space, data, vdp2); | |
| 2068 | } | |
| 2069 | ||
| 2070 | static READ8_HANDLER( sms_vdp_2_ctrl_r ) | |
| 2071 | { | |
| 2072 | return vdp_ctrl_r(space, vdp2); | |
| 2073 | } | |
| 2074 | ||
| 2075 | static WRITE8_HANDLER( sms_vdp_2_ctrl_w ) | |
| 2076 | { | |
| 2077 | vdp_ctrl_w(space, data, vdp2); | |
| 2078 | } | |
| 2079 | ||
| 2080 | static WRITE8_HANDLER( segasyse_videoram_w ) | |
| 2081 | { | |
| 2082 | if (f7_bank_value & 0x20) | |
| 2083 | { // to vdp1 vram | |
| 2084 | if (f7_bank_value & 0x80) | |
| 2085 | { | |
| 2086 | vdp1_vram_bank0[offset] = data; | |
| 2087 | } | |
| 2088 | else | |
| 2089 | { | |
| 2090 | vdp1_vram_bank1[offset] = data; | |
| 2091 | } | |
| 2092 | } | |
| 2093 | else | |
| 2094 | { // to vdp2 vram | |
| 2095 | if (f7_bank_value & 0x40) | |
| 2096 | { | |
| 2097 | vdp2_vram_bank0[offset] = data; | |
| 2098 | } | |
| 2099 | else | |
| 2100 | { | |
| 2101 | vdp2_vram_bank1[offset] = data; | |
| 2102 | } | |
| 2103 | } | |
| 2104 | ||
| 2105 | } | |
| 2106 | ||
| 2107 | static WRITE8_HANDLER( systeme_bank_w ) | |
| 2108 | { | |
| 2109 | int rombank; | |
| 2110 | f7_bank_value = data; | |
| 2111 | ||
| 2112 | rombank = data & 0x0f; | |
| 2113 | ||
| 2114 | if (f7_bank_value&0x80) | |
| 2115 | { | |
| 2116 | vdp1->vram = vdp1_vram_bank1; | |
| 2117 | } | |
| 2118 | else | |
| 2119 | { | |
| 2120 | vdp1->vram = vdp1_vram_bank0; | |
| 2121 | } | |
| 2122 | ||
| 2123 | if (f7_bank_value&0x40) | |
| 2124 | { | |
| 2125 | vdp2->vram = vdp2_vram_bank1; | |
| 2126 | } | |
| 2127 | else | |
| 2128 | { | |
| 2129 | vdp2->vram = vdp2_vram_bank0; | |
| 2130 | } | |
| 2131 | ||
| 2132 | //memcpy(sms_rom+0x8000, memory_region(space->machine, "user1")+0x10000+rombank*0x4000, 0x4000); | |
| 2133 | memory_set_bank(space->machine, 1, rombank); | |
| 2134 | ||
| 2135 | } | |
| 2136 | ||
| 2137 | static void init_ports_systeme(running_machine *machine) | |
| 2138 | { | |
| 2139 | /* INIT THE PORTS *********************************************************************************************/ | |
| 2140 | ||
| 2141 | const address_space *io = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO); | |
| 2142 | const device_config *sn1 = devtag_get_device(machine, "sn1"); | |
| 2143 | const device_config *sn2 = devtag_get_device(machine, "sn2"); | |
| 2144 | ||
| 2145 | memory_install_write8_device_handler(io, sn2, 0x7b, 0x7b, 0, 0, sn76496_w); | |
| 2146 | memory_install_write8_device_handler(io, sn1, 0x7e, 0x7f, 0, 0, sn76496_w); | |
| 2147 | memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, sms_vcounter_r); | |
| 2148 | ||
| 2149 | memory_install_readwrite8_handler(io, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w); | |
| 2150 | memory_install_readwrite8_handler(io, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w); | |
| 2151 | ||
| 2152 | memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w); | |
| 2153 | memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w); | |
| 2154 | ||
| 2155 | memory_install_read_port_handler (io, 0xe0, 0xe0, 0, 0, "e0"); | |
| 2156 | memory_install_read_port_handler (io, 0xe1, 0xe1, 0, 0, "e1"); | |
| 2157 | memory_install_read_port_handler (io, 0xe2, 0xe2, 0, 0, "e2"); | |
| 2158 | memory_install_read_port_handler (io, 0xf2, 0xf2, 0, 0, "f2"); | |
| 2159 | memory_install_read_port_handler (io, 0xf3, 0xf3, 0, 0, "f3"); | |
| 2160 | ||
| 2161 | memory_install_write8_handler (io, 0xf7, 0xf7, 0, 0, systeme_bank_w ); | |
| 2162 | } | |
| 2163 | ||
| 2164 | ||
| 2165 | ||
| 2166 | static void init_systeme_map(running_machine *machine) | |
| 2167 | { | |
| 2168 | /* INIT THE MEMMAP / BANKING *********************************************************************************/ | |
| 2169 | ||
| 2170 | /* catch any addresses that don't get mapped */ | |
| 2171 | // memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); | |
| 2172 | ||
| 2173 | /* fixed rom bank area */ | |
| 2174 | // sms_rom = auto_alloc_array(machine, UINT8, 0xc000); | |
| 2175 | // memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP); | |
| 2176 | // memory_set_bankptr(machine, 1, sms_rom ); | |
| 2177 | ||
| 2178 | memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000); | |
| 2179 | ||
| 2180 | /* alternate way of accessing video ram */ | |
| 2181 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, segasyse_videoram_w); | |
| 2182 | ||
| 2183 | ||
| 2184 | // memcpy(sms_rom, memory_region(machine, "user1"), 0x8000); | |
| 2185 | ||
| 2186 | /* main ram area */ | |
| 2187 | sms_mainram = auto_alloc_array(machine, UINT8, 0x4000); | |
| 2188 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); | |
| 2189 | memory_set_bankptr(machine, 2, sms_mainram ); | |
| 2190 | memset(sms_mainram,0x00,0x4000); | |
| 2191 | ||
| 2192 | init_ports_systeme(machine); | |
| 2193 | } | |
| 2194 | ||
| 2195 | void init_for_megadrive(running_machine *machine) | |
| 2196 | { | |
| 2197 | md_sms_vdp = (struct sms_vdp *)start_vdp(machine, GEN_VDP); | |
| 2198 | md_sms_vdp->set_irq = sms_vdp_cpu1_irq_callback; | |
| 2199 | md_sms_vdp->is_pal = 0; | |
| 2200 | md_sms_vdp->sms_total_scanlines = 262; | |
| 2201 | md_sms_vdp->sms_framerate = 60; | |
| 2202 | md_sms_vdp->chip_id = 3; | |
| 2203 | } | |
| 2204 | ||
| 2205 | ||
| 2206 | ||
| 2207 | DRIVER_INIT( megatech_bios ) | |
| 2208 | { | |
| 2209 | // init_systeme_map(machine); | |
| 2210 | ||
| 2211 | vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 2212 | vdp1->set_irq = sms_vdp_cpu2_irq_callback; | |
| 2213 | vdp1->is_pal = 0; | |
| 2214 | vdp1->sms_total_scanlines = 262; | |
| 2215 | vdp1->sms_framerate = 60; | |
| 2216 | vdp1->chip_id = 1; | |
| 2217 | ||
| 2218 | vdp1_vram_bank0 = vdp1->vram; | |
| 2219 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 2220 | } | |
| 2221 | ||
| 2222 | static DRIVER_INIT( segasyse ) | |
| 2223 | { | |
| 2224 | init_systeme_map(machine); | |
| 2225 | ||
| 2226 | vdp1 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 2227 | // vdp1->set_irq = sms_vdp_cpu0_irq_callback; | |
| 2228 | vdp1->is_pal = 0; | |
| 2229 | vdp1->sms_total_scanlines = 262; | |
| 2230 | vdp1->sms_framerate = 60; | |
| 2231 | vdp1->chip_id = 1; | |
| 2232 | ||
| 2233 | vdp1_vram_bank0 = vdp1->vram; | |
| 2234 | vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 2235 | ||
| 2236 | ||
| 2237 | vdp2 = (struct sms_vdp *)start_vdp(machine, SMS2_VDP); | |
| 2238 | vdp2->set_irq = sms_vdp_cpu0_irq_callback; | |
| 2239 | vdp2->is_pal = 0; | |
| 2240 | vdp2->sms_total_scanlines = 262; | |
| 2241 | vdp2->sms_framerate = 60; | |
| 2242 | vdp2->chip_id = 2; | |
| 2243 | ||
| 2244 | vdp2_vram_bank0 = vdp2->vram; | |
| 2245 | vdp2_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); | |
| 2246 | } | |
| 2247 | ||
| 2248 | 905 | /*- Hang On Jr. Specific -*/ |
| 2249 | 906 | static UINT8 port_fa_last; /* Last thing written to port 0xfa (control related) */ |
| 2250 | 907 |
| r5955 | r5956 | |
|---|---|---|
| 1343 | 1343 | COMBINE_DATA( &rozcontrol16[offset] ); |
| 1344 | 1344 | } /* namco_rozcontrol16_w */ |
| 1345 | 1345 | |
| 1346 | #ifdef UNUSED_FUNCTION | |
| 1346 | 1347 | READ16_HANDLER( namco_rozbank16_r ) |
| 1347 | 1348 | { |
| 1348 | 1349 | return rozbank16[offset]; |
| r5955 | r5956 | |
| 1361 | 1362 | } |
| 1362 | 1363 | } |
| 1363 | 1364 | } /* namco_rozbank16_w */ |
| 1365 | #endif | |
| 1364 | 1366 | |
| 1365 | 1367 | static void |
| 1366 | 1368 | writerozvideo( int offset, UINT16 data ) |
| r5955 | r5956 | |
|---|---|---|
| 1987 | 1987 | MDRV_CPU_MODIFY("maincpu") |
| 1988 | 1988 | MDRV_CPU_PROGRAM_MAP(reactor_map) |
| 1989 | 1989 | |
| 1990 | MDRV_NVRAM_HANDLER( | |
| 1990 | MDRV_NVRAM_HANDLER(0 | |
| 1991 | 1991 | |
| 1992 | 1992 | /* sound hardware */ |
| 1993 | 1993 | MDRV_SOUND_ADD("samples", SAMPLES, 0) |
| r5955 | r5956 | |
|---|---|---|
| 1468 | 1468 | for (i = 0; i < 0x80000; i += 2) |
| 1469 | 1469 | { |
| 1470 | 1470 | ROM[i] = BITSWAP8(ROM[i],7,2,5,6,0,3,1,4) ^ BITSWAP8((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90; |
| 1471 | ||
| 1472 | // 60-in-1 decrypt | |
| 1473 | // if ((i%2)==0) | |
| 1474 | // { | |
| 1475 | // ROM[i] = BITSWAP8(ROM[i],5,1,4,2,0,7,6,3)^BITSWAP8(i, 6,0,4,13,0,5,3,11); | |
| 1476 | // } | |
| 1471 | 1477 | } |
| 1472 | 1478 | |
| 1473 | 1479 | pxa255_start(machine); |
| r5955 | r5956 | |
| 1539 | 1545 | ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, CRC(a423a969) SHA1(4c68654c81e70367209b9f6c712564aae89a3122) ) |
| 1540 | 1546 | ROM_END |
| 1541 | 1547 | |
| 1542 | /*ROM_START( arm4in1 ) | |
| 1543 | // main program, encrypted | |
| 1544 | ROM_REGION( 0x80000, "maincpu", 0 ) | |
| 1545 | ROM_LOAD( "27c4096_plz-v001_ver.300.bin", 0x000000, 0x080000, CRC(9149dbc4) SHA1(40efe1f654f11474f75ae7fee1613f435dbede38) ) | |
| 1548 | ROM_START( 48in1 ) | |
| 1549 | // main program, encrypted | |
| 1550 | ROM_REGION( 0x80000, "maincpu", 0 ) | |
| 1551 | ROM_LOAD( "hph_ver309", 0x000000, 0x080000, CRC(27023186) SHA1(a2b3770c4b03d6026c6a0ff2e62ab17c3b359b12) ) | |
| 1546 | 1552 | |
| 1547 | // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format | |
| 1548 | ROM_REGION32_LE( 0x200000, "data", 0 ) | |
| 1553 | // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format | |
| 1554 | ROM_REGION32_LE( 0x200000, "data", 0 ) | |
| 1549 | 1555 | ROM_LOAD( "16mflash.bin", 0x000000, 0x200000, CRC(a089f0f8) SHA1(e975eadd9176a8b9e416229589dfe3158cba22cb) ) |
| 1550 | ROM_END*/ | |
| 1551 | 1556 | |
| 1552 | GAME(2004, 39in1, 0, 39in1, 39in1, 39in1, ROT270, "<unknown>", "39 in 1 MAME bootleg", GAME_IMPERFECT_SOUND) | |
| 1553 | //GAME(2004, arm4in1, 0, 39in1, 39in1, 0, ROT0, "<unknown>", "4 in 1 MAME bootleg", GAME_NOT_WORKING|GAME_NO_SOUND) | |
| 1557 | // EEPROM - contains security data | |
| 1558 | ROM_REGION( 0x200, "eeprom", 0 ) | |
| 1559 | ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, NO_DUMP ) | |
| 1560 | ROM_END | |
| 1561 | ||
| 1562 | ROM_START( 48in1a ) | |
| 1563 | // main program, encrypted | |
| 1564 | ROM_REGION( 0x80000, "maincpu", 0 ) | |
| 1565 | ROM_LOAD( "ver302.u2", 0x000000, 0x080000, CRC(5ea25870) SHA1(66edc59a3d355bc3462e98d2062ada721c371af6) ) | |
| 1566 | ||
| 1567 | // data ROM - contains a filesystem with ROMs, fonts, graphics, etc. in an unknown compressed format | |
| 1568 | ROM_REGION32_LE( 0x200000, "data", 0 ) | |
| 1569 | ROM_LOAD( "16mflash.bin", 0x000000, 0x200000, CRC(a089f0f8) SHA1(e975eadd9176a8b9e416229589dfe3158cba22cb) ) | |
| 1570 | ||
| 1571 | // EEPROM - contains security data | |
| 1572 | ROM_REGION( 0x200, "eeprom", 0 ) | |
| 1573 | ROM_LOAD16_WORD_SWAP( "93c66_eeprom.bin", 0x000, 0x200, NO_DUMP ) | |
| 1574 | ROM_END | |
| 1575 | ||
| 1576 | GAME(2004, 39in1, 0, 39in1, 39in1, 39in1, ROT270, "<unknown>", "39 in 1 MAME bootleg", GAME_IMPERFECT_SOUND) | |
| 1577 | GAME(2004, 48in1, 39in1, 39in1, 39in1, 39in1, ROT270, "<unknown>", "48 in 1 MAME bootleg (ver 3.09)", GAME_NOT_WORKING|GAME_IMPERFECT_SOUND) | |
| 1578 | GAME(2004, 48in1a, 39in1, 39in1, 39in1, 39in1, ROT270, "<unknown>", "48 in 1 MAME bootleg (ver 3.02)", GAME_NOT_WORKING|GAME_IMPERFECT_SOUND) |
| r5955 | r5956 | |
|---|---|---|
| 115 | 115 | static UINT8 irq_state; |
| 116 | 116 | static emu_timer *irq_timer; |
| 117 | 117 | |
| 118 | int cloud9_vblank_start; | |
| 119 | int cloud9_vblank_end; | |
| 118 | static int cloud9_vblank_start; | |
| 119 | static int cloud9_vblank_end; | |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 |
| r5955 | r5956 | |
|---|---|---|
| 207 | 207 | |
| 208 | 208 | ROM_START( targeth ) |
| 209 | 209 | ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ |
| 210 | ROM_LOAD16_BYTE( "targeth.c23", 0x000000, 0x040000, CRC(840887d6) SHA1(9a36b346608d531a62a2e0704ea44f12e07f9d91) ) | |
| 211 | ROM_LOAD16_BYTE( "targeth.c22", 0x000001, 0x040000, CRC(d2435eb8) SHA1(ce75a115dad8019c8e66a1c3b3e15f54781f65ae) ) | |
| 210 | ROM_LOAD16_BYTE( "targeth.c23", 0x000000, 0x040000, CRC(840887d6) SHA1(9a36b346608d531a62a2e0704ea44f12e07f9d91) ) | |
| 211 | ROM_LOAD16_BYTE( "targeth.c22", 0x000001, 0x040000, CRC(d2435eb8) SHA1(ce75a115dad8019c8e66a1c3b3e15f54781f65ae) ) | |
| 212 | 212 | |
| 213 | 213 | ROM_REGION( 0x200000, "gfx1", 0 ) /* Graphics */ |
| 214 | 214 | ROM_LOAD( "targeth.i13", 0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) ) |
| r5955 | r5956 | |
| 223 | 223 | ROM_LOAD( "targeth.c3", 0x0c0000, 0x080000, CRC(d4c771df) SHA1(7cc0a86ef6aa3d26ab8f19d198f62112bf012870) ) |
| 224 | 224 | ROM_END |
| 225 | 225 | |
| 226 | GAME( 1994, targeth, 0, targeth,targeth, 0, ROT0, "Gaelco", "Target Hits", GAME_UNEMULATED_PROTECTION ) | |
| 226 | ROM_START( targetha ) | |
| 227 | ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ | |
| 228 | ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x040000, CRC(e38a54e2) SHA1(239bfa6f1c0fc8aa0ad7de9be237bef55b384007) ) | |
| 229 | ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x040000, CRC(24fe3efb) SHA1(8f48f08a6db28966c9263be119883c9179e349ed) ) | |
| 230 | ||
| 231 | ROM_REGION( 0x200000, "gfx1", 0 ) /* Graphics */ | |
| 232 | ROM_LOAD( "targeth.i13", 0x000000, 0x080000, CRC(b892be24) SHA1(9cccaaacf20e77c7358f0ceac60b8a1012f1216c) ) | |
| 233 | ROM_LOAD( "targeth.i11", 0x080000, 0x080000, CRC(6797faf9) SHA1(112cffe72f91cb46c262e19a47b0cab3237dd60f) ) | |
| 234 | ROM_LOAD( "targeth.i9", 0x100000, 0x080000, CRC(0e922c1c) SHA1(6920e345c82e76f7e0af6101f39eb65ac1f112b9) ) | |
| 235 | ROM_LOAD( "targeth.i7", 0x180000, 0x080000, CRC(d8b41000) SHA1(cbe91eb91bdc7a60b2333c6bea37d08a57902669) ) | |
| 236 | ||
| 237 | ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ | |
| 238 | ROM_LOAD( "targeth.c1", 0x000000, 0x080000, CRC(d6c9dfbc) SHA1(3ec70dea94fc89df933074012a52de6034571e87) ) | |
| 239 | /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ | |
| 240 | ROM_RELOAD( 0x040000, 0x080000 ) | |
| 241 | ROM_LOAD( "targeth.c3", 0x0c0000, 0x080000, CRC(d4c771df) SHA1(7cc0a86ef6aa3d26ab8f19d198f62112bf012870) ) | |
| 242 | ROM_END | |
| 243 | ||
| 244 | GAME( 1994, targeth, 0, targeth, targeth, 0, ROT0, "Gaelco", "Target Hits (ver 1.1)", GAME_UNEMULATED_PROTECTION ) | |
| 245 | GAME( 1994, targetha, targeth, targeth, targeth, 0, ROT0, "Gaelco", "Target Hits (ver 1.0)", GAME_UNEMULATED_PROTECTION ) |
| r5955 | r5956 | |
|---|---|---|
| 691 | 691 | int globalyscroll = (sfbonus_vregs[2] | sfbonus_vregs[3]<<8); |
| 692 | 692 | int globalxscroll = (sfbonus_vregs[0] | sfbonus_vregs[1]<<8); |
| 693 | 693 | UINT8* front_rowscroll = &sfbonus_videoram[0x200]; |
| 694 | const input_port_token *ipt; | |
| 694 | 695 | int i; |
| 695 | 696 | |
| 696 | 697 | // align to 0 |
| r5955 | r5956 | |
| 744 | 745 | } |
| 745 | 746 | } |
| 746 | 747 | } |
| 747 | ||
| 748 | #if 0 | |
| 748 | 749 | 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", |
| 749 | 750 | sfbonus_3800_regs[0], |
| 750 | 751 | sfbonus_3800_regs[1], |
| r5955 | r5956 | |
| 782 | 783 | sfbonus_vregs[30], |
| 783 | 784 | sfbonus_vregs[31] |
| 784 | 785 | ); |
| 785 | */ | |
| 786 | 786 | |
| 787 | /* | |
| 788 | 787 | popmessage("-- %02x %02x %02x %02x %02x %02x %02x %02x", |
| 789 | 788 | sfbonus_1800_regs[0], |
| 790 | 789 | sfbonus_1800_regs[1], |
| r5955 | r5956 | |
| 794 | 793 | sfbonus_1800_regs[5], |
| 795 | 794 | sfbonus_1800_regs[6], |
| 796 | 795 | sfbonus_1800_regs[7]); |
| 797 | ||
| 796 | #endif | |
| 798 | 797 | |
| 799 | if ((screen->machine->gamedrv->ipt == ipt_amcoe2_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe2_reels4) | |
| 800 | || (screen->machine->gamedrv->ipt == ipt_amcoe2_poker)) | |
| 798 | ipt = screen->machine->gamedrv->ipt; | |
| 799 | if ((ipt == INPUT_PORTS_NAME(amcoe2_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe2_reels4)) | |
| 800 | || (ipt == INPUT_PORTS_NAME(amcoe2_poker))) | |
| 801 | 801 | { |
| 802 | 802 | // based on pirpok2 |
| 803 | 803 | output_set_lamp_value(0, (sfbonus_1800_regs[6] & 0x1) >> 0); |
| r5955 | r5956 | |
| 807 | 807 | output_set_lamp_value(4, (sfbonus_1800_regs[4] & 0x4) >> 2); |
| 808 | 808 | output_set_lamp_value(5, (sfbonus_1800_regs[4] & 0x1) >> 0); |
| 809 | 809 | } |
| 810 | else if ((screen->machine->gamedrv->ipt == ipt_amcoe1_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe1_reels4) | |
| 811 | || (screen->machine->gamedrv->ipt == ipt_amcoe1_poker)) | |
| 810 | else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4)) | |
| 811 | || (ipt == INPUT_PORTS_NAME(amcoe1_poker))) | |
| 812 | 812 | { |
| 813 | 813 | output_set_lamp_value(0, (sfbonus_1800_regs[0] & 0x2) >> 1); |
| 814 | 814 | output_set_lamp_value(1, (sfbonus_1800_regs[4] & 0x2) >> 1); |
| r5955 | r5956 | |
|---|---|---|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | | |
| 260 | NVRAM_HANDLER_CALL(i2cmem_0 | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | static UINT32 twinkle_unknown; |
| r5955 | r5956 | |
|---|---|---|
| 18 | 18 | Turn Service Mode OFF (press 'F2') |
| 19 | 19 | Reset the game (press 'F3') |
| 20 | 20 | |
| 21 | To Init Roll Fruit | |
| 21 | 22 | |
| 23 | Turn Service Mode ON (press 'F2') | |
| 24 | Press and hold Service 1 ('9') | |
| 25 | Reset the game (press 'F3') | |
| 26 | Use Service 2 ('0') to move pointer to INIT | |
| 27 | Hold Service 1 ('9') for 5 seconds | |
| 28 | Turn Service Mode OFF (press 'F2') | |
| 29 | ||
| 22 | 30 | Todo: |
| 23 | 31 | ------------------------------------------------------------------------- |
| 24 | Payout doesn't currently work and causes 'Call Attendant' to be displayed | |
| 25 | 32 | Hook up Lamps |
| 26 | 33 | Emulate the RTC (real time clock) |
| 27 | 34 | |
| r5955 | r5956 | |
| 210 | 217 | return video_screen_get_vpos(space->machine->primary_screen); |
| 211 | 218 | } |
| 212 | 219 | |
| 220 | static UINT8 multfish_hopper_motor = 0; | |
| 221 | static UINT8 multfish_hopper = 0; | |
| 213 | 222 | |
| 223 | static CUSTOM_INPUT( multfish_hopper_r ) | |
| 224 | { | |
| 225 | if ( multfish_hopper_motor != 0 ) | |
| 226 | { | |
| 227 | multfish_hopper++; | |
| 228 | return multfish_hopper>>4; | |
| 229 | } | |
| 230 | else | |
| 231 | { | |
| 232 | return 0; | |
| 233 | } | |
| 234 | } | |
| 214 | 235 | |
| 236 | static WRITE8_HANDLER( multfish_port33_w ) | |
| 237 | { | |
| 238 | multfish_hopper_motor = data & 0x10; //0x10 Hopper Motor (33B) | |
| 239 | } | |
| 240 | ||
| 241 | ||
| 215 | 242 | static ADDRESS_MAP_START( multfish_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 216 | 243 | AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_ROM, multfish_vid_w) |
| 217 | 244 | AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM ) |
| r5955 | r5956 | |
| 239 | 266 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused? |
| 240 | 267 | |
| 241 | 268 | PORT_START("IN1") |
| 242 | PORT_DIPNAME( 0x01, 0x01, "Hopper SW (22 B)" ) | |
| 243 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 244 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 269 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B) | |
| 245 | 270 | PORT_DIPNAME( 0x02, 0x02, "BK Door (17 A)" ) |
| 246 | 271 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 247 | 272 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r5955 | r5956 | |
| 335 | 360 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused? |
| 336 | 361 | INPUT_PORTS_END |
| 337 | 362 | |
| 363 | static INPUT_PORTS_START( rollfr ) | |
| 364 | PORT_START("IN0") | |
| 365 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 366 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // COIN B (18 B) | |
| 367 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 338 | 368 | |
| 369 | PORT_START("IN1") | |
| 370 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B) | |
| 371 | PORT_DIPNAME( 0x02, 0x02, "BK Door (17 A)" ) | |
| 372 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 373 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 374 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 375 | ||
| 376 | PORT_START("IN2") | |
| 377 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 378 | ||
| 379 | PORT_START("IN3") | |
| 380 | PORT_DIPNAME( 0x08, 0x08, "Hopper Inhibit (08 B)" ) | |
| 381 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 382 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 383 | PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 384 | ||
| 385 | PORT_START("IN4") | |
| 386 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 387 | ||
| 388 | PORT_START("IN5") | |
| 389 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) //Service SW (20 B) | |
| 390 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 391 | ||
| 392 | PORT_START("IN6") | |
| 393 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) //Statistic SW (20 A) | |
| 394 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 395 | ||
| 396 | PORT_START("IN7") | |
| 397 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 398 | PORT_SERVICE( 0x02, IP_ACTIVE_LOW ) // Fr Door (16 A) | |
| 399 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 400 | INPUT_PORTS_END | |
| 401 | ||
| 402 | ||
| 339 | 403 | static WRITE8_HANDLER( multfish_f3_w ) |
| 340 | 404 | { |
| 341 | 405 | //popmessage("multfish_f3_w %02x",data); |
| r5955 | r5956 | |
| 363 | 427 | // AM_RANGE(0x30, 0x30) AM_WRITE(multfish_port30_w) |
| 364 | 428 | // AM_RANGE(0x31, 0x31) AM_WRITE(multfish_port31_w) |
| 365 | 429 | // AM_RANGE(0x32, 0x32) AM_WRITE(multfish_port32_w) |
| 366 | ||
| 430 | | |
| 367 | 431 | // AM_RANGE(0x34, 0x34) AM_WRITE(multfish_port34_w) |
| 368 | 432 | // AM_RANGE(0x35, 0x35) AM_WRITE(multfish_port35_w) |
| 369 | 433 | // AM_RANGE(0x36, 0x36) AM_WRITE(multfish_port36_w) |
| r5955 | r5956 | |
| 639 | 703 | ROM_LOAD( "mf031124.rom", 0x00000, 0x40000, MD5(9cd800719c6e4a2267e3c140467238d3) SHA1(c0d1b541c4b076bbc810ad637acb4a2663a919ba) ) |
| 640 | 704 | |
| 641 | 705 | ROM_REGION( 0x400000, "gfx", 0 ) |
| 706 | ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) ) | |
| 642 | 707 | ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) ) |
| 643 | 708 | ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) ) |
| 644 | 709 | ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) ) |
| r5955 | r5956 | |
| 654 | 719 | ROM_LOAD( "mf040308.rom", 0x00000, 0x40000, CRC(adb9c1d9) SHA1(88c69f48766dc7c98a6f03c1a0a4aa63b76560b6) ) |
| 655 | 720 | |
| 656 | 721 | ROM_REGION( 0x400000, "gfx", 0 ) |
| 722 | ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) ) | |
| 657 | 723 | ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) ) |
| 658 | 724 | ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) ) |
| 659 | 725 | ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) ) |
| r5955 | r5956 | |
| 668 | 734 | ROM_LOAD( "mf040308a.rom", 0x00000, 0x40000, CRC(44537648) SHA1(7bce6085778ff0b21c052ae91703de3b78b8eed0) ) /* Not officially listed on Igrosoft's web site hash page */ |
| 669 | 735 | |
| 670 | 736 | ROM_REGION( 0x400000, "gfx", 0 ) |
| 737 | ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) ) | |
| 671 | 738 | ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) ) |
| 672 | 739 | ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) ) |
| 673 | 740 | ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) ) |
| r5955 | r5956 | |
| 683 | 750 | ROM_LOAD( "mf040316.rom", 0x00000, 0x40000, MD5(66019927201954518261652147b05e43) SHA1(c1f4d1c51632a45b533d19c8b6f63d337d84d9cd) ) |
| 684 | 751 | |
| 685 | 752 | ROM_REGION( 0x400000, "gfx", 0 ) |
| 753 | ROM_LOAD( "1", 0x000000, 0x80000, CRC(2f2a7367) SHA1(ce7ee9ca4f374ec61edc3b89d4752f0edb64a910) ) | |
| 686 | 754 | ROM_LOAD( "2", 0x100000, 0x80000, CRC(606acd73) SHA1(ce5f7b1366dbb16d57fe4b7f395f08725e3cf756) ) |
| 687 | 755 | ROM_LOAD( "3", 0x200000, 0x80000, CRC(33759c2a) SHA1(6afcee2e00a27542fc9751702abcc84cd7d3a2a8) ) |
| 688 | 756 | ROM_LOAD( "4", 0x300000, 0x80000, CRC(d0053546) SHA1(01c69be0c594947d57648f491904a3b6938a5570) ) |
| r5955 | r5956 | |
| 1782 | 1850 | #endif |
| 1783 | 1851 | |
| 1784 | 1852 | #if ALL_REVISIONS |
| 1785 | GAME( 2003, rollfr, 0, multfish, | |
| 1853 | GAME( 2003, rollfr, 0, multfish, rollfr | |
| 1786 | 1854 | #endif |
| 1787 | GAME( 2003, rollfr_2, 0, multfish, | |
| 1855 | GAME( 2003, rollfr_2, 0, multfish, rollfr | |
| 1788 | 1856 | |
| 1789 | 1857 | GAME( 2004, garage_4, 0, multfish, multfish, 0, ROT0, "Igrosoft", "Garage (040219, set 1)", 0 ) |
| 1790 | 1858 | GAME( 2004, garage_4a, garage_4, multfish, multfish, 0, ROT0, "Igrosoft", "Garage (040219, set 2)", 0 ) |
| r5955 | r5956 | |
|---|---|---|
| 784 | 784 | ROM_END |
| 785 | 785 | |
| 786 | 786 | |
| 787 | ROM_START( mk2r31e ) | |
| 788 | ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF ) /* sound data */ | |
| 789 | ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) ) | |
| 790 | ROM_RELOAD( 0x100000, 0x80000 ) | |
| 791 | ROM_LOAD16_BYTE( "su3.l1", 0x200000, 0x80000, CRC(d6d92bf9) SHA1(397351c6b707f2595e36360471015f9fa494e894) ) | |
| 792 | ROM_RELOAD( 0x300000, 0x80000 ) | |
| 793 | ROM_LOAD16_BYTE( "su4.l1", 0x400000, 0x80000, CRC(eebc8e0f) SHA1(705ab63ff7672a4857d546afda6dca4973cce1ad) ) | |
| 794 | ROM_RELOAD( 0x500000, 0x80000 ) | |
| 795 | ROM_LOAD16_BYTE( "su5.l1", 0x600000, 0x80000, CRC(2b0b7961) SHA1(1cdc64aab74d14afbd8c3531e3d0bd49271a281f) ) | |
| 796 | ROM_RELOAD( 0x700000, 0x80000 ) | |
| 797 | ROM_LOAD16_BYTE( "su6.l1", 0x800000, 0x80000, CRC(f694b27f) SHA1(d43e38a124665f49ebb4ffc5a55e8f19a1a64686) ) | |
| 798 | ROM_RELOAD( 0x900000, 0x80000 ) | |
| 799 | ROM_LOAD16_BYTE( "su7.l1", 0xa00000, 0x80000, CRC(20387e0a) SHA1(505d05173b2a1f1ee3ebc2898ccd3a95c98dd04a) ) | |
| 800 | ROM_RELOAD( 0xb00000, 0x80000 ) | |
| 801 | /* su8 and su9 are unpopulated */ | |
| 802 | ||
| 803 | ROM_REGION16_LE( 0x100000, "user1", 0 ) /* 34010 code */ | |
| 804 | ROM_LOAD16_BYTE( "uj12.e31", 0x00000, 0x80000, CRC(f64306d1) SHA1(b1fb8d59400a411498a56a740a7b35e4687ecebd) ) | |
| 805 | ROM_LOAD16_BYTE( "ug12.e31", 0x00001, 0x80000, CRC(4adeae7e) SHA1(4c9e5c7df3f86cc5c97c7fb70d4acca71d65cab5) ) | |
| 806 | ||
| 807 | ROM_REGION( 0xc00000, "gfx1", 0 ) | |
| 808 | ROM_LOAD( "ug14-vid", 0x000000, 0x100000, CRC(01e73af6) SHA1(6598cfd704cc92a7f358a0e1f1c973ab79dcc493) ) | |
| 809 | ROM_LOAD( "ug16-vid", 0x100000, 0x100000, CRC(8ba6ae18) SHA1(465fe907de4a1e502180c4e41642998dd3abc8e6) ) | |
| 810 | ROM_LOAD( "ug17-vid", 0x200000, 0x100000, CRC(937d8620) SHA1(8b9f80a460b124a747a6d1495b53f01f580e28f1) ) | |
| 811 | ||
| 812 | ROM_LOAD( "uj14-vid", 0x300000, 0x100000, CRC(d4985cbb) SHA1(367865da7efae38d83de3c0868d02a705177ae63) ) | |
| 813 | ROM_LOAD( "uj16-vid", 0x400000, 0x100000, CRC(39d885b4) SHA1(2251826d247c3c6df421124718401fb35a672f83) ) | |
| 814 | ROM_LOAD( "uj17-vid", 0x500000, 0x100000, CRC(218de160) SHA1(87aea173720d2a33d8183903f4fe8ba1d47e3348) ) | |
| 815 | ||
| 816 | ROM_LOAD( "ug19-vid", 0x600000, 0x100000, CRC(fec137be) SHA1(f11ecb8a7993f5c4f4449564b4911f69bd6e9bf8) ) | |
| 817 | ROM_LOAD( "ug20-vid", 0x700000, 0x100000, CRC(809118c1) SHA1(86153e648834c749e34573151cd4fee403a81962) ) | |
| 818 | ROM_LOAD( "ug22-vid", 0x800000, 0x100000, CRC(154d53b1) SHA1(58ff0aa59101f40a9a3b5fbae1c904d0b0b31612) ) | |
| 819 | ||
| 820 | ROM_LOAD( "uj19-vid", 0x900000, 0x100000, CRC(2d763156) SHA1(06536006da49ab5fb6b75b25f801b83fad000ff5) ) | |
| 821 | ROM_LOAD( "uj20-vid", 0xa00000, 0x100000, CRC(b96824f0) SHA1(d42b122f9a57da330192abc7e5f97abc4065d718) ) | |
| 822 | ROM_LOAD( "uj22-vid", 0xb00000, 0x100000, CRC(8891d785) SHA1(fd460df1ef8f4306ea42f7dc41488a80fd2c8f53) ) | |
| 823 | ROM_END | |
| 824 | ||
| 825 | ||
| 787 | 826 | ROM_START( mk2r32 ) |
| 788 | 827 | ROM_REGION16_LE( 0xc00000, "dcs", ROMREGION_ERASEFF ) /* sound data */ |
| 789 | 828 | ROM_LOAD16_BYTE( "su2.l1", 0x000000, 0x80000, CRC(5f23d71d) SHA1(54c2afef243759e0f3dbe2907edbc4302f5c8bad) ) |
| r5955 | r5956 | |
| 1354 | 1393 | GAME( 1992, mktturbo, mk, tunit_adpcm, mk, mkturbo, ROT0, "hack", "Mortal Kombat (Turbo Ninja T-Unit 03/19/93, hack)", GAME_SUPPORTS_SAVE ) |
| 1355 | 1394 | |
| 1356 | 1395 | GAME( 1993, mk2, 0, tunit_dcs, mk2, mk2, ROT0, "Midway", "Mortal Kombat II (rev L3.1)", GAME_SUPPORTS_SAVE ) |
| 1396 | GAME( 1993, mk2r31e, mk2, tunit_dcs, mk2, mk2, ROT0, "Midway", "Mortal Kombat II (rev L3.1 (European))", GAME_SUPPORTS_SAVE ) | |
| 1357 | 1397 | GAME( 1993, mk2r32, mk2, tunit_dcs, mk2, mk2, ROT0, "Midway", "Mortal Kombat II (rev L3.2 (European))", GAME_SUPPORTS_SAVE ) |
| 1358 | 1398 | GAME( 1993, mk2r30, mk2, tunit_dcs, mk2, mk2, ROT0, "Midway", "Mortal Kombat II (rev L3.0)", GAME_SUPPORTS_SAVE ) |
| 1359 | 1399 | GAME( 1993, mk2r21, mk2, tunit_dcs, mk2, mk2, ROT0, "Midway", "Mortal Kombat II (rev L2.1)", GAME_SUPPORTS_SAVE ) |
| r5955 | r5956 | |
|---|---|---|
| 1095 | 1095 | ROM_LOAD( "gp430000.u4", 0x000000, 0x200000, CRC(8374663a) SHA1(095512564f4de25dc3752d9fbd254b9dabd16d1b) ) |
| 1096 | 1096 | ROM_END |
| 1097 | 1097 | |
| 1098 | ROM_START( galpani4k ) | |
| 1099 | ROM_REGION( 0x080000, "maincpu", 0 ) /* SH-2 Code */ | |
| 1100 | ROM_LOAD ( "sknsk1.u10", 0x000000, 0x080000, CRC(ff1c9f79) SHA1(a51e598d43e76d37da69b1f094c111273bdfc94a) ) /* Korean BIOS */ | |
| 1101 | ||
| 1102 | ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */ | |
| 1103 | ROM_LOAD16_BYTE( "gp4k1.u10", 0x000000, 0x080000, CRC(cbd5c3a0) SHA1(17fc0d6f6050ffd31707cee3fcc263cd5b9d0c4f) ) | |
| 1104 | ROM_LOAD16_BYTE( "gp4k1.u8", 0x000001, 0x080000, CRC(7a95bfe2) SHA1(82e24fd4674ec25bc6608ced0921e8573fcff2c2) ) | |
| 1105 | ||
| 1106 | ROM_REGION( 0x400000, "gfx1", 0 ) | |
| 1107 | ROM_LOAD( "gp410000.u24", 0x000000, 0x200000, CRC(1df61f01) SHA1(a9e95bbb3013e8f2fd01243b1b392ff07b4f7d02) ) | |
| 1108 | ROM_LOAD( "gp410100.u20", 0x200000, 0x100000, CRC(8e2c9349) SHA1(a58fa9bcc9684ed4558e3395d592b64a1978a902) ) | |
| 1109 | ||
| 1110 | ROM_REGION( 0x400000, "gfx2", 0 ) | |
| 1111 | ROM_LOAD( "gp420000.u16", 0x000000, 0x200000, CRC(f0781376) SHA1(aeab9553a9af922524e528eb2d019cf36b6e2094) ) | |
| 1112 | ROM_LOAD( "gp420100.u18", 0x200000, 0x200000, CRC(10c4b183) SHA1(80e05f3932495ad4fc9bf928fa66e6d2931bbb06) ) | |
| 1113 | ||
| 1114 | ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */ | |
| 1115 | /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */ | |
| 1116 | /* 0x040000 - 0x3fffff empty? */ | |
| 1117 | ||
| 1118 | ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */ | |
| 1119 | ROM_LOAD( "gp430000.u4", 0x000000, 0x200000, CRC(8374663a) SHA1(095512564f4de25dc3752d9fbd254b9dabd16d1b) ) | |
| 1120 | ROM_END | |
| 1121 | ||
| 1098 | 1122 | ROM_START( galpanis ) |
| 1099 | 1123 | ROM_REGION( 0x080000, "maincpu", 0 ) /* SH-2 Code */ |
| 1100 | 1124 | ROM_LOAD ( "sknsj1.u10", 0x000000, 0x080000, CRC(7e2b836c) SHA1(92c5a7a2472496028bff0e5980d41dd294f42144) ) /* Japan BIOS */ |
| r5955 | r5956 | |
| 1633 | 1657 | GAME( 1996, skns, 0, skns, skns, 0, ROT0, "Kaneko", "Super Kaneko Nova System BIOS", GAME_IS_BIOS_ROOT ) |
| 1634 | 1658 | |
| 1635 | 1659 | GAME( 1996, galpani4, skns, skns, cyvern, galpani4, ROT0, "Kaneko", "Gals Panic 4 (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| 1660 | GAME( 1996, galpani4k, galpani4, skns, cyvern, galpani4, ROT0, "Kaneko", "Gals Panic 4 (Korea)", GAME_IMPERFECT_GRAPHICS ) | |
| 1636 | 1661 | GAME( 1996, jjparads, skns, skns, skns_1p, jjparads, ROT0, "Electro Design", "Jan Jan Paradise", GAME_IMPERFECT_GRAPHICS ) |
| 1637 | 1662 | GAME( 1997, galpanis, skns, skns, galpanis, galpanis, ROT0, "Kaneko", "Gals Panic S - Extra Edition (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| 1638 | 1663 | GAME( 1997, jjparad2, skns, skns, skns_1p, jjparad2, ROT0, "Electro Design", "Jan Jan Paradise 2", GAME_IMPERFECT_GRAPHICS ) |
| r5955 | r5956 | |
|---|---|---|
| 1654 | 1654 | |
| 1655 | 1655 | static void megadrive_init_io(running_machine *machine) |
| 1656 | 1656 | { |
| 1657 | const input_port_token *ipt = machine->gamedrv->ipt; | |
| 1658 | ||
| 1657 | 1659 | megadrive_io_data_regs[0] = 0x7f; |
| 1658 | 1660 | megadrive_io_data_regs[1] = 0x7f; |
| 1659 | 1661 | megadrive_io_data_regs[2] = 0x7f; |
| r5955 | r5956 | |
| 1664 | 1666 | megadrive_io_tx_regs[1] = 0xff; |
| 1665 | 1667 | megadrive_io_tx_regs[2] = 0xff; |
| 1666 | 1668 | |
| 1667 | if ( | |
| 1669 | if ( | |
| 1668 | 1670 | init_megadri6_io(machine); |
| 1669 | 1671 | |
| 1670 | if ( | |
| 1672 | if ( | |
| 1671 | 1673 | init_megadri6_io(machine); |
| 1672 | 1674 | } |
| 1673 | 1675 | |
| r5955 | r5956 | |
| 1773 | 1775 | return retdata; |
| 1774 | 1776 | } |
| 1775 | 1777 | |
| 1776 | /* the SMS inputs should be more complex, like the megadrive ones */ | |
| 1777 | READ8_HANDLER (megatech_sms_ioport_dc_r) | |
| 1778 | { | |
| 1779 | running_machine *machine = space->machine; | |
| 1780 | /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */ | |
| 1781 | /* bit 4: TL-A; bit 5: TR-A */ | |
| 1782 | return (input_port_read(machine, "PAD1") & 0x3f) | ((input_port_read(machine, "PAD2") & 0x03) << 6); | |
| 1783 | } | |
| 1784 | ||
| 1785 | READ8_HANDLER (megatech_sms_ioport_dd_r) | |
| 1786 | { | |
| 1787 | running_machine *machine = space->machine; | |
| 1788 | /* 2009-05 FP: would it be worth to give separate inputs to SMS? SMS has only 2 keys A,B (which are B,C on megadrive) */ | |
| 1789 | /* bit 2: TL-B; bit 3: TR-B; bit 4: RESET; bit 5: unused; bit 6: TH-A; bit 7: TH-B*/ | |
| 1790 | return ((input_port_read(machine, "PAD2") & 0x3c) >> 2) | 0x10; | |
| 1791 | } | |
| 1792 | ||
| 1793 | 1778 | static UINT8 megadrive_io_read_ctrl_port(int portnum) |
| 1794 | 1779 | { |
| 1795 | 1780 | UINT8 retdata; |
| r5955 | r5956 | |
| 6212 | 6197 | |
| 6213 | 6198 | static void megadriv_init_common(running_machine *machine) |
| 6214 | 6199 | { |
| 6200 | const input_port_token *ipt = machine->gamedrv->ipt; | |
| 6201 | ||
| 6215 | 6202 | /* Look to see if this system has the standard Sound Z80 */ |
| 6216 | 6203 | _genesis_snd_z80_cpu = cputag_get_cpu(machine, "genesis_snd_z80"); |
| 6217 | 6204 | if (_genesis_snd_z80_cpu != NULL) |
| r5955 | r5956 | |
| 6266 | 6253 | |
| 6267 | 6254 | m68k_set_tas_callback(cputag_get_cpu(machine, "maincpu"), megadriv_tas_callback); |
| 6268 | 6255 | |
| 6269 | if (( | |
| 6256 | if (( | |
| 6270 | 6257 | { |
| 6271 | 6258 | megadrive_io_read_data_port_ptr = megadrive_io_read_data_port_6button; |
| 6272 | 6259 | megadrive_io_write_data_port_ptr = megadrive_io_write_data_port_6button; |
| r5955 | r5956 | |
| 6383 | 6370 | |
| 6384 | 6371 | |
| 6385 | 6372 | /* sets the megadrive z80 to it's normal ports / map */ |
| 6386 | void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine) | |
| 6373 | void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine, const char* tag) | |
| 6387 | 6374 | { |
| 6388 | 6375 | const device_config *ym = devtag_get_device(machine, "ym"); |
| 6389 | 6376 | |
| 6390 | 6377 | /* INIT THE PORTS *********************************************************************************************/ |
| 6391 | memory_install_readwrite8_handler(cputag_get_address_space(machine, | |
| 6378 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag | |
| 6392 | 6379 | |
| 6393 | 6380 | /* catch any addresses that don't get mapped */ |
| 6394 | memory_install_readwrite8_handler(cputag_get_address_space(machine, | |
| 6381 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag | |
| 6395 | 6382 | |
| 6396 | 6383 | |
| 6397 | memory_install_readwrite8_handler(cputag_get_address_space(machine, | |
| 6384 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag | |
| 6398 | 6385 | memory_set_bankptr(machine, 1, genz80.z80_prgram ); |
| 6399 | 6386 | |
| 6400 | memory_install_readwrite8_handler(cputag_get_address_space(machine, | |
| 6387 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag | |
| 6401 | 6388 | memory_set_bankptr(machine, 6, genz80.z80_prgram ); |
| 6402 | 6389 | |
| 6403 | 6390 | |
| 6404 | 6391 | // not allowed?? |
| 6405 | // memory_install_readwrite8_handler(cputag_get_address_space(machine, | |
| 6392 | // memory_install_readwrite8_handler(cputag_get_address_space(machine, tag | |
| 6406 | 6393 | |
| 6407 | memory_install_readwrite8_device_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w); | |
| 6408 | memory_install_write8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w); | |
| 6409 | memory_install_write8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w); | |
| 6410 | memory_install_read8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read); | |
| 6411 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write); | |
| 6412 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data); | |
| 6394 | memory_install_readwrite8_device_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w); | |
| 6395 | memory_install_write8_handler (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w); | |
| 6396 | memory_install_write8_handler (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w); | |
| 6397 | memory_install_read8_handler (cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read); | |
| 6398 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write); | |
| 6399 | memory_install_readwrite8_handler(cputag_get_address_space(machine, tag, ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data); | |
| 6413 | 6400 | } |
| 6414 | 6401 | |
| 6415 | 6402 | // these are tests for 'special case' hardware to make sure I don't break anything while rearranging things |
| r5955 | r5956 | |
|---|---|---|
| 25 | 25 | extern UINT8 megatech_bios_port_cc_dc_r(running_machine *machine, int offset, int ctrl); |
| 26 | 26 | extern void megadriv_stop_scanline_timer(void); |
| 27 | 27 | |
| 28 | void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine); | |
| 28 | void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine, const char* tag); | |
| 29 | 29 | |
| 30 | 30 | extern READ8_HANDLER (megatech_sms_ioport_dc_r); |
| 31 | 31 | extern READ8_HANDLER (megatech_sms_ioport_dd_r); |
| r5955 | r5956 | |
|---|---|---|
| 919 | 919 | |
| 920 | 920 | /* video hardware */ |
| 921 | 921 | MDRV_VIDEO_UPDATE(comad) |
| 922 | MDRV_VIDEO_EOF( | |
| 922 | MDRV_VIDEO_EOF(0 | |
| 923 | 923 | MACHINE_DRIVER_END |
| 924 | 924 | |
| 925 | 925 | static MACHINE_DRIVER_START( supmodel ) |
| r5955 | r5956 | |
| 932 | 932 | |
| 933 | 933 | /* video hardware */ |
| 934 | 934 | MDRV_VIDEO_UPDATE(comad) |
| 935 | MDRV_VIDEO_EOF( | |
| 935 | MDRV_VIDEO_EOF(0 | |
| 936 | 936 | |
| 937 | 937 | /* sound hardware */ |
| 938 | 938 | MDRV_SOUND_REPLACE("oki", OKIM6295, 1584000) |
| r5955 | r5956 | |
| 950 | 950 | |
| 951 | 951 | /* video hardware */ |
| 952 | 952 | MDRV_VIDEO_UPDATE(comad) |
| 953 | MDRV_VIDEO_EOF( | |
| 953 | MDRV_VIDEO_EOF(0 | |
| 954 | 954 | MACHINE_DRIVER_END |
| 955 | 955 | |
| 956 | 956 | static MACHINE_DRIVER_START( galhustl ) |
| r5955 | r5956 | |
| 963 | 963 | |
| 964 | 964 | /* video hardware */ |
| 965 | 965 | MDRV_VIDEO_UPDATE(comad) |
| 966 | MDRV_VIDEO_EOF( | |
| 966 | MDRV_VIDEO_EOF(0 | |
| 967 | 967 | |
| 968 | 968 | /* sound hardware */ |
| 969 | 969 | MDRV_SOUND_REPLACE("oki", OKIM6295, 1056000) |
| r5955 | r5956 | |
|---|---|---|
| 167 | 167 | |
| 168 | 168 | static UINT16 *mpBank0, *mpBank1; |
| 169 | 169 | static int mEnableInterrupts; |
| 170 | int namcona1_gametype; | |
| 170 | static int namcona1_gametype; | |
| 171 | 171 | |
| 172 | 172 | /*************************************************************************/ |
| 173 | 173 |
| r5955 | r5956 | |
|---|---|---|
| 447 | 447 | MDRV_CPU_MODIFY("mcu") |
| 448 | 448 | MDRV_CPU_PROGRAM_MAP(mcu_no_nvram_map) |
| 449 | 449 | |
| 450 | MDRV_NVRAM_HANDLER( | |
| 450 | MDRV_NVRAM_HANDLER(0 | |
| 451 | 451 | MACHINE_DRIVER_END |
| 452 | 452 | |
| 453 | 453 |
| r5955 | r5956 | |
|---|---|---|
| 345 | 345 | |
| 346 | 346 | static UINT8 *qsound_sharedram1,*qsound_sharedram2; |
| 347 | 347 | |
| 348 | INTERRUPT_GEN( cps1_qsound_interrupt ) | |
| 348 | static INTERRUPT_GEN( cps1_qsound_interrupt ) | |
| 349 | 349 | { |
| 350 | 350 | cpu_set_input_line(device, 2, HOLD_LINE); |
| 351 | 351 | } |
| r5955 | r5956 | |
| 458 | 458 | } |
| 459 | 459 | #endif |
| 460 | 460 | |
| 461 | READ16_HANDLER( cps1_eeprom_port_r ) | |
| 461 | static READ16_HANDLER( cps1_eeprom_port_r ) | |
| 462 | 462 | { |
| 463 | 463 | return eeprom_read_bit(); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | WRITE16_HANDLER( cps1_eeprom_port_w ) | |
| 466 | static WRITE16_HANDLER( cps1_eeprom_port_w ) | |
| 467 | 467 | { |
| 468 | 468 | if (ACCESSING_BITS_0_7) |
| 469 | 469 | { |
| r5955 | r5956 | |
| 5644 | 5644 | ROM_LOAD( "01.bin", 0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) ) |
| 5645 | 5645 | ROM_END |
| 5646 | 5646 | |
| 5647 | ROM_START( sf2qp1 ) | |
| 5648 | ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */ | |
| 5649 | ROM_LOAD16_WORD_SWAP( "stfii-qkn-cps-17.33", 0x000000, 0x40000, CRC(3a9458ee) SHA1(cbf56115c22a45e5ce1cde313fa5a5ba496316eb) ) | |
| 5650 | ROM_CONTINUE( 0xc0000, 0x40000 ) | |
| 5651 | ROM_LOAD16_WORD_SWAP( "stfii-qkn-cps-17.34", 0x080000, 0x40000, CRC(4ed215d8) SHA1(b09075f883c3a4976ab47203acc04f8f993969a8) ) | |
| 5652 | ROM_CONTINUE( 0x40000, 0x40000 ) | |
| 5653 | ||
| 5654 | ROM_REGION( 0x600000, "gfx", 0 ) | |
| 5655 | ROMX_LOAD( "sf2_06.bin", 0x000000, 0x80000, CRC(22c9cc8e) SHA1(b9194fb337b30502c1c9501cd6c64ae4035544d4) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx02.rom */ | |
| 5656 | ROMX_LOAD( "sf2_08.bin", 0x000002, 0x80000, CRC(57213be8) SHA1(3759b851ac0904ec79cbb67a2264d384b6f2f9f9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx04.rom */ | |
| 5657 | ROMX_LOAD( "sf2_05.bin", 0x000004, 0x80000, CRC(ba529b4f) SHA1(520840d727161cf09ca784919fa37bc9b54cc3ce) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx01.rom */ | |
| 5658 | ROMX_LOAD( "sf2_07.bin", 0x000006, 0x80000, CRC(4b1b33a8) SHA1(2360cff890551f76775739e2d6563858bff80e41) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx03.rom */ | |
| 5659 | ROMX_LOAD( "sf2_15.bin", 0x200000, 0x80000, CRC(2c7e2229) SHA1(357c2275af9133fd0bd6fbb1fa9ad5e0b490b3a2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx11.rom */ | |
| 5660 | ROMX_LOAD( "sf2_17.bin", 0x200002, 0x80000, CRC(b5548f17) SHA1(baa92b91cf616bc9e2a8a66adc777ffbf962a51b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx13.rom */ | |
| 5661 | ROMX_LOAD( "sf2_14.bin", 0x200004, 0x80000, CRC(14b84312) SHA1(2eea16673e60ba7a10bd4d8f6c217bb2441a5b0e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx10.rom */ | |
| 5662 | ROMX_LOAD( "sf2_16.bin", 0x200006, 0x80000, CRC(5e9cd89a) SHA1(f787aab98668d4c2c54fc4ba677c0cb808e4f31e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx12.rom */ | |
| 5663 | ROMX_LOAD( "sf2_25.bin", 0x400000, 0x80000, CRC(994bfa58) SHA1(5669b845f624b10e7be56bfc89b76592258ce48b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx21.rom */ | |
| 5664 | ROMX_LOAD( "sf2_27.bin", 0x400002, 0x80000, CRC(3e66ad9d) SHA1(9af9df0826988872662753e9717c48d46f2974b0) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx23.rom */ | |
| 5665 | ROMX_LOAD( "sf2_24.bin", 0x400004, 0x80000, CRC(c1befaa8) SHA1(a6a7f4725e52678cbd8d557285c01cdccb2c2602) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx20.rom */ | |
| 5666 | ROMX_LOAD( "sf2_26.bin", 0x400006, 0x80000, CRC(0627c831) SHA1(f9a92d614e8877d648449de2612fc8b43c85e4c2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx22.rom */ | |
| 5667 | ||
| 5668 | ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */ | |
| 5669 | ROM_LOAD( "sf2_09.bin", 0x00000, 0x08000, CRC(a4823a1b) SHA1(7b6bf59dfd578bfbbdb64c27988796783442d659) ) | |
| 5670 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 5671 | ||
| 5672 | ROM_REGION( 0x40000, "oki", 0 ) /* Samples */ | |
| 5673 | ROM_LOAD( "sf2_18.bin", 0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) ) | |
| 5674 | ROM_LOAD( "sf2_19.bin", 0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) ) | |
| 5675 | ||
| 5676 | ROM_REGION( 0x0200, "aboardplds", 0 ) | |
| 5677 | ROM_LOAD( "buf1", 0x0000, 0x0117, CRC(eb122de7) SHA1(b26b5bfe258e3e184f069719f9fd008d6b8f6b9b) ) | |
| 5678 | ROM_LOAD( "ioa1", 0x0000, 0x0117, CRC(59c7ee3b) SHA1(fbb887c5b4f5cb8df77cec710eaac2985bc482a6) ) | |
| 5679 | ROM_LOAD( "prg1", 0x0000, 0x0117, CRC(f1129744) SHA1(a5300f301c1a08a7da768f0773fa0fe3f683b237) ) | |
| 5680 | ROM_LOAD( "rom1", 0x0000, 0x0117, CRC(41dc73b9) SHA1(7d4c9f1693c821fbf84e32dd6ef62ddf14967845) ) | |
| 5681 | ROM_LOAD( "sou1", 0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) ) | |
| 5682 | ROM_END | |
| 5683 | ||
| 5647 | 5684 | /* B-Board 89624B */ |
| 5648 | 5685 | ROM_START( 3wonders ) |
| 5649 | 5686 | ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */ |
| r5955 | r5956 | |
| 6630 | 6667 | ROM_LOAD( "s92_19.bin", 0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) ) |
| 6631 | 6668 | ROM_END |
| 6632 | 6669 | |
| 6670 | ROM_START( sf2acc ) | |
| 6671 | ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */ | |
| 6672 | ROM_LOAD16_WORD_SWAP( "sf2ca_23-c.bin", 0x000000, 0x80000, CRC(e7c8c5a6) SHA1(247fb38c041f4d516899db32545d8b4d8debc4cf) ) | |
| 6673 | ROM_LOAD16_WORD_SWAP( "sf2ca_22-c.bin", 0x080000, 0x80000, CRC(99f1cca4) SHA1(64111eba81d743fc3fd51d7a89cd0b2eefcc900d) ) | |
| 6674 | ROM_LOAD16_WORD_SWAP( "sf2ca_21-c.bin", 0x100000, 0x40000, CRC(cf7fcc8c) SHA1(47d338634dd72d1ef912fbdb8c1a7ae945ca1a5f) ) | |
| 6675 | ||
| 6676 | ROM_REGION( 0x600000, "gfx", 0 ) | |
| 6677 | ROMX_LOAD( "s92_01.bin", 0x000000, 0x80000, CRC(03b0d852) SHA1(f370f25c96ad2b94f8c53d6b7139100285a25bef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6678 | ROMX_LOAD( "s92_02.bin", 0x000002, 0x80000, CRC(840289ec) SHA1(2fb42a242f60ba7e74009b5a90eb26e035ba1e82) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.03 */ | |
| 6679 | ROMX_LOAD( "s92_03.bin", 0x000004, 0x80000, CRC(cdb5f027) SHA1(4c7d944fef200fdfcaf57758b901b5511188ed2e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.02 */ | |
| 6680 | ROMX_LOAD( "s92_04.bin", 0x000006, 0x80000, CRC(e2799472) SHA1(27d3796429338d82a8de246a0ea06dd487a87768) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6681 | ROMX_LOAD( "s92_05.bin", 0x200000, 0x80000, CRC(ba8a2761) SHA1(4b696d66c51611e43522bed752654314e76d33b6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6682 | ROMX_LOAD( "s92_06.bin", 0x200002, 0x80000, CRC(e584bfb5) SHA1(ebdf1f5e2638eed3a65dda82b1ed9151a355f4c9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.07 */ | |
| 6683 | ROMX_LOAD( "s92_07.bin", 0x200004, 0x80000, CRC(21e3f87d) SHA1(4a4961bb68c3a1ce15f9d393d9c03ecb2466cc29) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.06 */ | |
| 6684 | ROMX_LOAD( "s92_08.bin", 0x200006, 0x80000, CRC(befc47df) SHA1(520390420da3a0271ba90b0a933e65143265e5cf) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6685 | ROMX_LOAD( "s92_10.bin", 0x400000, 0x80000, CRC(960687d5) SHA1(2868c31121b1c7564e9767b9a19cdbf655c7ed1d) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6686 | ROMX_LOAD( "s92_11.bin", 0x400002, 0x80000, CRC(978ecd18) SHA1(648a59706b93c84b4206a968ecbdc3e834c476f6) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.11 */ | |
| 6687 | ROMX_LOAD( "s92_12.bin", 0x400004, 0x80000, CRC(d6ec9a0a) SHA1(ed6143f8737013b6ef1684e37c05e037e7a80dae) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2.12 */ | |
| 6688 | ROMX_LOAD( "s92_13.bin", 0x400006, 0x80000, CRC(ed2c67f6) SHA1(0083c0ffaf6fe7659ff0cf822be4346cd6e61329) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 6689 | ||
| 6690 | ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */ | |
| 6691 | ROM_LOAD( "s92_09.bin", 0x00000, 0x08000, CRC(08f6b60e) SHA1(8258fcaca4ac419312531eec67079b97f471179c) ) | |
| 6692 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 6693 | ||
| 6694 | ROM_REGION( 0x40000, "oki", 0 ) /* Samples */ | |
| 6695 | ROM_LOAD( "s92_18.bin", 0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) ) | |
| 6696 | ROM_LOAD( "s92_19.bin", 0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) ) | |
| 6697 | ROM_END | |
| 6698 | ||
| 6633 | 6699 | ROM_START( sf2accp2 ) |
| 6634 | 6700 | ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */ |
| 6635 | 6701 | ROM_LOAD16_WORD_SWAP( "sf2ca-23.bin", 0x000000, 0x80000, CRC(36c3ba2f) SHA1(a3ddc479b725ddb3521757c8efa7aed125004997) ) |
| r5955 | r5956 | |
| 8656 | 8722 | GAME( 1991, sf2j, sf2, cps1_10MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 911210)", 0 ) |
| 8657 | 8723 | GAME( 1991, sf2ja, sf2, cps1_10MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910214)", 0 ) |
| 8658 | 8724 | GAME( 1991, sf2jc, sf2, cps1_10MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910306)", 0 ) |
| 8725 | GAME( 1991, sf2qp1, sf2, cps1_10MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II - The World Warrior (Quicken Pt-I, bootleg)" , 0) // 910214 | |
| 8659 | 8726 | GAME( 1991, 3wonders, 0, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (World 910520)" , 0) // "ETC" |
| 8660 | 8727 | GAME( 1991, 3wondersu,3wonders, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (US 910520)", 0 ) |
| 8661 | 8728 | GAME( 1991, wonder3, 3wonders, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Wonder 3 (Japan 910520)", 0 ) |
| r5955 | r5956 | |
| 8681 | 8748 | GAME( 1992, sf2rb3, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 3, bootleg)" , 0) |
| 8682 | 8749 | GAME( 1992, sf2red, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Red Wave, bootleg)" , 0) // 920313 - based on World version |
| 8683 | 8750 | GAME( 1992, sf2v004, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II! - Champion Edition (V004, bootleg)", 0 ) // "102092" !!! - based on (heavily modified) World version |
| 8751 | GAME( 1992, sf2acc, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Accelerator!, bootleg)" , 0) // 920313 - based on USA version | |
| 8684 | 8752 | GAME( 1992, sf2accp2, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Accelerator Pt.II, bootleg)" , 0) // 920313 - based on USA version |
| 8685 | 8753 | GAME( 1992, sf2m1, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M1, bootleg)", GAME_NOT_WORKING ) |
| 8686 | 8754 | GAME( 1992, sf2m2, sf2ce, cps1_12MHz, sf2m2, sf2hack, ROT0, "bootleg","Street Fighter II' - Champion Edition (M2, bootleg)", 0 ) |
| r5955 | r5956 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | static UINT8 *shared_ram; |
| 32 | static WRITE8_HANDLER( kyugo_sub_cpu_control_w ); | |
| 32 | 33 | |
| 33 | 34 | |
| 34 | 35 | /************************************* |
| r5955 | r5956 | |
| 37 | 38 | * |
| 38 | 39 | *************************************/ |
| 39 | 40 | |
| 40 | MACHINE_RESET( kyugo ) | |
| 41 | static MACHINE_RESET( kyugo ) | |
| 41 | 42 | { |
| 42 | 43 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 43 | 44 | // must start with interrupts and sub CPU disabled |
| r5955 | r5956 | |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | |
| 49 | WRITE8_HANDLER( kyugo_sub_cpu_control_w ) | |
| 50 | static WRITE8_HANDLER( kyugo_sub_cpu_control_w ) | |
| 50 | 51 | { |
| 51 | 52 | cputag_set_input_line(space->machine, "sub", INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE); |
| 52 | 53 | } |
| r5955 | r5956 | |
|---|---|---|
| 621 | 621 | INPUT_PORTS_END |
| 622 | 622 | |
| 623 | 623 | |
| 624 | static INPUT_PORTS_START( offrdtp2 ) | |
| 625 | PORT_INCLUDE( offroad ) | |
| 626 | ||
| 627 | PORT_MODIFY("IN0") | |
| 628 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 629 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) | |
| 630 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 ) | |
| 631 | INPUT_PORTS_END | |
| 632 | ||
| 633 | ||
| 624 | 634 | static INPUT_PORTS_START( pigout ) /* complete, verified from code */ |
| 625 | 635 | PORT_START("IN0") /* 0x40 */ |
| 626 | 636 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r5955 | r5956 | |
| 1747 | 1757 | ROM_END |
| 1748 | 1758 | |
| 1749 | 1759 | |
| 1760 | ROM_START( offrdtp2 ) | |
| 1761 | ROM_REGION( 0x040000, "master", 0 ) | |
| 1762 | ROM_LOAD( "ortp2u58.bin", 0x00000, 0x10000, CRC(8a785b66) SHA1(a9e369d446eec658294c81223399acc99e4198c2) ) | |
| 1763 | ROM_LOAD( "ortp2u59.bin", 0x10000, 0x10000, CRC(ff553895) SHA1(8d91b46306fa680ea96ebbb76418d7a82ed19568) ) | |
| 1764 | ROM_LOAD( "ortpu57.bin", 0x20000, 0x10000, CRC(e9f0f175) SHA1(db8c55015d1e8230f1fb27dfac6b8b364b0718a2) ) | |
| 1765 | ROM_LOAD( "ortpu56.bin", 0x30000, 0x10000, CRC(2c1a22b3) SHA1(fb18af5ec873968beab47d163d9ef23532c40771) ) | |
| 1766 | ||
| 1767 | ROM_REGION( 0x90000, "slave", 0 ) | |
| 1768 | ROM_LOAD( "ortpu3b.bin", 0x00000, 0x02000, CRC(95abb9f1) SHA1(98e9e8f388047d6992a664ae87c50ca65a5db0b1) ) | |
| 1769 | ROM_LOAD( "ortpu2.bin", 0x10000, 0x10000, CRC(c46c1627) SHA1(1e911bc774cbc0a66b2feb68b600aa5ad272daa6) ) | |
| 1770 | ROM_LOAD( "ortpu3.bin", 0x20000, 0x10000, CRC(2276546f) SHA1(d19335504a71ccf74864c8e9896347709bf794e4) ) | |
| 1771 | ROM_LOAD( "ortpu4.bin", 0x30000, 0x10000, CRC(aa4b5975) SHA1(7d695957c283aae4c7e6fb90dab117add65571b4) ) | |
| 1772 | ROM_LOAD( "ortpu5.bin", 0x40000, 0x10000, CRC(69100b06) SHA1(c25d1273d08fd20651d1873ce412bb1e18eff06f) ) | |
| 1773 | ROM_LOAD( "ortpu6.bin", 0x50000, 0x10000, CRC(b75015b8) SHA1(2bb6b4422e087502cfeb9bce0d3e3ffe18192fe0) ) | |
| 1774 | ROM_LOAD( "ortpu7.bin", 0x60000, 0x10000, CRC(a5af5b4f) SHA1(e4992bfbf628d034a879bf9317377348ee4c24e9) ) | |
| 1775 | ROM_LOAD( "ortpu8.bin", 0x70000, 0x10000, CRC(0f735078) SHA1(cb59b11fbed672cb372759384e5916418e6c3dc7) ) | |
| 1776 | ||
| 1777 | ROM_REGION( 0x100000, "audiocpu", 0 ) | |
| 1778 | ROM_LOAD16_BYTE( "ortpu25.bin", 0x040001, 0x10000, CRC(f952f800) SHA1(0f1fc837b0b5f5495a666b0a42adb6068e58a57a) ) | |
| 1779 | ROM_LOAD16_BYTE( "ortpu13.bin", 0x040000, 0x10000, CRC(7beec9fc) SHA1(b03b4a28217a8c7c02dc0314db97fef1d4ab6f20) ) | |
| 1780 | ROM_LOAD16_BYTE( "ortpu26.bin", 0x060001, 0x10000, CRC(6227ea94) SHA1(26384af82f73452b7be8a0eeac9f8a3b464068f6) ) | |
| 1781 | ROM_LOAD16_BYTE( "ortpu14.bin", 0x060000, 0x10000, CRC(0a44331d) SHA1(1a52da64c44bc91c2fc9499d1c41191725f9f2be) ) | |
| 1782 | ROM_LOAD16_BYTE( "ortpu27.bin", 0x0e0001, 0x10000, CRC(b80c5f99) SHA1(6b0657db870fb4e14e20cbd955655d0990dd7bda) ) | |
| 1783 | ROM_LOAD16_BYTE( "ortpu15.bin", 0x0e0000, 0x10000, CRC(2a1a1c3c) SHA1(990328240a2dba7264bb5add5ea8cae2752327d9) ) | |
| 1784 | ||
| 1785 | ROM_REGION( 0x18000, "gfx1", 0 ) | |
| 1786 | ROM_LOAD( "ortpu93b.bin", 0x00000, 0x08000, CRC(f0c1d8b0) SHA1(aa6e53b56474fa97b17b60ef1123a28442482b80) ) | |
| 1787 | ROM_LOAD( "ortpu94b.bin", 0x08000, 0x08000, CRC(7460d8c0) SHA1(9e3560056da89108c58b320125deeed0e009d0a8) ) | |
| 1788 | ROM_LOAD( "ortpu95b.bin", 0x10000, 0x08000, CRC(081ee7a8) SHA1(2b884a8ed4173b64f7890edf9a6954c62b5ba012) ) | |
| 1789 | ||
| 1790 | ROM_REGION( 0x20000, "user1", 0 ) /* Ordering: 70/92/69/91/68/90/67/89 */ | |
| 1791 | /* 70 = empty */ | |
| 1792 | ROM_LOAD( "ortpu92b.bin", 0x04000, 0x4000, CRC(f9988e28) SHA1(250071f4a26782266303331ddbef5479cc241220) ) | |
| 1793 | ROM_LOAD( "ortpu69b.bin", 0x08000, 0x4000, CRC(fe5f8d8f) SHA1(5e520da33f30a594c8f37e8e214d0d257ba5c801) ) | |
| 1794 | /* 91 = empty */ | |
| 1795 | /* 68 = empty */ | |
| 1796 | ROM_LOAD( "ortpu90b.bin", 0x14000, 0x4000, CRC(bda2ecb1) SHA1(c7a70ed794cf1655aebdf4538ab25f74be38cda3) ) | |
| 1797 | ROM_LOAD( "ortpu67b.bin", 0x18000, 0x4000, CRC(38c9bf29) SHA1(aa681f0a3eb5d31f2b01116939162d296e113428) ) | |
| 1798 | /* 89 = empty */ | |
| 1799 | ROM_END | |
| 1800 | ||
| 1801 | ||
| 1750 | 1802 | ROM_START( pigout ) |
| 1751 | 1803 | ROM_REGION( 0x040000, "master", 0 ) |
| 1752 | 1804 | ROM_LOAD( "poutu58t.bin", 0x00000, 0x10000, CRC(8fe4b683) SHA1(6f98a4e54a558a642b7193af85823b29ade46919) ) |
| r5955 | r5956 | |
| 2473 | 2525 | /* huge master banks, large slave banks, 80186 sound */ |
| 2474 | 2526 | GAME( 1989, offroad, 0, lelandi, offroad, offroad, ROT0, "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road", 0 ) |
| 2475 | 2527 | GAME( 1989, offroadt, 0, lelandi, offroad, offroadt, ROT0, "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road Track-Pak", 0 ) |
| 2528 | GAME( 1989, offrdtp2, offroadt,lelandi, offrdtp2, offroadt, ROT0, "Leland Corp.", "Ironman Ivan Stewart's Super Off-Road Track-Pak (2 Players)", 0 ) | |
| 2476 | 2529 | GAME( 1990, pigout, 0, lelandi, pigout, pigout, ROT0, "Leland Corp.", "Pig Out: Dine Like a Swine! (set 1)", 0 ) |
| 2477 | 2530 | GAME( 1990, pigouta, pigout, lelandi, pigout, pigout, ROT0, "Leland Corp.", "Pig Out: Dine Like a Swine! (set 2)", 0 ) |
| r5955 | r5956 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | Known bugs: |
| 14 | 14 | * Pig Newton doesn't read cocktail controls (might be game bug) |
| 15 | * Astro Blaster v1 dies when you first start | |
| 15 | * Astro Blaster v1 dies when you first start if you only | |
| 16 | have one credit at the time (bad dump?, protection?) | |
| 16 | 17 | |
| 17 | 18 | **************************************************************************** |
| 18 | 19 | |
| r5955 | r5956 | |
| 1066 | 1067 | |
| 1067 | 1068 | ROM_START( astrob1 ) |
| 1068 | 1069 | ROM_REGION( 0xc000, "maincpu", 0 ) |
| 1069 | ROM_LOAD( "829.cpu-u25", 0x0000, 0x0800, CRC(5f66046e) SHA1(6aa7f94122db1a75a89c12ad9d087aec1a70d675) ) | |
| 1070 | ROM_LOAD( "829.cpu-u25", 0x0000, 0x0800, CRC(5f66046e) SHA1(6aa7f94122db1a75a89c12ad9d087aec1a70d675) ) // verify that this isn't just a bad dump.. | |
| 1070 | 1071 | ROM_LOAD( "837.prom-u1", 0x0800, 0x0800, CRC(ce9c3763) SHA1(2cb4c3041905d38b040ef76f69f6197d699f9ec5) ) |
| 1071 | 1072 | ROM_LOAD( "838.prom-u2", 0x1000, 0x0800, CRC(3557289e) SHA1(57258b149f0872c34f82fe3dc06bc1fc60d7393f) ) |
| 1072 | 1073 | ROM_LOAD( "839.prom-u3", 0x1800, 0x0800, CRC(c88bda24) SHA1(9253306bd929e04a2136a0d9a9627dab8979baa1) ) |
| r5955 | r5956 | |
| 1094 | 1095 | ROM_LOAD( "812a.speech-u3", 0x1800, 0x0800, CRC(410ad0d2) SHA1(9b5f05bb64a6ecfe3543025a10c6ec67de797333) ) |
| 1095 | 1096 | ROM_END |
| 1096 | 1097 | |
| 1098 | ROM_START( astrode ) | |
| 1099 | ROM_REGION( 0xc000, "maincpu", 0 ) | |
| 1100 | ROM_LOAD( "829b.u25", 0x0000, 0x0800, CRC(14ae953c) SHA1(eb63d1b95faa5193db7fa6ab245e99325d519b5e) ) | |
| 1101 | ROM_LOAD( "834b.u01", 0x0800, 0x0800, CRC(82630950) SHA1(6e13cf5868d64835d9de823801cc4162b3c7b316) ) | |
| 1102 | ROM_LOAD( "814a.u02", 0x1000, 0x0800, CRC(d70d7d5e) SHA1(3d663cb36579c91cdb0ea82fd0af3b0ade8246b7) ) | |
| 1103 | ROM_LOAD( "815a.u03", 0x1800, 0x0800, CRC(0dbad477) SHA1(1fc6b3c628abd0d7a13b75eb2aeed7c04381f674) ) | |
| 1104 | ROM_LOAD( "816a.u04", 0x2000, 0x0800, CRC(8fa809ab) SHA1(c1dcae3b825dc283526b5ba742ca6816e5722464) ) | |
| 1105 | ROM_LOAD( "817a.u05", 0x2800, 0x0800, CRC(c7a3c014) SHA1(da25c2c2a116128e74df4de21727e2a4820c1045) ) | |
| 1106 | ROM_LOAD( "818a.u06", 0x3000, 0x0800, CRC(f13e804c) SHA1(550a02a4d21915d1127ba1be587539a8e27aa7ef) ) | |
| 1107 | ROM_LOAD( "819a.u07", 0x3800, 0x0800, CRC(2194a624) SHA1(a8a9baf202eb353b93dced71d74de713d54a5e5e) ) | |
| 1108 | ROM_LOAD( "820a.u08", 0x4000, 0x0800, CRC(95d84829) SHA1(a1684a695de41270721da851bed887a0c379e8c1) ) | |
| 1109 | ROM_LOAD( "821a.u09", 0x4800, 0x0800, CRC(1495059f) SHA1(d771274d5205421757076b9a5cfbd73fe2949901) ) | |
| 1110 | ROM_LOAD( "822a.u10", 0x5000, 0x0800, CRC(d036a5c5) SHA1(5557795280c5e492b94d670b156024d67d51aa8b) ) | |
| 1111 | ROM_LOAD( "823a.u11", 0x5800, 0x0800, CRC(788380dd) SHA1(6392386f9625c6fd609174e765a24e2c25fca957) ) | |
| 1112 | ROM_LOAD( "824a.u12", 0x6000, 0x0800, CRC(a43686c4) SHA1(1a6eae526de1667a7aa3a995b2655950555461eb) ) | |
| 1113 | ROM_LOAD( "825a.u13", 0x6800, 0x0800, CRC(43c8b973) SHA1(12ee379d24e2bcdd6b491262ac02f862a8a33aaf) ) | |
| 1114 | ROM_LOAD( "826a.u14", 0x7000, 0x0800, CRC(9f26d132) SHA1(5323a61de883ed1f2dca776b9d7c53a484249c02) ) | |
| 1115 | ROM_LOAD( "835.u15", 0x7800, 0x0800, CRC(6eeeb409) SHA1(1caf9b7ac08a4adcbf8c17f9e4b398373db706e1) ) | |
| 1116 | ROM_LOAD( "836.u16", 0x8000, 0x0800, CRC(07ffe6dc) SHA1(70673e8266139034afa64bf980b1b9ddbf294e0f) ) | |
| 1097 | 1117 | |
| 1118 | ROM_REGION( 0x0800, "audiocpu", 0 ) | |
| 1119 | ROM_LOAD( "808b_speech_de.u07", 0x0000, 0x0800, CRC(5988c767) SHA1(3b91a8cd46aa7e714028cc40f700fea32287afb1) ) | |
| 1120 | ||
| 1121 | ROM_REGION( 0x4000, "speech", 0 ) | |
| 1122 | ROM_LOAD( "830_speech_de.u06", 0x0000, 0x0800, CRC(2d840552) SHA1(7a2a7b54378b6cc85b8ab5c26e42266aa747c635) ) | |
| 1123 | ROM_LOAD( "831_speech_de.u05", 0x0800, 0x0800, CRC(46b30ee4) SHA1(c9e19a9b9ebc9b3b853e79f93ad74e4ec5dfd1ae) ) | |
| 1124 | ROM_LOAD( "832_speech_de.u04", 0x1000, 0x0800, CRC(d05280b8) SHA1(8d30b23b83b32465a8a2decd2ce9bfed24394e7e) ) | |
| 1125 | ROM_LOAD( "833_speech_de.u03", 0x1800, 0x0800, CRC(08f11459) SHA1(da6dc2bf30b95882f95c21739ec02fc89d286a66) ) | |
| 1126 | ROM_END | |
| 1127 | ||
| 1098 | 1128 | ROM_START( 005 ) |
| 1099 | 1129 | ROM_REGION( 0xc000, "maincpu", 0 ) |
| 1100 | 1130 | ROM_LOAD( "1346b.cpu-u25", 0x0000, 0x0800, CRC(8e68533e) SHA1(a257c556d31691068ed5c991f1fb2b51da4826db) ) |
| r5955 | r5956 | |
| 1541 | 1571 | GAME( 1981, astrob, 0, astrob, astrob, astrob, ROT270, "Sega", "Astro Blaster (version 3)", GAME_IMPERFECT_SOUND ) |
| 1542 | 1572 | GAME( 1981, astrob2, astrob, astrob, astrob2, astrob, ROT270, "Sega", "Astro Blaster (version 2)", GAME_IMPERFECT_SOUND ) |
| 1543 | 1573 | GAME( 1981, astrob2a, astrob, astrob, astrob2, astrob, ROT270, "Sega", "Astro Blaster (version 2a)", GAME_IMPERFECT_SOUND ) |
| 1544 | GAME( 1981, astrob1, astrob, astrob, astrob, astrob, ROT270, "Sega", "Astro Blaster (version 1)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) | |
| 1574 | GAME( 1981, astrob1, astrob, astrob, astrob, astrob, ROT270, "Sega", "Astro Blaster (version 1)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // instant death if you start game with 1 credit, protection?, bad dump? | |
| 1575 | GAME( 1981, astrode, astrob, astrob, astrob, astrob, ROT270, "Sega", "Astro Blaster (German)", GAME_IMPERFECT_SOUND ) | |
| 1545 | 1576 | GAME( 1981, 005, 0, 005, 005, 005, ROT270, "Sega", "005", GAME_IMPERFECT_SOUND ) |
| 1546 | 1577 | |
| 1578 | ||
| 1547 | 1579 | /* basic G-80 system with individual background boards */ |
| 1548 | 1580 | GAME( 1981, spaceod, 0, spaceod, spaceod, spaceod, ROT270, "Sega", "Space Odyssey (version 2)", GAME_IMPERFECT_SOUND ) |
| 1549 | 1581 | GAME( 1981, spaceod2, spaceod, spaceod, spaceod, spaceod, ROT270, "Sega", "Space Odyssey (version 1)", GAME_IMPERFECT_SOUND ) |
| r5955 | r5956 | |
|---|---|---|
| 2007 | 2007 | #define XOR(a) WORD2_XOR_BE(a) |
| 2008 | 2008 | |
| 2009 | 2009 | /* text layer uses a set of 16x16x8bpp tiles defined in RAM */ |
| 2010 | const gfx_layout namcos22_cg_layout = | |
| 2010 | static const gfx_layout namcos22_cg_layout = | |
| 2011 | 2011 | { |
| 2012 | 2012 | 16,16, |
| 2013 | 2013 | 0x400, /* 0x3c0 */ |
| r5955 | r5956 | |
|---|---|---|
| 2252 | 2252 | MDRV_CPU_IO_MAP(ozon1_io_map) |
| 2253 | 2253 | MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| 2254 | 2254 | |
| 2255 | MDRV_MACHINE_RESET( | |
| 2255 | MDRV_MACHINE_RESET(0 | |
| 2256 | 2256 | |
| 2257 | 2257 | MDRV_PALETTE_INIT(rockclim) |
| 2258 | 2258 | MDRV_PALETTE_LENGTH(32) |
| r5955 | r5956 | |
| 2344 | 2344 | MDRV_CPU_PROGRAM_MAP(harem_cpu2) |
| 2345 | 2345 | MDRV_CPU_IO_MAP(harem_cpu2_io) |
| 2346 | 2346 | |
| 2347 | MDRV_MACHINE_RESET( | |
| 2347 | MDRV_MACHINE_RESET(0 | |
| 2348 | 2348 | |
| 2349 | 2349 | MDRV_PALETTE_INIT(rockclim) |
| 2350 | 2350 | MDRV_PALETTE_LENGTH(32) |
| r5955 | r5956 | |
|---|---|---|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| 106 | /* names of sound effects taken from Tank 8, might differ for Sprint 8 */ | |
| 107 | ||
| 108 | static WRITE8_HANDLER( sprint8_crash_w ) {} | |
| 109 | static WRITE8_HANDLER( sprint8_explosion_w ) {} | |
| 110 | static WRITE8_HANDLER( sprint8_bugle_w ) {} | |
| 111 | static WRITE8_HANDLER( sprint8_bug_w ) {} | |
| 112 | static WRITE8_HANDLER( sprint8_attract_w ) {} | |
| 113 | static WRITE8_HANDLER( sprint8_motor_w ) {} | |
| 114 | ||
| 115 | ||
| 116 | 106 | static ADDRESS_MAP_START( sprint8_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 117 | 107 | AM_RANGE(0x0000, 0x00ff) AM_RAM |
| 118 | 108 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(sprint8_video_ram_w) AM_BASE(&sprint8_video_ram) |
| r5955 | r5956 | |
| 126 | 116 | AM_RANGE(0x1c20, 0x1c2f) AM_WRITEONLY AM_BASE(&sprint8_pos_d_ram) |
| 127 | 117 | AM_RANGE(0x1c30, 0x1c37) AM_WRITE(sprint8_lockout_w) |
| 128 | 118 | AM_RANGE(0x1d00, 0x1d00) AM_WRITE(sprint8_int_reset_w) |
| 129 | AM_RANGE(0x1d01, 0x1d01) AM_WRITE(sprint8_crash_w) | |
| 130 | AM_RANGE(0x1d02, 0x1d02) AM_WRITE(sprint8_explosion_w) | |
| 131 | AM_RANGE(0x1d03, 0x1d03) AM_WRITE(sprint8_bugle_w) | |
| 132 | AM_RANGE(0x1d04, 0x1d04) AM_WRITE(sprint8_bug_w) | |
| 119 | AM_RANGE(0x1d01, 0x1d01) AM_DEVWRITE("discrete", sprint8_crash_w) | |
| 120 | AM_RANGE(0x1d02, 0x1d02) AM_DEVWRITE("discrete", sprint8_screech_w) | |
| 121 | AM_RANGE(0x1d03, 0x1d03) AM_WRITENOP | |
| 122 | AM_RANGE(0x1d04, 0x1d04) AM_WRITENOP | |
| 133 | 123 | AM_RANGE(0x1d05, 0x1d05) AM_WRITEONLY AM_BASE(&sprint8_team) |
| 134 | AM_RANGE(0x1d06, 0x1d06) AM_WRITE(sprint8_attract_w) | |
| 135 | AM_RANGE(0x1e00, 0x1e07) AM_WRITE(sprint8_motor_w) | |
| 124 | AM_RANGE(0x1d06, 0x1d06) AM_DEVWRITE("discrete", sprint8_attract_w) | |
| 125 | AM_RANGE(0x1e00, 0x1e07) AM_DEVWRITE("discrete", sprint8_motor_w) | |
| 136 | 126 | AM_RANGE(0x1f00, 0x1f00) AM_WRITENOP /* probably a watchdog, disabled in service mode */ |
| 137 | 127 | AM_RANGE(0x2000, 0x3fff) AM_ROM |
| 138 | 128 | AM_RANGE(0xf800, 0xffff) AM_ROM |
| r5955 | r5956 | |
| 271 | 261 | PORT_START("VBLANK") |
| 272 | 262 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 273 | 263 | |
| 264 | /* this is actually a variable resistor */ | |
| 265 | PORT_START("R132") | |
| 266 | PORT_ADJUSTER(65, "R132 - Crash & Screech Volume") | |
| 267 | ||
| 274 | 268 | INPUT_PORTS_END |
| 275 | 269 | |
| 276 | 270 | |
| r5955 | r5956 | |
| 395 | 389 | PORT_START("VBLANK") |
| 396 | 390 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 397 | 391 | |
| 392 | /* this is actually a variable resistor */ | |
| 393 | PORT_START("R132") | |
| 394 | PORT_ADJUSTER(65, "R132 - Crash & Screech Volume") | |
| 395 | ||
| 398 | 396 | INPUT_PORTS_END |
| 399 | 397 | |
| 400 | 398 | |
| r5955 | r5956 | |
| 479 | 477 | MDRV_VIDEO_UPDATE(sprint8) |
| 480 | 478 | MDRV_VIDEO_EOF(sprint8) |
| 481 | 479 | |
| 480 | ||
| 482 | 481 | /* sound hardware */ |
| 482 | /* the proper way is to hook up 4 speakers, but they are not really | |
| 483 | * F/R/L/R speakers. Though you can pretend the 1-2 mix is the front. */ | |
| 484 | MDRV_SPEAKER_ADD("speaker_1_2", 0.0, 0.0, 1.0) /* front */ | |
| 485 | MDRV_SPEAKER_ADD("speaker_3_7", -0.2, 0.0, 1.0) /* left */ | |
| 486 | MDRV_SPEAKER_ADD("speaker_5_6", 0.0, 0.0, -0.5) /* back */ | |
| 487 | MDRV_SPEAKER_ADD("speaker_4_8", 0.2, 0.0, 1.0) /* right */ | |
| 488 | ||
| 489 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) | |
| 490 | MDRV_SOUND_CONFIG_DISCRETE(sprint8) | |
| 491 | MDRV_SOUND_ROUTE(0, "speaker_1_2", 1.0) | |
| 492 | /* volumes on other channels defaulted to off, */ | |
| 493 | /* user can turn them up if needed. */ | |
| 494 | /* The game does not sound good with all channels mixed to stereo. */ | |
| 495 | MDRV_SOUND_ROUTE(1, "speaker_3_7", 0.0) | |
| 496 | MDRV_SOUND_ROUTE(2, "speaker_5_6", 0.0) | |
| 497 | MDRV_SOUND_ROUTE(3, "speaker_4_8", 0.0) | |
| 483 | 498 | MACHINE_DRIVER_END |
| 484 | 499 | |
| 485 | 500 | |
| r5955 | r5956 | |
| 516 | 531 | ROM_END |
| 517 | 532 | |
| 518 | 533 | |
| 519 | GAME( 1977, sprint8, 0, sprint8, sprint8, 0, ROT0, "Atari", "Sprint 8", GAME_NO_SOUND ) | |
| 520 | GAME( 1977, sprint8a, sprint8, sprint8, sprint8p, 0, ROT0, "Atari", "Sprint 8 (play tag & chase)", GAME_NO_SOUND ) | |
| 534 | GAME( 1977, sprint8, 0, sprint8, sprint8, 0, ROT0, "Atari", "Sprint 8", 0 ) | |
| 535 | GAME( 1977, sprint8a, sprint8, sprint8, sprint8p, 0, ROT0, "Atari", "Sprint 8 (play tag & chase)", 0 ) |
| r5955 | r5956 | |
|---|---|---|
| 1379 | 1379 | |
| 1380 | 1380 | |
| 1381 | 1381 | /* machine start (called only once) */ |
| 1382 | MACHINE_START( mpu4_vid ) | |
| 1382 | static MACHINE_START( mpu4_vid ) | |
| 1383 | 1383 | { |
| 1384 | 1384 | mpu4_config_common(machine); |
| 1385 | 1385 | |
| r5955 | r5956 | |
| 2055 | 2055 | ROM_LOAD( "meter-zero.p1", 0x8000, 0x8000, CRC(e74297e5) SHA1(49a2cc85eda14199975ec37a794b685c839d3ab9)) |
| 2056 | 2056 | ROM_END |
| 2057 | 2057 | |
| 2058 | DRIVER_INIT (connect4) | |
| 2058 | static DRIVER_INIT (connect4) | |
| 2059 | 2059 | { |
| 2060 | 2060 | led_extend=1; |
| 2061 | 2061 | } |
| r5955 | r5956 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | READ32_HANDLER( polygonet_ttl_ram_r ); |
| 94 | 94 | WRITE32_HANDLER( polygonet_ttl_ram_w ); |
| 95 | READ32_HANDLER( polygonet_roz_ram_r ); | |
| 96 | WRITE32_HANDLER( polygonet_roz_ram_w ); | |
| 95 | 97 | |
| 96 | 98 | static int init_eeprom_count; |
| 97 | 99 | |
| r5955 | r5956 | |
| 246 | 248 | COMBINE_DATA(&shared_ram[offset]) ; |
| 247 | 249 | |
| 248 | 250 | logerror("68k WRITING %04x & %04x to shared ram %x & %x [%08x] (@%x)\n", (shared_ram[offset] & 0xffff0000) >> 16, |
| 249 | (shared_ram[offset] & 0x0000ffff), | |
| 250 | 0xc000 + (offset<<1), | |
| 251 | 0xc000 +((offset<<1)+1), | |
| 252 | mem_mask, | |
| 253 | cpu_get_pc(space->cpu)); | |
| 251 | (shared_ram[offset] & 0x0000ffff), | |
| 252 | 0xc000 + (offset<<1), | |
| 253 | 0xc000 +((offset<<1)+1), | |
| 254 | mem_mask, | |
| 255 | cpu_get_pc(space->cpu)); | |
| 254 | 256 | |
| 255 | 257 | /* write to the current dsp56k word */ |
| 256 | 258 | if (mem_mask | (0xffff0000)) |
| r5955 | r5956 | |
| 272 | 274 | /* 0x01000000 is the reset line - 0 is high, 1 is low */ |
| 273 | 275 | if ((data >> 24) & 0x01) |
| 274 | 276 | { |
| 275 | ||
| 277 | // logerror("RESET CLEARED\n"); | |
| 276 | 278 | cputag_set_input_line(space->machine, "dsp", DSP56K_IRQ_RESET, CLEAR_LINE); |
| 277 | 279 | } |
| 278 | 280 | else |
| 279 | 281 | { |
| 280 | ||
| 282 | // logerror("RESET ASSERTED\n"); | |
| 281 | 283 | cputag_set_input_line(space->machine, "dsp", DSP56K_IRQ_RESET, ASSERT_LINE); |
| 282 | 284 | |
| 283 | 285 | /* A little hacky - I can't seem to set these lines anywhere else where reset is asserted, so i do it here */ |
| r5955 | r5956 | |
| 403 | 405 | const UINT16 bit1 = (portC & 0x0001) >> 0; |
| 404 | 406 | return (bits32 | bit1); |
| 405 | 407 | } |
| 406 | ||
| 407 | if (bank_group == INVALID_BANK_GROUP) | |
| 408 | else if (bank_group == INVALID_BANK_GROUP) | |
| 409 | { | |
| 408 | 410 | fatalerror("Plygonet: dsp56k bank num invalid.\n"); |
| 411 | } | |
| 409 | 412 | |
| 410 | 413 | return 0; |
| 411 | 414 | } |
| r5955 | r5956 | |
| 524 | 527 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 525 | 528 | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 526 | 529 | AM_RANGE(0x200000, 0x21ffff) AM_RAM_WRITE(plygonet_palette_w) AM_BASE(&paletteram32) |
| 527 | AM_RANGE(0x440000, 0x440fff) AM_RAM /* PSVR: PSAC2 VRAM? */ | |
| 530 | AM_RANGE(0x400000, 0x40001f) AM_RAM AM_BASE((UINT32**)&K053936_0_ctrl) | |
| 531 | AM_RANGE(0x440000, 0x440fff) AM_READWRITE(polygonet_roz_ram_r, polygonet_roz_ram_w) | |
| 528 | 532 | AM_RANGE(0x480000, 0x4bffff) AM_READ(polygonet_eeprom_r) |
| 529 | 533 | AM_RANGE(0x4C0000, 0x4fffff) AM_WRITE(polygonet_eeprom_w) |
| 530 | 534 | AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(shared_ram_write) AM_BASE(&shared_ram) |
| r5955 | r5956 | |
| 602 | 606 | }; |
| 603 | 607 | |
| 604 | 608 | /**********************************************************************************/ |
| 605 | ||
| 606 | 609 | static const gfx_layout bglayout = |
| 607 | 610 | { |
| 608 | 611 | 16,16, |
| 609 | | |
| 612 | | |
| 610 | 613 | 4, |
| 611 | 614 | { 0, 1, 2, 3 }, |
| 615 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, | |
| 616 | 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, | |
| 612 | 617 | { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, 8*4, |
| 613 | 618 | 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 }, |
| 614 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, | |
| 615 | 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, | |
| 616 | 128*8 | |
| 619 | ||
| 620 | 128*8 | |
| 617 | 621 | }; |
| 618 | 622 | |
| 619 | 623 | static GFXDECODE_START( plygonet ) |
| r5955 | r5956 | |
| 660 | 664 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 661 | 665 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 662 | 666 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 663 | MDRV_SCREEN_VISIBLE_AREA(4 | |
| 667 | MDRV_SCREEN_VISIBLE_AREA(64 | |
| 664 | 668 | |
| 665 | 669 | MDRV_PALETTE_LENGTH(32768) |
| 666 | 670 | |
| r5955 | r5956 | |
| 681 | 685 | MDRV_SOUND_ROUTE(1, "rspeaker", 0.75) |
| 682 | 686 | MACHINE_DRIVER_END |
| 683 | 687 | |
| 688 | ||
| 689 | /**********************************************************************************/ | |
| 684 | 690 | static INPUT_PORTS_START( polygonet ) |
| 685 | 691 | PORT_START("IN0") |
| 686 | 692 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 687 | 693 | PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) |
| 688 | 694 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 689 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) | |
| 690 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* SW1 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 691 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) /* SW2 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 692 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) | |
| 693 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) | |
| 695 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 696 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* SW1 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 697 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* SW2 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 698 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 699 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 694 | 700 | |
| 695 | 701 | PORT_START("IN1") |
| 696 | 702 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) |
| r5955 | r5956 | |
| 699 | 705 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1) |
| 700 | 706 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 701 | 707 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 702 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON8 ) | |
| 703 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON9 ) | |
| 708 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 709 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 704 | 710 | INPUT_PORTS_END |
| 705 | 711 | |
| 712 | static INPUT_PORTS_START( polynetw ) | |
| 713 | PORT_START("IN0") | |
| 714 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 715 | PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) | |
| 716 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 717 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 718 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* SW1 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 719 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* SW2 (changes player color). It's mapped on the JAMMA connector and plugs into an external switch mech. */ | |
| 720 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 721 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 722 | ||
| 723 | PORT_START("IN1") | |
| 724 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 725 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 726 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 727 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 728 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 729 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(1) | |
| 730 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 731 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 732 | INPUT_PORTS_END | |
| 733 | ||
| 734 | ||
| 735 | /**********************************************************************************/ | |
| 706 | 736 | static DRIVER_INIT(polygonet) |
| 707 | 737 | { |
| 708 | 738 | /* Set default bankswitch */ |
| r5955 | r5956 | |
| 720 | 750 | dsp56k_update_handler = memory_set_direct_update_handler(cputag_get_address_space(machine, "dsp", ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler); |
| 721 | 751 | } |
| 722 | 752 | |
| 753 | ||
| 754 | /**********************************************************************************/ | |
| 723 | 755 | ROM_START( plygonet ) |
| 724 | 756 | /* main program */ |
| 725 | 757 | ROM_REGION( 0x200000, "maincpu", 0) |
| r5955 | r5956 | |
| 775 | 807 | |
| 776 | 808 | /* ROM parent machine inp init */ |
| 777 | 809 | GAME( 1993, plygonet, 0, plygonet, polygonet, polygonet, ROT90, "Konami", "Polygonet Commanders (ver UAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 778 | GAME( 1993, polynetw, 0, plygonet, poly | |
| 810 | GAME( 1993, polynetw, 0, plygonet, poly | |
| 779 | 811 |
| r5955 | r5956 | |
|---|---|---|
| 1523 | 1523 | switch( cart ) |
| 1524 | 1524 | { |
| 1525 | 1525 | case 0: |
| 1526 | nvram_handler_security_cart_0 = | |
| 1526 | nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f041_0); | |
| 1527 | 1527 | break; |
| 1528 | 1528 | case 1: |
| 1529 | nvram_handler_security_cart_1 = | |
| 1529 | nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f041_1); | |
| 1530 | 1530 | break; |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| r5955 | r5956 | |
| 1539 | 1539 | switch( cart ) |
| 1540 | 1540 | { |
| 1541 | 1541 | case 0: |
| 1542 | nvram_handler_security_cart_0 = | |
| 1542 | nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f100_0); | |
| 1543 | 1543 | break; |
| 1544 | 1544 | case 1: |
| 1545 | nvram_handler_security_cart_1 = | |
| 1545 | nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f100_1); | |
| 1546 | 1546 | break; |
| 1547 | 1547 | } |
| 1548 | 1548 | |
| r5955 | r5956 | |
| 1555 | 1555 | switch( cart ) |
| 1556 | 1556 | { |
| 1557 | 1557 | case 0: |
| 1558 | nvram_handler_security_cart_0 = | |
| 1558 | nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(zs01_0); | |
| 1559 | 1559 | break; |
| 1560 | 1560 | case 1: |
| 1561 | nvram_handler_security_cart_1 = | |
| 1561 | nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(zs01_1); | |
| 1562 | 1562 | break; |
| 1563 | 1563 | } |
| 1564 | 1564 |
| r5955 | r5956 | |
|---|---|---|
| 13 | 13 | #include "includes/archimds.h" |
| 14 | 14 | |
| 15 | 15 | static ADDRESS_MAP_START( aristmk5_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 16 | AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(memc_logical_r, memc_logical_w) | |
| 17 | AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */ | |
| 18 | AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(ioc_r, ioc_w) | |
| 19 | AM_RANGE(0x03400000, 0x035fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(memc_page_w) | |
| 20 | AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(memc_r, memc_w) | |
| 21 | AM_RANGE(0x03800000, 0x039fffff) AM_READWRITE(vidc_r, vidc_w) | |
| 16 | AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w) | |
| 17 | AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */ | |
| 18 | AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w) | |
| 19 | AM_RANGE(0x03400000, 0x035fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w) | |
| 20 | AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w) | |
| 21 | AM_RANGE(0x03800000, 0x039fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w) | |
| 22 | 22 | ADDRESS_MAP_END |
| 23 | 23 | |
| 24 | 24 |
| r5955 | r5956 | |
|---|---|---|
| 345 | 345 | MDRV_CPU_PROGRAM_MAP(psurge_main_map) |
| 346 | 346 | MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse) |
| 347 | 347 | |
| 348 | MDRV_MACHINE_START( | |
| 348 | MDRV_MACHINE_START(0 | |
| 349 | 349 | MACHINE_DRIVER_END |
| 350 | 350 | |
| 351 | 351 |
| r5955 | r5956 | |
|---|---|---|
| 982 | 982 | |
| 983 | 983 | ROM_START( vulcana ) |
| 984 | 984 | ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code (CPU A) |
| 985 | ROM_LOAD16_BYTE( "785_r05.6n", 0x00000, 0x10000, CRC(1777a57b) SHA1(9696fa9c6d53587972d213d5c12245e40fbc2bda) ) | |
| 986 | ROM_LOAD16_BYTE( "785_r04.4n", 0x00001, 0x10000, CRC(790cbdf3) SHA1(e247c2be00169490aea945518c1a68e94799f5f4) ) | |
| 987 | ROM_LOAD16_BYTE( "785_u09.6r", 0x20000, 0x10000, CRC(1aba7010) SHA1(bcf28640d5ba7864ed7112db23ff344434b2d944) ) | |
| 988 | ROM_LOAD16_BYTE( "785_k08.4r", 0x20001, 0x10000, CRC(36bb1be1) SHA1(ce9a98443a453b1c05dfb8d0f8ba0f94292b9d30) ) /* Same as 785_r08.4r */ | |
| 989 | ||
| 990 | ROM_REGION( 0x40000, "sub", 0 ) // 68000 code (CPU B) | |
| 991 | ROM_LOAD16_BYTE( "785_p07.10n", 0x00000, 0x10000, CRC(686d549d) SHA1(9687be801c4fb963bf6b0199e2ae9f5051213f7a) ) | |
| 992 | ROM_LOAD16_BYTE( "785_p06.8n" , 0x00001, 0x10000, CRC(70c94bee) SHA1(951e00ca4d3a47a21b4db05bcdc8ead45b42c3f1) ) | |
| 993 | ROM_LOAD16_BYTE( "785_p13.10s", 0x20000, 0x10000, CRC(478fdb0a) SHA1(2e285ad6dcfc67f3e24d231e0e1be19036ce64d2) ) | |
| 994 | ROM_LOAD16_BYTE( "785_p12.8s", 0x20001, 0x10000, CRC(38ea402a) SHA1(90ff2bd71435988cde967704ce3b1401de206683) ) | |
| 995 | ||
| 996 | ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code (sound CPU) | |
| 997 | ROM_LOAD( "785_g03.10a", 0x00000, 0x8000, CRC(67a3b50d) SHA1(3c83f3b0df73d9361ec3cda26a6c4c603a088419) ) | |
| 998 | ||
| 999 | ROM_REGION( 0x4000, "gfx1", 0 ) | |
| 1000 | ROM_LOAD( "785_h14.d8", 0x0000, 0x4000, CRC(02f4b16f) SHA1(45addc99f520770f38c6aa69aef9af59cfc410b5) ) /* Title screen graphics & characters */ | |
| 1001 | ||
| 1002 | ROM_REGION16_BE( 0x200000, "gfx2", 0 ) // gfx data used at runtime | |
| 1003 | ROM_LOAD16_WORD( "785f17.p16", 0x000000, 0x80000, CRC(8fbec1a4) SHA1(71cbdb25470b5a2ca7e80c92f12fc47e28085793) ) | |
| 1004 | ROM_LOAD16_WORD( "785f18.p18", 0x080000, 0x80000, CRC(50d61e38) SHA1(051d332d93d435d19571e22d69ffc5395dbb16a4) ) | |
| 1005 | ROM_LOAD16_WORD( "785f15.p13", 0x100000, 0x80000, CRC(af96aef3) SHA1(a58e26a8b134ab6e7938cd4fa342c04c236efd99) ) | |
| 1006 | ROM_LOAD16_WORD( "785f16.p15", 0x180000, 0x80000, CRC(b858df1f) SHA1(c434da7ba54d59643fe6ca30bceccf16413904c3) ) | |
| 1007 | ||
| 1008 | ROM_REGION( 0x20000, "gfx3", ROMREGION_ERASE00 ) // tile data; mapped at 0x80000 on CPUB | |
| 1009 | ||
| 1010 | ROM_REGION( 0x20000, "konami", 0 ) // samples | |
| 1011 | ROM_LOAD( "785_f01.5a", 0x00000, 0x20000, CRC(a0d8d69e) SHA1(2994e5740b7c099d55fb162a363a26ef1995c756) ) | |
| 1012 | ||
| 1013 | ROM_REGION( 0x20000, "upd", 0 ) // samples | |
| 1014 | ROM_LOAD( "785_f02.7c", 0x00000, 0x20000, CRC(c39f5ca4) SHA1(92ebea11b7d3a72d0f58c456f16a6ff36d6b3062) ) | |
| 1015 | ROM_END | |
| 1016 | ||
| 1017 | ROM_START( vulcanb ) | |
| 1018 | ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code (CPU A) | |
| 985 | 1019 | ROM_LOAD16_BYTE( "785_n05.6n", 0x00000, 0x10000, CRC(6371d475) SHA1(82e6adc38de8363c126cd073dbc95eeec576db98) ) |
| 986 | 1020 | ROM_LOAD16_BYTE( "785_n04.4n", 0x00001, 0x10000, CRC(b6f24b9e) SHA1(01685f89955385714062cc70316edce1a6a64e35) ) |
| 987 | 1021 | ROM_LOAD16_BYTE( "785_r09.6r", 0x20000, 0x10000, CRC(fbfd1543) SHA1(8ef41a0a9d3d1de9395bdd5288199841c61d7045) ) |
| 988 | 1022 | ROM_LOAD16_BYTE( "785_r08.4r", 0x20001, 0x10000, CRC(36bb1be1) SHA1(ce9a98443a453b1c05dfb8d0f8ba0f94292b9d30) ) |
| 989 | 1023 | |
| 990 | 1024 | ROM_REGION( 0x40000, "sub", 0 ) // 68000 code (CPU B) |
| 991 | ROM_LOAD16_BYTE( "785_g07.10n", 0x00000, 0x10000, CRC(ee09dd5d) SHA1(9b6fb12c2cb7930df12d9876810811540fd560ee) ) | |
| 1025 | ROM_LOAD16_BYTE( "785_g07.10n", 0x00000, 0x10000, CRC(ee09dd5d) SHA1(9b6fb12c2cb7930df12d9876810811540fd560ee) ) /* requires older CPU B code compared to other sets */ | |
| 992 | 1026 | ROM_LOAD16_BYTE( "785_g06.8n" , 0x00001, 0x10000, CRC(85ab7af7) SHA1(5cb36918a5cdfd16611da76f07450ae1d115f2c7) ) |
| 993 | 1027 | ROM_LOAD16_BYTE( "785_g13.10s", 0x20000, 0x10000, CRC(274f325d) SHA1(1076efa204eff0fc8a8788706b17b9a128023d35) ) |
| 994 | 1028 | ROM_LOAD16_BYTE( "785_g12.8s", 0x20001, 0x10000, CRC(1625f933) SHA1(3f25d7396af46e75e3ae8456414e31935de43d34) ) |
| r5955 | r5956 | |
| 1307 | 1341 | GAME( 1987, devilw, 0, devilw, devilw, twin16, ROT0, "Konami", "Devil World", GAME_SUPPORTS_SAVE ) |
| 1308 | 1342 | GAME( 1987, majuu, devilw, devilw, devilw, twin16, ROT0, "Konami", "Majuu no Ohkoku", GAME_SUPPORTS_SAVE ) |
| 1309 | 1343 | GAME( 1987, darkadv, devilw, devilw, darkadv, twin16, ROT0, "Konami", "Dark Adventure", GAME_SUPPORTS_SAVE ) |
| 1310 | GAME( 1988, vulcan, 0, twin16, vulcan, twin16, ROT0, "Konami", "Vulcan Venture", GAME_SUPPORTS_SAVE ) | |
| 1311 | GAME( 1988, vulcana, vulcan, twin16, gradius2, twin16, ROT0, "Konami", "Vulcan Venture (Older Ver.)", GAME_SUPPORTS_SAVE ) | |
| 1344 | GAME( 1988, vulcan, 0, twin16, vulcan, twin16, ROT0, "Konami", "Vulcan Venture (New)", GAME_SUPPORTS_SAVE ) | |
| 1345 | GAME( 1988, vulcana, vulcan, twin16, gradius2, twin16, ROT0, "Konami", "Vulcan Venture (Old)", GAME_SUPPORTS_SAVE ) | |
| 1346 | GAME( 1988, vulcanb, vulcan, twin16, gradius2, twin16, ROT0, "Konami", "Vulcan Venture (Oldest)", GAME_SUPPORTS_SAVE ) | |
| 1312 | 1347 | GAME( 1988, gradius2, vulcan, twin16, gradius2, twin16, ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan New Ver.)", GAME_SUPPORTS_SAVE ) |
| 1313 | 1348 | GAME( 1988, gradius2a,vulcan, twin16, vulcan, twin16, ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Old Ver.)", GAME_SUPPORTS_SAVE ) |
| 1314 | 1349 | GAME( 1988, gradius2b,vulcan, twin16, vulcan, twin16, ROT0, "Konami", "Gradius II - GOFER no Yabou (Japan Older Ver.)", GAME_SUPPORTS_SAVE ) |
| r5955 | r5956 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | There were only 5 known games on this hardware. They include.... |
| 12 | 12 | |
| 13 | Game Year CD Codes Konami Part# | |
| 14 | -------------------------------------------------------------------------------------- | |
| 13 | Game Year CD Codes Konami Part# | |
| 14 | ------------------------------------------------------------------------------------------------- | |
| 15 | 15 | Battle Tryst 1998 636JAC02 |
| 16 | 16 | Evil Night 1998 810UBA02 |
| 17 | 17 | Hell Night (alt. Region title, same as Evil Night) 1998 810EAA02 |
| 18 | 18 | Heat Of Eleven '98 1998 703EAA02 |
| 19 | Polystars 1997 623JAA02 003894 | |
| 20 | Total Vice 1997 639AAB01 | |
| 19 | Tobe! Polystars 1997 623JAA02 003894 | |
| 20 | Total Vice 1997 639UAC01, 639JAD01, 639AAB01 | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | PCB Layouts |
| r5955 | r5956 | |
| 1223 | 1223 | ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ |
| 1224 | 1224 | ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) |
| 1225 | 1225 | |
| 1226 | DISK_REGION( "cdrom" ) // TODO: Add correct CHD | |
| 1226 | DISK_REGION( "cdrom" ) | |
| 1227 | DISK_IMAGE( "639uac01", 0, SHA1(88431b8a0ce83c156c8b19efbba1af901b859404) ) | |
| 1228 | ROM_END | |
| 1229 | ||
| 1230 | ROM_START( totlvicj ) | |
| 1231 | ROM_REGION64_BE( 0x200000, "boot", 0 ) | |
| 1232 | ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) | |
| 1233 | ||
| 1234 | ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ | |
| 1235 | ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) | |
| 1236 | ||
| 1237 | DISK_REGION( "cdrom" ) // Need a re-image | |
| 1227 | 1238 | DISK_IMAGE( "639jad01", 0, BAD_DUMP SHA1(39d41d5a9d1c40636d174c8bb8172b1121e313f8) ) |
| 1228 | 1239 | ROM_END |
| 1229 | 1240 | |
| r5955 | r5956 | |
| 1234 | 1245 | cde_init(machine); |
| 1235 | 1246 | } |
| 1236 | 1247 | |
| 1237 | GAME( 1997, polystar, 0, m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1238 | GAME( 1997, totlvice, 0, m2, m2, m2, ROT0, "Konami", "Total Vice (ver JAD)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1239 | GAME( 1998, btltryst, 0, m2, m2, m2, ROT0, "Konami", "Battle Tryst (ver JAC)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1240 | GAME( 1998, heatof11, 0, m2, m2, m2, ROT0, "Konami", "Heat of Eleven '98 (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1241 | GAME( 1998, evilngt, 0, m2, m2, m2, ROT0, "Konami", "Evil Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1242 | GAME( 1998, hellngt, evilngt, m2, m2, m2, ROT0, "Konami", "Hell Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1248 | GAME( 1997, polystar, 0, m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1249 | GAME( 1997, totlvice, 0, m2, m2, m2, ROT0, "Konami", "Total Vice (ver UAC)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1250 | GAME( 1997, totlvicj, totlvice, m2, m2, m2, ROT0, "Konami", "Total Vice (ver JAD)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1251 | //GAME( 1997, totlvica, totlvice, m2, m2, m2, ROT0, "Konami", "Total Vice (ver AAB)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1252 | GAME( 1998, btltryst, 0, m2, m2, m2, ROT0, "Konami", "Battle Tryst (ver JAC)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1253 | GAME( 1998, heatof11, 0, m2, m2, m2, ROT0, "Konami", "Heat of Eleven '98 (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1254 | GAME( 1998, evilngt, 0, m2, m2, m2, ROT0, "Konami", "Evil Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 1255 | GAME( 1998, hellngt, evilngt, m2, m2, m2, ROT0, "Konami", "Hell Night (ver EAA)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r5955 | r5956 | |
|---|---|---|
| 1314 | 1314 | ROM_LOAD( "c21-07.57", 0x00000, 0x08000, CRC(f02292bd) SHA1(0a5c06a048ad67f90e0d766b504582e9eef035f7) ) |
| 1315 | 1315 | ROM_END |
| 1316 | 1316 | |
| 1317 | ROM_START( cadashg ) | |
| 1318 | ROM_REGION( 0x80000, "maincpu", 0 ) /* 512k for 68000 code */ | |
| 1319 | ROM_LOAD16_BYTE( "c21-23-1.12", 0x00000, 0x20000, CRC(30ddbabe) SHA1(f48ea6fe36c4d9fe291232fd7adddb8f3547270f) ) | |
| 1320 | ROM_LOAD16_BYTE( "c21-25-1.16", 0x00001, 0x20000, CRC(24e10611) SHA1(6f406267777dd693a3869ccb34fe3f2f8dea857d) ) | |
| 1321 | ROM_LOAD16_BYTE( "c21-22-1.11", 0x40000, 0x20000, CRC(daf58b2d) SHA1(7a64df848f46f27bb6f9757ce0cc81311c2f172f) ) | |
| 1322 | ROM_LOAD16_BYTE( "c21-24-1.15", 0x40001, 0x20000, CRC(2359b93e) SHA1(9a5ce34dd8667a987ab8b6e6246f0ad032af868f) ) | |
| 1323 | ||
| 1324 | ROM_REGION( 0x80000, "gfx1", 0 ) | |
| 1325 | ROM_LOAD( "c21-02.9", 0x00000, 0x80000, CRC(205883b9) SHA1(5aafee8cab3f949a7db91bcc26912f331041b51e) ) /* SCR tiles (8 x 8) */ | |
| 1326 | ||
| 1327 | ROM_REGION( 0x80000, "gfx2", 0 ) | |
| 1328 | ROM_LOAD( "c21-01.1", 0x00000, 0x80000, CRC(1ff6f39c) SHA1(742f296efc8073fafa73da2c8d7d26ca9514b6bf) ) /* Sprites (16 x 16) */ | |
| 1329 | ||
| 1330 | ROM_REGION( 0x1c000, "audiocpu", 0 ) /* sound cpu */ | |
| 1331 | ROM_LOAD( "c21-08.38", 0x00000, 0x04000, CRC(dca495a0) SHA1(4e0f401f1b967da75f33fd7294860ad0b4bf2dce) ) | |
| 1332 | ROM_CONTINUE( 0x10000, 0x0c000 ) /* banked stuff */ | |
| 1333 | ||
| 1334 | ROM_REGION( 0x08000, "user1", 0 ) /* 2 machine interface mcu rom ? */ | |
| 1335 | ROM_LOAD( "c21-07.57", 0x00000, 0x08000, CRC(f02292bd) SHA1(0a5c06a048ad67f90e0d766b504582e9eef035f7) ) | |
| 1336 | ROM_END | |
| 1337 | ||
| 1317 | 1338 | ROM_START( galmedes ) |
| 1318 | 1339 | ROM_REGION( 0x100000, "maincpu", 0 ) /* 1024k for 68000 code */ |
| 1319 | 1340 | ROM_LOAD16_BYTE( "gm-prg1.bin", 0x00000, 0x20000, CRC(32a70753) SHA1(3bd094b7ae600dbc87ba74e8b2d6b86a68346f4f) ) |
| r5955 | r5956 | |
| 1383 | 1404 | GAME( 1989, cadashu, cadash, cadash, cadashu, 0, ROT0, "Taito America Corporation", "Cadash (US)", 0 ) |
| 1384 | 1405 | GAME( 1989, cadashi, cadash, cadash, cadash, 0, ROT0, "Taito Corporation Japan", "Cadash (Italy)", 0 ) |
| 1385 | 1406 | GAME( 1989, cadashf, cadash, cadash, cadash, 0, ROT0, "Taito Corporation Japan", "Cadash (France)", 0 ) |
| 1407 | GAME( 1989, cadashg, cadash, cadash, cadash, 0, ROT0, "Taito Corporation Japan", "Cadash (Germany)", 0 ) | |
| 1386 | 1408 | GAME( 1992, galmedes, 0, galmedes, galmedes, 0, ROT270, "Visco", "Galmedes (Japan)", GAME_SUPPORTS_SAVE ) |
| 1387 | 1409 | GAME( 1993, earthjkr, 0, galmedes, earthjkr, 0, ROT270, "Visco", "U.N. Defense Force: Earth Joker", GAME_SUPPORTS_SAVE ) |
| 1388 | 1410 | GAME( 1994, eto, 0, eto, eto, 0, ROT0, "Visco", "Kokontouzai Eto Monogatari (Japan)", GAME_SUPPORTS_SAVE ) |
| r5955 | r5956 | |
|---|---|---|
| 46 | 46 | const char *ext; |
| 47 | 47 | FILE *file; |
| 48 | 48 | int bytes; |
| 49 | int col = 0; | |
| 49 | 50 | |
| 50 | 51 | /* print usage info */ |
| 51 | 52 | if (argc != 2) |
| 52 | 53 | { |
| 53 | 54 | printf("Usage:\nsrcclean <file>\n"); |
| 54 | 55 | return 0; |
| 55 | ||
| 56 | ||
| 56 | 57 | |
| 57 | 58 | /* read the file */ |
| 58 | 59 | file = fopen(argv[1], "rb"); |
| r5955 | r5956 | |
| 114 | 115 | /* insert a proper CR/LF */ |
| 115 | 116 | modified[dst++] = 0x0d; |
| 116 | 117 | modified[dst++] = 0x0a; |
| 118 | col = 0; | |
| 117 | 119 | |
| 118 | 120 | /* skip over any LF in the source file */ |
| 119 | 121 | if (original[src] == 0x0a) |
| r5955 | r5956 | |
| 125 | 127 | in_cpp_comment = FALSE; |
| 126 | 128 | } |
| 127 | 129 | |
| 128 | /* if we hit a tab within a comment, expand it */ | |
| 129 | else if (ch == 0x09 && (in_c_comment || in_cpp_comment)) | |
| 130 | /* if we hit a tab... */ | |
| 131 | else if (ch == 0x09) | |
| 130 | 132 | { |
| 131 | int | |
| 133 | int s | |
| 132 | 134 | |
| 133 | /* scan backwards to find the start of line */ | |
| 134 | for (temp = dst; temp >= 0; temp--) | |
| 135 | if (modified[temp] == 0x0a) | |
| 136 | break; | |
| 135 | col += spaces; | |
| 137 | 136 | |
| 138 | /* scan forwards to compute the current column */ | |
| 139 | for (temp++, col = 0; temp < dst; temp++) | |
| 140 | if (modified[temp] == 0x09) | |
| 141 | col += 4 - col % 4; | |
| 142 | else | |
| 143 | col++; | |
| 144 | ||
| 145 | /* compute how many spaces */ | |
| 146 | col = 4 - col % 4; | |
| 147 | while (col--) modified[dst++] = ' '; | |
| 148 | removed_tabs++; | |
| 137 | /* if inside a comment, expand it */ | |
| 138 | if (in_c_comment || in_cpp_comment) | |
| 139 | { | |
| 140 | while (spaces--) modified[dst++] = ' '; | |
| 141 | removed_tabs++; | |
| 142 | } | |
| 143 | else | |
| 144 | { | |
| 145 | modified[dst++] = ch; | |
| 146 | } | |
| 149 | 147 | } |
| 150 | 148 | |
| 151 | 149 | /* otherwise, copy the source character */ |
| 152 | 150 | else |
| 151 | { | |
| 153 | 152 | modified[dst++] = ch; |
| 153 | col++; | |
| 154 | } | |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | 157 | /* if we didn't find an end of comment, we screwed up */ |
| r5955 | r5956 | |
|---|---|---|
| 68 | 68 | { 0, "-fno-strict-aliasing", "/Oa" }, |
| 69 | 69 | { 0, "-fno-omit-frame-pointer", "" }, |
| 70 | 70 | { 0, "-Werror", "/WX" }, |
| 71 | { VS7, "-Wall", "/Wall /W3 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" }, | |
| 71 | { VS7, "-Wall", "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" }, | |
| 72 | 72 | { 0, "-Wall", "/W0" }, |
| 73 | 73 | { VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102" }, |
| 74 | 74 | { 0, "-W*", "" }, |
| r5955 | r5956 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | /* expression handlers */ |
| 101 | 101 | static UINT64 expression_read_memory(void *param, const char *name, int space, UINT32 address, int size); |
| 102 | static UINT64 expression_read_address_space(const address_space *space, offs_t address, int size); | |
| 103 | 102 | static UINT64 expression_read_program_direct(const address_space *space, int opcode, offs_t address, int size); |
| 104 | 103 | static UINT64 expression_read_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size); |
| 105 | 104 | static UINT64 expression_read_eeprom(running_machine *machine, offs_t address, int size); |
| 106 | 105 | static void expression_write_memory(void *param, const char *name, int space, UINT32 address, int size, UINT64 data); |
| 107 | static void expression_write_address_space(const address_space *space, offs_t address, int size, UINT64 data); | |
| 108 | 106 | static void expression_write_program_direct(const address_space *space, int opcode, offs_t address, int size, UINT64 data); |
| 109 | 107 | static void expression_write_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size, UINT64 data); |
| 110 | 108 | static void expression_write_eeprom(running_machine *machine, offs_t address, int size, UINT64 data); |
| r5955 | r5956 | |
| 2459 | 2457 | space |
| 2460 | 2458 | -------------------------------------------------*/ |
| 2461 | 2459 | |
| 2462 | static UINT64 expression_read_memory(void *param, const char *name, int space, UINT32 address, int size) | |
| 2460 | static UINT64 expression_read_memory(void *param, const char *name, int spacenum, UINT32 address, int size) | |
| 2463 | 2461 | { |
| 2464 | 2462 | running_machine *machine = (running_machine *)param; |
| 2463 | UINT64 result = ~(UINT64)0 >> (64 - 8*size); | |
| 2465 | 2464 | const device_config *cpu = NULL; |
| 2465 | const address_space *space; | |
| 2466 | 2466 | |
| 2467 | switch (space) | |
| 2467 | switch (spacenum) | |
| 2468 | 2468 | { |
| 2469 | case EXPSPACE_PROGRAM: | |
| 2470 | case EXPSPACE_DATA: | |
| 2471 | case EXPSPACE_IO: | |
| 2469 | case EXPSPACE_PROGRAM_LOGICAL: | |
| 2470 | case EXPSPACE_DATA_LOGICAL: | |
| 2471 | case EXPSPACE_IO_LOGICAL: | |
| 2472 | case EXPSPACE_SPACE3_LOGICAL: | |
| 2472 | 2473 | if (name != NULL) |
| 2473 | 2474 | cpu = expression_cpu_index(machine, name); |
| 2474 | 2475 | if (cpu == NULL) |
| 2475 | 2476 | cpu = debug_cpu_get_visible_cpu(machine); |
| 2476 | return expression_read_address_space(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)), address, size); | |
| 2477 | space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); | |
| 2478 | if (space != NULL) | |
| 2479 | result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE); | |
| 2480 | break; | |
| 2477 | 2481 | |
| 2482 | case EXPSPACE_PROGRAM_PHYSICAL: | |
| 2483 | case EXPSPACE_DATA_PHYSICAL: | |
| 2484 | case EXPSPACE_IO_PHYSICAL: | |
| 2485 | case EXPSPACE_SPACE3_PHYSICAL: | |
| 2486 | if (name != NULL) | |
| 2487 | cpu = expression_cpu_index(machine, name); | |
| 2488 | if (cpu == NULL) | |
| 2489 | cpu = debug_cpu_get_visible_cpu(machine); | |
| 2490 | space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL)); | |
| 2491 | if (space != NULL) | |
| 2492 | result = debug_read_memory(space, memory_address_to_byte(space, address), size, FALSE); | |
| 2493 | break; | |
| 2494 | ||
| 2478 | 2495 | case EXPSPACE_OPCODE: |
| 2479 | 2496 | case EXPSPACE_RAMWRITE: |
| 2480 | 2497 | if (name != NULL) |
| 2481 | 2498 | cpu = expression_cpu_index(machine, name); |
| 2482 | 2499 | if (cpu == NULL) |
| 2483 | 2500 | cpu = debug_cpu_get_visible_cpu(machine); |
| 2484 | return expression_read_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (space == EXPSPACE_OPCODE), address, size); | |
| 2501 | result = expression_read_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size); | |
| 2502 | break; | |
| 2485 | 2503 | |
| 2486 | 2504 | case EXPSPACE_EEPROM: |
| 2487 | return expression_read_eeprom(machine, address, size); | |
| 2505 | result = expression_read_eeprom(machine, address, size); | |
| 2506 | break; | |
| 2488 | 2507 | |
| 2489 | 2508 | case EXPSPACE_REGION: |
| 2490 | 2509 | if (name == NULL) |
| 2491 | 2510 | break; |
| 2492 | return expression_read_memory_region(machine, name, address, size); | |
| 2511 | result = expression_read_memory_region(machine, name, address, size); | |
| 2512 | break; | |
| 2493 | 2513 | } |
| 2494 | return ~(UINT64)0 >> (64 - 8*size); | |
| 2495 | } | |
| 2496 | ||
| 2497 | ||
| 2498 | /*------------------------------------------------- | |
| 2499 | expression_read_address_space - read memory | |
| 2500 | from a specific CPU's address space | |
| 2501 | -------------------------------------------------*/ | |
| 2502 | ||
| 2503 | static UINT64 expression_read_address_space(const address_space *space, offs_t address, int size) | |
| 2504 | { | |
| 2505 | UINT64 result = ~(UINT64)0 >> (64 - 8*size); | |
| 2506 | ||
| 2507 | if (space != NULL) | |
| 2508 | result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE); | |
| 2509 | 2514 | return result; |
| 2510 | 2515 | } |
| 2511 | 2516 | |
| r5955 | r5956 | |
| 2652 | 2657 | space |
| 2653 | 2658 | -------------------------------------------------*/ |
| 2654 | 2659 | |
| 2655 | static void expression_write_memory(void *param, const char *name, int space, UINT32 address, int size, UINT64 data) | |
| 2660 | static void expression_write_memory(void *param, const char *name, int spacenum, UINT32 address, int size, UINT64 data) | |
| 2656 | 2661 | { |
| 2657 | 2662 | running_machine *machine = (running_machine *)param; |
| 2658 | 2663 | const device_config *cpu = NULL; |
| 2664 | const address_space *space; | |
| 2659 | 2665 | |
| 2660 | switch (space) | |
| 2666 | switch (spacenum) | |
| 2661 | 2667 | { |
| 2662 | case EXPSPACE_PROGRAM: | |
| 2663 | case EXPSPACE_DATA: | |
| 2664 | case EXPSPACE_IO: | |
| 2668 | case EXPSPACE_PROGRAM_LOGICAL: | |
| 2669 | case EXPSPACE_DATA_LOGICAL: | |
| 2670 | case EXPSPACE_IO_LOGICAL: | |
| 2671 | case EXPSPACE_SPACE3_LOGICAL: | |
| 2665 | 2672 | if (name != NULL) |
| 2666 | 2673 | cpu = expression_cpu_index(machine, name); |
| 2667 | 2674 | if (cpu == NULL) |
| 2668 | 2675 | cpu = debug_cpu_get_visible_cpu(machine); |
| 2669 | expression_write_address_space(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)), address, size, data); | |
| 2676 | space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); | |
| 2677 | if (space != NULL) | |
| 2678 | debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE); | |
| 2670 | 2679 | break; |
| 2671 | 2680 | |
| 2681 | case EXPSPACE_PROGRAM_PHYSICAL: | |
| 2682 | case EXPSPACE_DATA_PHYSICAL: | |
| 2683 | case EXPSPACE_IO_PHYSICAL: | |
| 2684 | case EXPSPACE_SPACE3_PHYSICAL: | |
| 2685 | if (name != NULL) | |
| 2686 | cpu = expression_cpu_index(machine, name); | |
| 2687 | if (cpu == NULL) | |
| 2688 | cpu = debug_cpu_get_visible_cpu(machine); | |
| 2689 | space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL)); | |
| 2690 | if (space != NULL) | |
| 2691 | debug_write_memory(space, memory_address_to_byte(space, address), data, size, FALSE); | |
| 2692 | break; | |
| 2693 | ||
| 2672 | 2694 | case EXPSPACE_OPCODE: |
| 2673 | 2695 | case EXPSPACE_RAMWRITE: |
| 2674 | 2696 | if (name != NULL) |
| 2675 | 2697 | cpu = expression_cpu_index(machine, name); |
| 2676 | 2698 | if (cpu == NULL) |
| 2677 | 2699 | cpu = debug_cpu_get_visible_cpu(machine); |
| 2678 | expression_write_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (space == EXPSPACE_OPCODE), address, size, data); | |
| 2700 | expression_write_program_direct(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data); | |
| 2679 | 2701 | break; |
| 2680 | 2702 | |
| 2681 | 2703 | case EXPSPACE_EEPROM: |
| r5955 | r5956 | |
| 2692 | 2714 | |
| 2693 | 2715 | |
| 2694 | 2716 | /*------------------------------------------------- |
| 2695 | expression_write_address_space - write memory | |
| 2696 | to a specific CPU's address space | |
| 2697 | -------------------------------------------------*/ | |
| 2698 | ||
| 2699 | static void expression_write_address_space(const address_space *space, offs_t address, int size, UINT64 data) | |
| 2700 | { | |
| 2701 | if (space != NULL) | |
| 2702 | debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE); | |
| 2703 | } | |
| 2704 | ||
| 2705 | ||
| 2706 | /*------------------------------------------------- | |
| 2707 | 2717 | expression_write_program_direct - write memory |
| 2708 | 2718 | directly to an opcode or RAM pointer |
| 2709 | 2719 | -------------------------------------------------*/ |
| r5955 | r5956 | |
| 2879 | 2889 | |
| 2880 | 2890 | switch (space) |
| 2881 | 2891 | { |
| 2882 | case EXPSPACE_PROGRAM: | |
| 2883 | case EXPSPACE_DATA: | |
| 2884 | case EXPSPACE_IO: | |
| 2892 | case EXPSPACE_PROGRAM_LOGICAL: | |
| 2893 | case EXPSPACE_DATA_LOGICAL: | |
| 2894 | case EXPSPACE_IO_LOGICAL: | |
| 2895 | case EXPSPACE_SPACE3_LOGICAL: | |
| 2885 | 2896 | if (name != NULL) |
| 2886 | 2897 | { |
| 2887 | 2898 | cpu = expression_cpu_index(machine, name); |
| r5955 | r5956 | |
| 2890 | 2901 | } |
| 2891 | 2902 | if (cpu == NULL) |
| 2892 | 2903 | cpu = debug_cpu_get_visible_cpu(machine); |
| 2893 | if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM)) == NULL) | |
| 2904 | if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL)) == NULL) | |
| 2894 | 2905 | return EXPRERR_NO_SUCH_MEMORY_SPACE; |
| 2895 | 2906 | break; |
| 2896 | 2907 | |
| 2908 | case EXPSPACE_PROGRAM_PHYSICAL: | |
| 2909 | case EXPSPACE_DATA_PHYSICAL: | |
| 2910 | case EXPSPACE_IO_PHYSICAL: | |
| 2911 | case EXPSPACE_SPACE3_PHYSICAL: | |
| 2912 | if (name != NULL) | |
| 2913 | { | |
| 2914 | cpu = expression_cpu_index(machine, name); | |
| 2915 | if (cpu == NULL) | |
| 2916 | return EXPRERR_INVALID_MEMORY_NAME; | |
| 2917 | } | |
| 2918 | if (cpu == NULL) | |
| 2919 | cpu = debug_cpu_get_visible_cpu(machine); | |
| 2920 | if (cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL)) == NULL) | |
| 2921 | return EXPRERR_NO_SUCH_MEMORY_SPACE; | |
| 2922 | break; | |
| 2923 | ||
| 2897 | 2924 | case EXPSPACE_OPCODE: |
| 2898 | 2925 | case EXPSPACE_RAMWRITE: |
| 2899 | 2926 | if (name != NULL) |
| r5955 | r5956 | |
|---|---|---|
| 47 | 47 | #define EXPRERR_MISSING_MEMORY_NAME (19) |
| 48 | 48 | |
| 49 | 49 | /* values for the address space passed to external_read/write_memory */ |
| 50 | #define EXPSPACE_PROGRAM (0) | |
| 51 | #define EXPSPACE_DATA (1) | |
| 52 | #define EXPSPACE_IO (2) | |
| 53 | #define EXPSPACE_OPCODE (3) | |
| 54 | #define EXPSPACE_RAMWRITE (4) | |
| 55 | #define EXPSPACE_EEPROM (5) | |
| 56 | #define EXPSPACE_REGION (6) | |
| 50 | #define EXPSPACE_PROGRAM_LOGICAL (0) | |
| 51 | #define EXPSPACE_DATA_LOGICAL (1) | |
| 52 | #define EXPSPACE_IO_LOGICAL (2) | |
| 53 | #define EXPSPACE_SPACE3_LOGICAL (3) | |
| 54 | #define EXPSPACE_PROGRAM_PHYSICAL (4) | |
| 55 | #define EXPSPACE_DATA_PHYSICAL (5) | |
| 56 | #define EXPSPACE_IO_PHYSICAL (6) | |
| 57 | #define EXPSPACE_SPACE3_PHYSICAL (7) | |
| 58 | #define EXPSPACE_OPCODE (8) | |
| 59 | #define EXPSPACE_RAMWRITE (9) | |
| 60 | #define EXPSPACE_EEPROM (10) | |
| 61 | #define EXPSPACE_REGION (11) | |
| 57 | 62 | |
| 58 | 63 | |
| 59 | 64 |
| r5955 | r5956 | |
|---|---|---|
| 41 | 41 | UINT32 size; |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | ||
| 44 | 45 | typedef struct _cheat_map cheat_map; |
| 45 | 46 | struct _cheat_map |
| 46 | 47 | { |
| r5955 | r5956 | |
| 51 | 52 | UINT8 undo:7; |
| 52 | 53 | }; |
| 53 | 54 | |
| 55 | ||
| 54 | 56 | typedef struct _cheat_system cheat_system; |
| 55 | 57 | struct _cheat_system |
| 56 | 58 | { |
| 57 | char cpu; | |
| 58 | UINT64 length; | |
| 59 | UINT8 width; | |
| 60 | cheat_map * cheatmap; | |
| 61 | UINT8 undo; | |
| 62 | UINT8 signed_cheat; | |
| 63 | UINT8 swapped_cheat; | |
| 59 | char cpu; | |
| 60 | UINT64 length; | |
| 61 | UINT8 width; | |
| 62 | cheat_map * cheatmap; | |
| 63 | UINT8 undo; | |
| 64 | UINT8 signed_cheat; | |
| 65 | UINT8 swapped_cheat; | |
| 64 | 66 | }; |
| 65 | 67 | |
| 66 | 68 | |
| 69 | typedef struct _cheat_region_map cheat_region_map; | |
| 70 | struct _cheat_region_map | |
| 71 | { | |
| 72 | UINT64 offset; | |
| 73 | UINT64 endoffset; | |
| 74 | UINT8 share; | |
| 75 | UINT8 disabled; | |
| 76 | }; | |
| 77 | ||
| 78 | ||
| 79 | ||
| 67 | 80 | /*************************************************************************** |
| 68 | 81 | GLOBAL VARIABLES |
| 69 | 82 | ***************************************************************************/ |
| r5955 | r5956 | |
| 1708 | 1721 | |
| 1709 | 1722 | static void execute_cheatinit(running_machine *machine, int ref, int params, const char *param[]) |
| 1710 | 1723 | { |
| 1711 | UINT64 offset, | |
| 1724 | UINT64 offset, | |
| 1712 | 1725 | const address_space *space; |
| 1713 | 1726 | UINT32 active_cheat = 0; |
| 1714 | 1727 | UINT64 curaddr; |
| 1728 | UINT8 i, region_count = 0; | |
| 1715 | 1729 | |
| 1730 | address_map_entry *entry; | |
| 1731 | cheat_region_map cheat_region[100]; | |
| 1732 | ||
| 1733 | memset(cheat_region, 0, sizeof(cheat_region)); | |
| 1734 | ||
| 1716 | 1735 | /* validate parameters */ |
| 1717 | 1736 | if (!debug_command_parameter_cpu_space(machine, (params > 3) ? param[3] : NULL, ADDRESS_SPACE_PROGRAM, &space)) |
| 1718 | 1737 | return; |
| 1719 | 1738 | |
| 1720 | 1739 | if (ref == 0) |
| 1721 | 1740 | { |
| 1741 | cheat.width = 1; | |
| 1742 | cheat.signed_cheat = FALSE; | |
| 1743 | cheat.swapped_cheat = FALSE; | |
| 1722 | 1744 | if (params > 0) |
| 1723 | 1745 | { |
| 1724 | 1746 | char *srtpnt = (char*)param[0]; |
| r5955 | r5956 | |
| 1752 | 1774 | else |
| 1753 | 1775 | cheat.swapped_cheat = FALSE; |
| 1754 | 1776 | } |
| 1755 | else | |
| 1777 | } | |
| 1778 | ||
| 1779 | /* initialize entire memory by default */ | |
| 1780 | if (params <= 1) | |
| 1781 | { | |
| 1782 | offset = 0; | |
| 1783 | length = space->bytemask + 1; | |
| 1784 | for (entry = space->map->entrylist; entry != NULL; entry = entry->next) | |
| 1756 | 1785 | { |
| 1757 | cheat.width = 1; | |
| 1758 | cheat.signed_cheat = FALSE; | |
| 1759 | cheat.swapped_cheat = FALSE; | |
| 1786 | cheat_region[region_count].offset = memory_address_to_byte(space, entry->addrstart) & space->bytemask; | |
| 1787 | cheat_region[region_count].endoffset = memory_address_to_byte(space, entry->addrend) & space->bytemask; | |
| 1788 | cheat_region[region_count].share = entry->share; | |
| 1789 | cheat_region[region_count].disabled = (entry->write.shandler8 == SMH_RAM) ? FALSE : TRUE; | |
| 1790 | ||
| 1791 | /* disable double share regions */ | |
| 1792 | if (entry->share != 0) | |
| 1793 | for (i = 0; i < region_count; i++) | |
| 1794 | if (cheat_region[i].share == entry->share) | |
| 1795 | cheat_region[region_count].disabled = TRUE; | |
| 1796 | ||
| 1797 | region_count++; | |
| 1760 | 1798 | } |
| 1761 | 1799 | } |
| 1762 | ||
| 1763 | if (params > 1) | |
| 1800 | else | |
| 1764 | 1801 | { |
| 1802 | /* validate parameters */ | |
| 1765 | 1803 | if (!debug_command_parameter_number(machine, param[(ref == 0) ? 1 : 0], &offset)) |
| 1766 | 1804 | return; |
| 1767 | 1805 | if (!debug_command_parameter_number(machine, param[(ref == 0) ? 2 : 1], &length)) |
| 1768 | 1806 | return; |
| 1807 | ||
| 1808 | /* force region to the specified range */ | |
| 1809 | cheat_region[region_count].offset = memory_address_to_byte(space, offset) & space->bytemask;; | |
| 1810 | cheat_region[region_count].endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;; | |
| 1811 | cheat_region[region_count].share = 0; | |
| 1812 | cheat_region[region_count].disabled = FALSE; | |
| 1813 | region_count++; | |
| 1769 | 1814 | } |
| 1770 | else | |
| 1771 | { | |
| 1772 | /* initialize entire memory */ | |
| 1773 | offset = 0; | |
| 1774 | length = space->bytemask + 1; | |
| 1775 | } | |
| 1776 | 1815 | |
| 1777 | endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask; | |
| 1778 | offset = memory_address_to_byte(space, offset) & space->bytemask; | |
| 1816 | /* determine the writable extent of each region in total */ | |
| 1817 | for (i = 0; i <= region_count; i++) | |
| 1818 | if (!cheat_region[i].disabled) | |
| 1819 | for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width) | |
| 1820 | if (cheat_address_is_valid(space, curaddr)) | |
| 1821 | real_length++; | |
| 1779 | 1822 | |
| 1780 | /* counts the writable bytes in the area */ | |
| 1781 | for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width) | |
| 1782 | if (cheat_address_is_valid(space, curaddr)) | |
| 1783 | real_length++; | |
| 1784 | ||
| 1785 | 1823 | if (real_length == 0) |
| 1786 | 1824 | { |
| 1787 | 1825 | debug_console_printf(machine, "No writable bytes found in this area\n"); |
| r5955 | r5956 | |
| 1831 | 1869 | } |
| 1832 | 1870 | |
| 1833 | 1871 | /* initialize cheatmap in the selected space */ |
| 1834 | for (curaddr = offset; curaddr <= endoffset; curaddr += cheat.width) | |
| 1835 | if (cheat_address_is_valid(space, curaddr)) | |
| 1836 | { | |
| 1837 | cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, space, curaddr); | |
| 1838 | cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value; | |
| 1839 | cheat.cheatmap[active_cheat].offset = curaddr; | |
| 1840 | cheat.cheatmap[active_cheat].state = 1; | |
| 1841 | cheat.cheatmap[active_cheat].undo = 0; | |
| 1842 | active_cheat++; | |
| 1843 | } | |
| 1872 | for (i = 0; i < region_count; i++) | |
| 1873 | if (!cheat_region[i].disabled) | |
| 1874 | for (curaddr = cheat_region[i].offset; curaddr <= cheat_region[i].endoffset; curaddr += cheat.width) | |
| 1875 | if (cheat_address_is_valid(space, curaddr)) | |
| 1876 | { | |
| 1877 | cheat.cheatmap[active_cheat].previous_value = cheat_read_extended(&cheat, space, curaddr); | |
| 1878 | cheat.cheatmap[active_cheat].first_value = cheat.cheatmap[active_cheat].previous_value; | |
| 1879 | cheat.cheatmap[active_cheat].offset = curaddr; | |
| 1880 | cheat.cheatmap[active_cheat].state = 1; | |
| 1881 | cheat.cheatmap[active_cheat].undo = 0; | |
| 1882 | active_cheat++; | |
| 1883 | } | |
| 1844 | 1884 | |
| 1845 | 1885 | debug_console_printf(machine, "%u cheat initialized\n", active_cheat); |
| 1846 | 1886 | } |
| r5955 | r5956 | |
| 2067 | 2107 | active_cheat++; |
| 2068 | 2108 | fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2)); |
| 2069 | 2109 | fprintf(f, " <script state=\"run\">\n"); |
| 2070 | fprintf(f, " <action>%s.%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2)); | |
| 2110 | fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2)); | |
| 2071 | 2111 | fprintf(f, " </script>\n"); |
| 2072 | 2112 | fprintf(f, " </cheat>\n\n"); |
| 2073 | 2113 | } |
| r5955 | r5956 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | /*************************************************************************** |
| 68 | FUNCTION PROTOTYPES | |
| 69 | ***************************************************************************/ | |
| 68 | 70 | |
| 71 | static void debug_console_exit(running_machine *machine); | |
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | /*************************************************************************** | |
| 76 | ||
| 69 | 77 | Initialization and tear down |
| 70 | 78 | |
| 71 | 79 | ***************************************************************************/ |
| r5955 | r5956 | |
| 100 | 108 | system |
| 101 | 109 | -------------------------------------------------*/ |
| 102 | 110 | |
| 103 | void debug_console_exit(running_machine *machine) | |
| 111 | static void debug_console_exit(running_machine *machine) | |
| 104 | 112 | { |
| 105 | 113 | /* free allocated memory */ |
| 106 | 114 | if (console_textbuf) |
| r5955 | r5956 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | TIN_MEMORY_SPACE_SHIFT = 12, |
| 83 | 83 | TIN_MEMORY_SPACE_MASK = (0xf << TIN_MEMORY_SPACE_SHIFT), |
| 84 | TIN_MEMORY_PROGRAM = (EXPSPACE_PROGRAM << TIN_MEMORY_SPACE_SHIFT), | |
| 85 | TIN_MEMORY_DATA = (EXPSPACE_DATA << TIN_MEMORY_SPACE_SHIFT), | |
| 86 | TIN_MEMORY_IO = (EXPSPACE_IO << TIN_MEMORY_SPACE_SHIFT), | |
| 87 | TIN_MEMORY_OPCODE = (EXPSPACE_OPCODE << TIN_MEMORY_SPACE_SHIFT), | |
| 88 | TIN_MEMORY_RAMWRITE = (EXPSPACE_RAMWRITE << TIN_MEMORY_SPACE_SHIFT), | |
| 89 | TIN_MEMORY_EEPROM = (EXPSPACE_EEPROM << TIN_MEMORY_SPACE_SHIFT), | |
| 90 | TIN_MEMORY_REGION = (EXPSPACE_REGION << TIN_MEMORY_SPACE_SHIFT), | |
| 84 | TIN_MEMORY_PROGRAM_LOG = (EXPSPACE_PROGRAM_LOGICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 85 | TIN_MEMORY_DATA_LOG = (EXPSPACE_DATA_LOGICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 86 | TIN_MEMORY_IO_LOG = (EXPSPACE_IO_LOGICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 87 | TIN_MEMORY_SPACE3_LOG = (EXPSPACE_SPACE3_LOGICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 88 | TIN_MEMORY_PROGRAM_PHYS = (EXPSPACE_PROGRAM_PHYSICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 89 | TIN_MEMORY_DATA_PHYS = (EXPSPACE_DATA_PHYSICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 90 | TIN_MEMORY_IO_PHYS = (EXPSPACE_IO_PHYSICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 91 | TIN_MEMORY_SPACE3_PHYS = (EXPSPACE_SPACE3_PHYSICAL << TIN_MEMORY_SPACE_SHIFT), | |
| 92 | TIN_MEMORY_OPCODE = (EXPSPACE_OPCODE << TIN_MEMORY_SPACE_SHIFT), | |
| 93 | TIN_MEMORY_RAMWRITE = (EXPSPACE_RAMWRITE << TIN_MEMORY_SPACE_SHIFT), | |
| 94 | TIN_MEMORY_EEPROM = (EXPSPACE_EEPROM << TIN_MEMORY_SPACE_SHIFT), | |
| 95 | TIN_MEMORY_REGION = (EXPSPACE_REGION << TIN_MEMORY_SPACE_SHIFT), | |
| 91 | 96 | |
| 92 | 97 | TIN_MEMORY_INDEX_SHIFT = 16, |
| 93 | 98 | TIN_MEMORY_INDEX_MASK = (0xffff << TIN_MEMORY_INDEX_SHIFT) |
| r5955 | r5956 | |
| 525 | 530 | const char *startbuffer = buffer; |
| 526 | 531 | const char *namestring = NULL; |
| 527 | 532 | int space = 'p', size; |
| 533 | int physical = FALSE; | |
| 528 | 534 | const char *dot; |
| 529 | 535 | int length; |
| 530 | 536 | |
| r5955 | r5956 | |
| 543 | 549 | buffer = dot + 1; |
| 544 | 550 | } |
| 545 | 551 | |
| 546 | /* length | |
| 552 | /* length 3 means logical/physical, then space, then size */ | |
| 547 | 553 | length = (int)strlen(buffer); |
| 548 | if (length == | |
| 554 | if (length == 3) | |
| 549 | 555 | { |
| 556 | if (buffer[0] != 'l' && buffer[0] != 'p') | |
| 557 | return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer)); | |
| 558 | if (buffer[1] != 'p' && buffer[1] != 'd' && buffer[1] != 'i' && buffer[1] != '3') | |
| 559 | return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer)); | |
| 560 | physical = (buffer[0] == 'p'); | |
| 561 | space = buffer[1]; | |
| 562 | size = buffer[2]; | |
| 563 | } | |
| 564 | ||
| 565 | /* length 2 means space then size */ | |
| 566 | else if (length == 2) | |
| 567 | { | |
| 550 | 568 | space = buffer[0]; |
| 551 | 569 | size = buffer[1]; |
| 552 | 570 | } |
| r5955 | r5956 | |
| 562 | 580 | /* convert the space to flags */ |
| 563 | 581 | switch (space) |
| 564 | 582 | { |
| 565 | case 'p': *flags |= TIN_MEMORY_PROGRAM; break; | |
| 566 | case 'd': *flags |= TIN_MEMORY_DATA; break; | |
| 567 | case 'i': *flags |= TIN_MEMORY_IO; break; | |
| 568 | case 'o': *flags |= TIN_MEMORY_OPCODE; break; | |
| 569 | case 'r': *flags |= TIN_MEMORY_RAMWRITE; break; | |
| 570 | case 'e': *flags |= TIN_MEMORY_EEPROM; break; | |
| 571 | case 'm': *flags |= TIN_MEMORY_REGION; break; | |
| 583 | case 'p': *flags |= physical ? TIN_MEMORY_PROGRAM_PHYS : TIN_MEMORY_PROGRAM_LOG; break; | |
| 584 | case 'd': *flags |= physical ? TIN_MEMORY_DATA_PHYS : TIN_MEMORY_DATA_LOG; break; | |
| 585 | case 'i': *flags |= physical ? TIN_MEMORY_IO_PHYS : TIN_MEMORY_IO_LOG; break; | |
| 586 | case '3': *flags |= physical ? TIN_MEMORY_SPACE3_PHYS : TIN_MEMORY_SPACE3_LOG; break; | |
| 587 | case 'o': *flags |= TIN_MEMORY_OPCODE; break; | |
| 588 | case 'r': *flags |= TIN_MEMORY_RAMWRITE; break; | |
| 589 | case 'e': *flags |= TIN_MEMORY_EEPROM; break; | |
| 590 | case 'm': *flags |= TIN_MEMORY_REGION; break; | |
| 572 | 591 | default: return MAKE_EXPRERR_INVALID_MEMORY_SPACE(offset + (buffer - startbuffer)); |
| 573 | 592 | } |
| 574 | 593 |
| r5955 | r5956 | |
|---|---|---|
| 77 | 77 | |
| 78 | 78 | /* initialization */ |
| 79 | 79 | void debug_console_init(running_machine *machine); |
| 80 | void debug_console_exit(running_machine *machine); | |
| 81 | 80 | |
| 82 | 81 | /* command handling */ |
| 83 | 82 | CMDERR debug_console_execute_command(running_machine *machine, const char *command, int echo); |
| r5955 | r5956 | |
|---|---|---|
| 653 | 653 | { |
| 654 | 654 | switch (state) |
| 655 | 655 | { |
| 656 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = | |
| 656 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3007_internal_map); break; | |
| 657 | 657 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(h8_3007); break; |
| 658 | 658 | case DEVINFO_STR_NAME: strcpy(info->s, "H8/3007"); break; |
| 659 | 659 | default: |
| r5955 | r5956 | |
|---|---|---|
| 747 | 747 | case CPUINFO_INT_ADDRBUS_SHIFT_IO: info->i = 0; break; |
| 748 | 748 | |
| 749 | 749 | // Internal maps |
| 750 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = | |
| 750 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(h8_3334_internal_map); break; | |
| 751 | 751 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = NULL; break; |
| 752 | 752 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO: info->internal_map16 = NULL; break; |
| 753 | 753 |
| r5955 | r5956 | |
|---|---|---|
| 26 | 26 | M68K_CPU_TYPE_68010, |
| 27 | 27 | M68K_CPU_TYPE_68EC020, |
| 28 | 28 | M68K_CPU_TYPE_68020, |
| 29 | M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */ | |
| 29 | M68K_CPU_TYPE_68EC030, | |
| 30 | M68K_CPU_TYPE_68030, | |
| 31 | M68K_CPU_TYPE_68EC040, | |
| 30 | 32 | M68K_CPU_TYPE_68040, |
| 31 | 33 | M68K_CPU_TYPE_SCC68070 |
| 32 | 34 | }; |
| r5955 | r5956 | |
| 74 | 76 | CPU_GET_INFO( m68010 ); |
| 75 | 77 | CPU_GET_INFO( m68ec020 ); |
| 76 | 78 | CPU_GET_INFO( m68020 ); |
| 79 | CPU_GET_INFO( m68ec030 ); | |
| 80 | CPU_GET_INFO( m68030 ); | |
| 81 | CPU_GET_INFO( m68ec040 ); | |
| 77 | 82 | CPU_GET_INFO( m68040 ); |
| 78 | 83 | |
| 79 | 84 | CPU_GET_INFO( scc68070 ); |
| r5955 | r5956 | |
| 83 | 88 | #define CPU_M68010 CPU_GET_INFO_NAME( m68010 ) |
| 84 | 89 | #define CPU_M68EC020 CPU_GET_INFO_NAME( m68ec020 ) |
| 85 | 90 | #define CPU_M68020 CPU_GET_INFO_NAME( m68020 ) |
| 91 | #define CPU_M68EC030 CPU_GET_INFO_NAME( m68ec030 ) | |
| 92 | #define CPU_M68030 CPU_GET_INFO_NAME( m68030 ) | |
| 93 | #define CPU_M68EC040 CPU_GET_INFO_NAME( m68ec040 ) | |
| 86 | 94 | #define CPU_M68040 CPU_GET_INFO_NAME( m68040 ) |
| 87 | 95 | |
| 88 | 96 | #define CPU_SCC68070 CPU_GET_INFO_NAME( scc68070 ) |
| r5955 | r5956 | |
|---|---|---|
| 73 | 73 | #define FUNCTION_CODE_CPU_SPACE 7 |
| 74 | 74 | |
| 75 | 75 | /* CPU types for deciding what to emulate */ |
| 76 | #define CPU_TYPE_000 1 | |
| 77 | #define CPU_TYPE_008 2 | |
| 78 | #define CPU_TYPE_010 4 | |
| 79 | #define CPU_TYPE_EC020 8 | |
| 80 | #define CPU_TYPE_020 16 | |
| 81 | #define CPU_TYPE_040 32 | |
| 82 | #define CPU_TYPE_060 64 | |
| 83 | #define CPU_TYPE_SCC070 128 | |
| 76 | #define CPU_TYPE_000 (0x00000001) | |
| 77 | #define CPU_TYPE_008 (0x00000002) | |
| 78 | #define CPU_TYPE_010 (0x00000004) | |
| 79 | #define CPU_TYPE_EC020 (0x00000008) | |
| 80 | #define CPU_TYPE_020 (0x00000010) | |
| 81 | #define CPU_TYPE_EC030 (0x00000020) | |
| 82 | #define CPU_TYPE_030 (0x00000040) | |
| 83 | #define CPU_TYPE_EC040 (0x00000080) | |
| 84 | #define CPU_TYPE_040 (0x00000100) | |
| 85 | #define CPU_TYPE_SCC070 (0x00000200) | |
| 84 | 86 | |
| 85 | 87 | /* Different ways to stop the CPU */ |
| 86 | 88 | #define STOP_LEVEL_STOP 1 |
| r5955 | r5956 | |
| 217 | 219 | /* These defines are dependant on the configuration defines in m68kconf.h */ |
| 218 | 220 | |
| 219 | 221 | /* Disable certain comparisons if we're not using all CPU types */ |
| 220 | #define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040) | |
| 222 | #define CPU_TYPE_IS_040_PLUS(A) ((A) & (CPU_TYPE_040 | CPU_TYPE_EC040)) | |
| 221 | 223 | #define CPU_TYPE_IS_040_LESS(A) 1 |
| 222 | 224 | |
| 223 | #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040)) | |
| 225 | #define CPU_TYPE_IS_030_PLUS(A) ((A) & (CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)) | |
| 226 | #define CPU_TYPE_IS_030_LESS(A) 1 | |
| 227 | ||
| 228 | #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)) | |
| 224 | 229 | #define CPU_TYPE_IS_020_LESS(A) 1 |
| 225 | 230 | |
| 226 | 231 | #define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020)) |
| 227 | 232 | |
| 228 | #define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) | |
| 233 | #define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040)) | |
| 229 | 234 | #define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020)) |
| 230 | 235 | |
| 231 | 236 | #define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010) |
| 232 | #define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) | |
| 233 | #define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_SCC070)) | |
| 237 | #define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_040 | CPU_TYPE_EC040)) | |
| 238 | #define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010)) | |
| 234 | 239 | |
| 235 | 240 | #define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008) |
| 236 | 241 | |
| r5955 | r5956 | |
| 542 | 547 | |
| 543 | 548 | struct _m68ki_cpu_core |
| 544 | 549 | { |
| 545 | UINT32 cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 680 | |
| 550 | UINT32 cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, 68020, 68EC030, 68030, 68EC040, or 68040 */ | |
| 546 | 551 | UINT32 dasm_type; /* disassembly type */ |
| 547 | 552 | UINT32 dar[16]; /* Data and Address Registers */ |
| 548 | 553 | UINT32 ppc; /* Previous program counter */ |
| r5955 | r5956 | |
| 575 | 580 | UINT32 sr_mask; /* Implemented status register bits */ |
| 576 | 581 | UINT32 instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ |
| 577 | 582 | UINT32 run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ |
| 583 | int has_pmmu; /* Indicates if a PMMU available (yes on 030, 040, no on EC030) */ | |
| 578 | 584 | |
| 579 | 585 | /* Clocks required for instructions / exceptions */ |
| 580 | 586 | UINT32 cyc_bcc_notake_b; |
| r5955 | r5956 | |
|---|---|---|
| 3 | 3 | /* ======================================================================== */ |
| 4 | 4 | /* |
| 5 | 5 | * MUSASHI |
| 6 | * Version | |
| 6 | * Version 4.10 | |
| 7 | 7 | * |
| 8 | 8 | * A portable Motorola M680x0 processor emulation engine. |
| 9 | 9 | * Copyright Karl Stenerud. All rights reserved. |
| r5955 | r5956 | |
| 16 | 16 | * (Karl Stenerud). |
| 17 | 17 | * |
| 18 | 18 | * The latest version of this code can be obtained at: |
| 19 | * http://kstenerud.cjb.net | |
| 19 | * http://kstenerud.cjb.net or http://mamedev.org/ | |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | /* |
| 23 | 23 | * Modified For OpenVMS By: Robert Alan Byer |
| 24 | 24 | * byer@mail.ourservers.net |
| 25 | * | |
| 26 | * 68030 and PMMU by R. Belmont | |
| 27 | * 68040 and FPU by Ville Linde | |
| 25 | 28 | */ |
| 26 | 29 | |
| 27 | 30 | |
| r5955 | r5956 | |
| 52 | 55 | */ |
| 53 | 56 | |
| 54 | 57 | |
| 55 | static const char g_version[] = " | |
| 58 | static const char g_version[] = "4.10"; | |
| 56 | 59 | |
| 57 | 60 | /* ======================================================================== */ |
| 58 | 61 | /* =============================== INCLUDES =============================== */ |
| r5955 | r5956 | |
| 132 | 135 | CPU_TYPE_000 = 0, |
| 133 | 136 | CPU_TYPE_010, |
| 134 | 137 | CPU_TYPE_020, |
| 138 | CPU_TYPE_030, | |
| 135 | 139 | CPU_TYPE_040, |
| 136 | 140 | NUM_CPUS |
| 137 | 141 | }; |
| r5955 | r5956 | |
| 182 | 186 | char ea_allowed[EA_ALLOWED_LENGTH]; /* Effective addressing modes allowed */ |
| 183 | 187 | char cpu_mode[NUM_CPUS]; /* User or supervisor mode */ |
| 184 | 188 | char cpus[NUM_CPUS+1]; /* Allowed CPUs */ |
| 185 | unsigned char cycles[NUM_CPUS]; /* cycles for 000, 010, 020 */ | |
| 189 | unsigned char cycles[NUM_CPUS]; /* cycles for 000, 010, 020, 030, 040 */ | |
| 186 | 190 | } opcode_struct; |
| 187 | 191 | |
| 188 | 192 | |
| r5955 | r5956 | |
| 313 | 317 | }; |
| 314 | 318 | |
| 315 | 319 | /* Extra cycles required for certain EA modes */ |
| 316 | /* TODO: correct timings for 040 */ | |
| 320 | /* TODO: correct timings for 030, 040 */ | |
| 317 | 321 | static const int g_ea_cycle_table[13][NUM_CPUS][3] = |
| 318 | {/* 000 010 020 040 */ | |
| 319 | {{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}}, /* EA_MODE_NONE */ | |
| 320 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AI */ | |
| 321 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_PI */ | |
| 322 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_PI7 */ | |
| 323 | {{ 0, 6, 10}, { 0, 6, 10}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PD */ | |
| 324 | {{ 0, 6, 10}, { 0, 6, 10}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PD7 */ | |
| 325 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_DI */ | |
| 326 | {{ 0, 10, 14}, { 0, 10, 14}, { 0, 7, 7}, { 0, 7, 7}}, /* EA_MODE_IX */ | |
| 327 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AW */ | |
| 328 | {{ 0, 12, 16}, { 0, 12, 16}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AL */ | |
| 329 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PCDI */ | |
| 330 | {{ 0, 10, 14}, { 0, 10, 14}, { 0, 7, 7}, { 0, 7, 7}}, /* EA_MODE_PCIX */ | |
| 331 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 2, 4}, { 0, 2, 4}}, /* EA_MODE_I */ | |
| 322 | {/* 000 010 020 030 040 */ | |
| 323 | {{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}}, /* EA_MODE_NONE */ | |
| 324 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AI */ | |
| 325 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_PI */ | |
| 326 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_PI7 */ | |
| 327 | {{ 0, 6, 10}, { 0, 6, 10}, { 0, 5, 5}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PD */ | |
| 328 | {{ 0, 6, 10}, { 0, 6, 10}, { 0, 5, 5}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PD7 */ | |
| 329 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 5, 5}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_DI */ | |
| 330 | {{ 0, 10, 14}, { 0, 10, 14}, { 0, 7, 7}, { 0, 7, 7}, { 0, 7, 7}}, /* EA_MODE_IX */ | |
| 331 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 4, 4}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AW */ | |
| 332 | {{ 0, 12, 16}, { 0, 12, 16}, { 0, 4, 4}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AL */ | |
| 333 | {{ 0, 8, 12}, { 0, 8, 12}, { 0, 5, 5}, { 0, 5, 5}, { 0, 5, 5}}, /* EA_MODE_PCDI */ | |
| 334 | {{ 0, 10, 14}, { 0, 10, 14}, { 0, 7, 7}, { 0, 7, 7}, { 0, 7, 7}}, /* EA_MODE_PCIX */ | |
| 335 | {{ 0, 4, 8}, { 0, 4, 8}, { 0, 2, 4}, { 0, 2, 4}, { 0, 2, 4}}, /* EA_MODE_I */ | |
| 332 | 336 | }; |
| 333 | 337 | |
| 334 | 338 | /* Extra cycles for JMP instruction (000, 010) */ |
| r5955 | r5956 | |
| 1073 | 1077 | /* Find the start of the table */ |
| 1074 | 1078 | while(strcmp(buff, ID_TABLE_START) != 0) |
| 1075 | 1079 | if(fgetline(buff, MAX_LINE_LENGTH, g_input_file) < 0) |
| 1076 | error_exit("Premature EOF while reading table"); | |
| 1080 | error_exit("(table_start) Premature EOF while reading table"); | |
| 1077 | 1081 | |
| 1078 | 1082 | /* Process the entire table */ |
| 1079 | 1083 | for(op = g_opcode_input_table;;op++) |
| 1080 | 1084 | { |
| 1081 | 1085 | if(fgetline(buff, MAX_LINE_LENGTH, g_input_file) < 0) |
| 1082 | error_exit("Premature EOF while reading table"); | |
| 1086 | error_exit("(inline) Premature EOF while reading table"); | |
| 1083 | 1087 | if(strlen(buff) == 0) |
| 1084 | 1088 | continue; |
| 1085 | 1089 | /* We finish when we find an input separator */ |
| r5955 | r5956 | |
| 1237 | 1241 | int table_body_read = 0; |
| 1238 | 1242 | int ophandler_body_read = 0; |
| 1239 | 1243 | |
| 1240 | printf("\n\tMusashi v%s 68000, 68008, 68010, 68EC020, 68020, 68040 emulator\n", g_version); | |
| 1244 | printf("\n\tMusashi v%s 68000, 68008, 68010, 68EC020, 68020, 68EC030, 68030, 68EC040, 68040 emulator\n", g_version); | |
| 1241 | 1245 | printf("\tCopyright Karl Stenerud\n\n"); |
| 1242 | 1246 | |
| 1243 | 1247 | /* Check if output path and source for the input file are given */ |
| r5955 | r5956 | |
|---|---|---|
| 225 | 225 | "?", "?", "?", "?", "?", "?", "?", "?" /* 111 */ |
| 226 | 226 | }; |
| 227 | 227 | |
| 228 | static const char *const g_mmuregs[8] = | |
| 229 | { | |
| 230 | "tc", "drp", "srp", "crp", "cal", "val", "sccr", "acr" | |
| 231 | }; | |
| 228 | 232 | |
| 229 | 233 | /* ======================================================================== */ |
| 230 | 234 | /* =========================== UTILITY FUNCTIONS ========================== */ |
| r5955 | r5956 | |
| 3015 | 3019 | } |
| 3016 | 3020 | |
| 3017 | 3021 | |
| 3022 | static void d68030_pmove(void) | |
| 3023 | { | |
| 3024 | char* str; | |
| 3025 | UINT16 modes = read_imm_16(); | |
| 3018 | 3026 | |
| 3027 | // do this after fetching the second PMOVE word so we properly get the 3rd if necessary | |
| 3028 | str = get_ea_mode_str_32(g_cpu_ir); | |
| 3029 | ||
| 3030 | switch ((modes>>13) & 0x7) | |
| 3031 | { | |
| 3032 | case 0: // MC68030/040 form with FD bit | |
| 3033 | case 2: // MC68881 form, FD never set | |
| 3034 | if (modes & 0x0100) | |
| 3035 | { | |
| 3036 | if (modes & 0x0200) | |
| 3037 | { | |
| 3038 | sprintf(g_dasm_str, "pmovefd %s, %s", g_mmuregs[(modes>>10)&7], str); | |
| 3039 | } | |
| 3040 | else | |
| 3041 | { | |
| 3042 | sprintf(g_dasm_str, "pmovefd %s, %s", str, g_mmuregs[(modes>>10)&7]); | |
| 3043 | } | |
| 3044 | } | |
| 3045 | else | |
| 3046 | { | |
| 3047 | if (modes & 0x0200) | |
| 3048 | { | |
| 3049 | sprintf(g_dasm_str, "pmove %s, %s", g_mmuregs[(modes>>10)&7], str); | |
| 3050 | } | |
| 3051 | else | |
| 3052 | { | |
| 3053 | sprintf(g_dasm_str, "pmove %s, %s", str, g_mmuregs[(modes>>10)&7]); | |
| 3054 | } | |
| 3055 | } | |
| 3056 | break; | |
| 3057 | ||
| 3058 | case 3: // MC68030 to/from status reg | |
| 3059 | if (modes & 0x0200) | |
| 3060 | { | |
| 3061 | sprintf(g_dasm_str, "pmove mmusr, %s", str); | |
| 3062 | } | |
| 3063 | else | |
| 3064 | { | |
| 3065 | sprintf(g_dasm_str, "pmove %s, mmusr", str); | |
| 3066 | } | |
| 3067 | break; | |
| 3068 | ||
| 3069 | default: | |
| 3070 | sprintf(g_dasm_str, "pmove [unknown form] %s", str); | |
| 3071 | break; | |
| 3072 | } | |
| 3073 | } | |
| 3074 | ||
| 3075 | ||
| 3019 | 3076 | /* ======================================================================== */ |
| 3020 | 3077 | /* ======================= INSTRUCTION TABLE BUILDER ====================== */ |
| 3021 | 3078 | /* ======================================================================== */ |
| r5955 | r5956 | |
| 3037 | 3094 | |
| 3038 | 3095 | static const opcode_struct g_opcode_info[] = |
| 3039 | 3096 | { |
| 3040 | /* opcode handler mask match ea mask */ | |
| 3097 | /* opcode handler mask match ea mask */ | |
| 3041 | 3098 | {d68000_1010 , 0xf000, 0xa000, 0x000}, |
| 3042 | 3099 | {d68000_1111 , 0xf000, 0xf000, 0x000}, |
| 3043 | 3100 | {d68000_abcd_rr , 0xf1f8, 0xc100, 0x000}, |
| r5955 | r5956 | |
| 3338 | 3395 | {d68000_unlk , 0xfff8, 0x4e58, 0x000}, |
| 3339 | 3396 | {d68020_unpk_rr , 0xf1f8, 0x8180, 0x000}, |
| 3340 | 3397 | {d68020_unpk_mm , 0xf1f8, 0x8188, 0x000}, |
| 3398 | {d68030_pmove , 0xffc0, 0xf000, 0x278}, | |
| 3341 | 3399 | {0, 0, 0, 0} |
| 3342 | 3400 | }; |
| 3343 | 3401 |
| r5955 | r5956 | |
|---|---|---|
| 125 | 125 | |
| 126 | 126 | #include "m68kops.h" |
| 127 | 127 | |
| 128 | #define NUM_CPU_TYPES | |
| 128 | #define NUM_CPU_TYPES 5 | |
| 129 | 129 | |
| 130 | 130 | void (*m68ki_instruction_jump_table[0x10000])(m68ki_cpu_core *m68k); /* opcode handler jump table */ |
| 131 | 131 | unsigned char m68ki_cycles[NUM_CPU_TYPES][0x10000]; /* Cycles used by CPU type */ |
| r5955 | r5956 | |
| 150 | 150 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 151 | 151 | M68KMAKE_TABLE_FOOTER |
| 152 | 152 | |
| 153 | {0, 0, 0, {0, 0, 0, 0}} | |
| 153 | {0, 0, 0, {0, 0, 0, 0, 0}} | |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | 156 | |
| r5955 | r5956 | |
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | |
| 354 | spec spec allowed ea mode cpu cycles | |
| 355 | name size proc ea bit pattern A+-DXWLdxI 0 1 2 4 000 010 020 040 comments | |
| 356 | ====== ==== ==== ==== ================ ========== = = = = === === === === ============= | |
| 354 | spec spec allowed ea mode cpu cycles | |
| 355 | name size proc ea bit pattern A+-DXWLdxI 0 1 2 3 4 000 010 020 030 040 comments | |
| 356 | ====== ==== ==== ==== ================ ========== = = = = = === === === === === ============= | |
| 357 | 357 | M68KMAKE_TABLE_START |
| 358 | 1010 0 . . 1010............ .......... U U U U 4 4 4 4 | |
| 359 | 1111 0 . . 1111............ .......... U U U U 4 4 4 4 | |
| 360 | 040fpu0 32 . . 11110010........ .......... . . . U . . . 0 | |
| 361 | 040fpu1 32 . . 11110011........ .......... . . . U . . . 0 | |
| 362 | abcd 8 rr . 1100...100000... .......... U U U U 6 6 4 4 | |
| 363 | abcd 8 mm ax7 1100111100001... .......... U U U U 18 18 16 16 | |
| 364 | abcd 8 mm ay7 1100...100001111 .......... U U U U 18 18 16 16 | |
| 365 | abcd 8 mm axy7 1100111100001111 .......... U U U U 18 18 16 16 | |
| 366 | abcd 8 mm . 1100...100001... .......... U U U U 18 18 16 16 | |
| 367 | add 8 er d 1101...000000... .......... U U U U 4 4 2 2 | |
| 368 | add 8 er . 1101...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 369 | add 16 er d 1101...001000... .......... U U U U 4 4 2 2 | |
| 370 | add 16 er a 1101...001001... .......... U U U U 4 4 2 2 | |
| 371 | add 16 er . 1101...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 372 | add 32 er d 1101...010000... .......... U U U U 6 6 2 2 | |
| 373 | add 32 er a 1101...010001... .......... U U U U 6 6 2 2 | |
| 374 | add 32 er . 1101...010...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 375 | add 8 re . 1101...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 376 | add 16 re . 1101...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 377 | add 32 re . 1101...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 378 | adda 16 . d 1101...011000... .......... U U U U 8 8 2 2 | |
| 379 | adda 16 . a 1101...011001... .......... U U U U 8 8 2 2 | |
| 380 | adda 16 . . 1101...011...... A+-DXWLdxI U U U U 8 8 2 2 | |
| 381 | adda 32 . d 1101...111000... .......... U U U U 6 6 2 2 | |
| 382 | adda 32 . a 1101...111001... .......... U U U U 6 6 2 2 | |
| 383 | adda 32 . . 1101...111...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 384 | addi 8 . d 0000011000000... .......... U U U U 8 8 2 2 | |
| 385 | addi 8 . . 0000011000...... A+-DXWL... U U U U 12 12 4 4 | |
| 386 | addi 16 . d 0000011001000... .......... U U U U 8 8 2 2 | |
| 387 | addi 16 . . 0000011001...... A+-DXWL... U U U U 12 12 4 4 | |
| 388 | addi 32 . d 0000011010000... .......... U U U U 16 14 2 2 | |
| 389 | addi 32 . . 0000011010...... A+-DXWL... U U U U 20 20 4 4 | |
| 390 | addq 8 . d 0101...000000... .......... U U U U 4 4 2 2 | |
| 391 | addq 8 . . 0101...000...... A+-DXWL... U U U U 8 8 4 4 | |
| 392 | addq 16 . d 0101...001000... .......... U U U U 4 4 2 2 | |
| 393 | addq 16 . a 0101...001001... .......... U U U U 4 4 2 2 | |
| 394 | addq 16 . . 0101...001...... A+-DXWL... U U U U 8 8 4 4 | |
| 395 | addq 32 . d 0101...010000... .......... U U U U 8 8 2 2 | |
| 396 | addq 32 . a 0101...010001... .......... U U U U 8 8 2 2 | |
| 397 | addq 32 . . 0101...010...... A+-DXWL... U U U U 12 12 4 4 | |
| 398 | addx 8 rr . 1101...100000... .......... U U U U 4 4 2 2 | |
| 399 | addx 16 rr . 1101...101000... .......... U U U U 4 4 2 2 | |
| 400 | addx 32 rr . 1101...110000... .......... U U U U 8 6 2 2 | |
| 401 | addx 8 mm ax7 1101111100001... .......... U U U U 18 18 12 12 | |
| 402 | addx 8 mm ay7 1101...100001111 .......... U U U U 18 18 12 12 | |
| 403 | addx 8 mm axy7 1101111100001111 .......... U U U U 18 18 12 12 | |
| 404 | addx 8 mm . 1101...100001... .......... U U U U 18 18 12 12 | |
| 405 | addx 16 mm . 1101...101001... .......... U U U U 18 18 12 12 | |
| 406 | addx 32 mm . 1101...110001... .......... U U U U 30 30 12 12 | |
| 407 | and 8 er d 1100...000000... .......... U U U U 4 4 2 2 | |
| 408 | and 8 er . 1100...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 409 | and 16 er d 1100...001000... .......... U U U U 4 4 2 2 | |
| 410 | and 16 er . 1100...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 411 | and 32 er d 1100...010000... .......... U U U U 6 6 2 2 | |
| 412 | and 32 er . 1100...010...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 413 | and 8 re . 1100...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 414 | and 16 re . 1100...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 415 | and 32 re . 1100...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 416 | andi 16 toc . 0000001000111100 .......... U U U U 20 16 12 12 | |
| 417 | andi 16 tos . 0000001001111100 .......... S S S S 20 16 12 12 | |
| 418 | andi 8 . d 0000001000000... .......... U U U U 8 8 2 2 | |
| 419 | andi 8 . . 0000001000...... A+-DXWL... U U U U 12 12 4 4 | |
| 420 | andi 16 . d 0000001001000... .......... U U U U 8 8 2 2 | |
| 421 | andi 16 . . 0000001001...... A+-DXWL... U U U U 12 12 4 4 | |
| 422 | andi 32 . d 0000001010000... .......... U U U U 14 14 2 2 | |
| 423 | andi 32 . . 0000001010...... A+-DXWL... U U U U 20 20 4 4 | |
| 424 | asr 8 s . 1110...000000... .......... U U U U 6 6 6 6 | |
| 425 | asr 16 s . 1110...001000... .......... U U U U 6 6 6 6 | |
| 426 | asr 32 s . 1110...010000... .......... U U U U 8 8 6 6 | |
| 427 | asr 8 r . 1110...000100... .......... U U U U 6 6 6 6 | |
| 428 | asr 16 r . 1110...001100... .......... U U U U 6 6 6 6 | |
| 429 | asr 32 r . 1110...010100... .......... U U U U 8 8 6 6 | |
| 430 | asr 16 . . 1110000011...... A+-DXWL... U U U U 8 8 5 5 | |
| 431 | asl 8 s . 1110...100000... .......... U U U U 6 6 8 8 | |
| 432 | asl 16 s . 1110...101000... .......... U U U U 6 6 8 8 | |
| 433 | asl 32 s . 1110...110000... .......... U U U U 8 8 8 8 | |
| 434 | asl 8 r . 1110...100100... .......... U U U U 6 6 8 8 | |
| 435 | asl 16 r . 1110...101100... .......... U U U U 6 6 8 8 | |
| 436 | asl 32 r . 1110...110100... .......... U U U U 8 8 8 8 | |
| 437 | asl 16 . . 1110000111...... A+-DXWL... U U U U 8 8 6 6 | |
| 438 | bcc 8 . . 0110............ .......... U U U U 10 10 6 6 | |
| 439 | bcc 16 . . 0110....00000000 .......... U U U U 10 10 6 6 | |
| 440 | bcc 32 . . 0110....11111111 .......... U U U U 10 10 6 6 | |
| 441 | bchg 8 r . 0000...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 442 | bchg 32 r d 0000...101000... .......... U U U U 8 8 4 4 | |
| 443 | bchg 8 s . 0000100001...... A+-DXWL... U U U U 12 12 4 4 | |
| 444 | bchg 32 s d 0000100001000... .......... U U U U 12 12 4 4 | |
| 445 | bclr 8 r . 0000...110...... A+-DXWL... U U U U 8 10 4 4 | |
| 446 | bclr 32 r d 0000...110000... .......... U U U U 10 10 4 4 | |
| 447 | bclr 8 s . 0000100010...... A+-DXWL... U U U U 12 12 4 4 | |
| 448 | bclr 32 s d 0000100010000... .......... U U U U 14 14 4 4 | |
| 449 | bfchg 32 . d 1110101011000... .......... . . U U . . 12 12 timing not quite correct | |
| 450 | bfchg 32 . . 1110101011...... A..DXWL... . . U U . . 20 20 | |
| 451 | bfclr 32 . d 1110110011000... .......... . . U U . . 12 12 | |
| 452 | bfclr 32 . . 1110110011...... A..DXWL... . . U U . . 20 20 | |
| 453 | bfexts 32 . d 1110101111000... .......... . . U U . . 8 8 | |
| 454 | bfexts 32 . . 1110101111...... A..DXWLdx. . . U U . . 15 15 | |
| 455 | bfextu 32 . d 1110100111000... .......... . . U U . . 8 8 | |
| 456 | bfextu 32 . . 1110100111...... A..DXWLdx. . . U U . . 15 15 | |
| 457 | bfffo 32 . d 1110110111000... .......... . . U U . . 18 18 | |
| 458 | bfffo 32 . . 1110110111...... A..DXWLdx. . . U U . . 28 28 | |
| 459 | bfins 32 . d 1110111111000... .......... . . U U . . 10 10 | |
| 460 | bfins 32 . . 1110111111...... A..DXWL... . . U U . . 17 17 | |
| 461 | bfset 32 . d 1110111011000... .......... . . U U . . 12 12 | |
| 462 | bfset 32 . . 1110111011...... A..DXWL... . . U U . . 20 20 | |
| 463 | bftst 32 . d 1110100011000... .......... . . U U . . 6 6 | |
| 464 | bftst 32 . . 1110100011...... A..DXWLdx. . . U U . . 13 13 | |
| 465 | bkpt 0 . . 0100100001001... .......... . U U U . 10 10 10 | |
| 466 | bra 8 . . 01100000........ .......... U U U U 10 10 10 10 | |
| 467 | bra 16 . . 0110000000000000 .......... U U U U 10 10 10 10 | |
| 468 | bra 32 . . 0110000011111111 .......... U U U U 10 10 10 10 | |
| 469 | bset 32 r d 0000...111000... .......... U U U U 8 8 4 4 | |
| 470 | bset 8 r . 0000...111...... A+-DXWL... U U U U 8 8 4 4 | |
| 471 | bset 8 s . 0000100011...... A+-DXWL... U U U U 12 12 4 4 | |
| 472 | bset 32 s d 0000100011000... .......... U U U U 12 12 4 4 | |
| 473 | bsr 8 . . 01100001........ .......... U U U U 18 18 7 7 | |
| 474 | bsr 16 . . 0110000100000000 .......... U U U U 18 18 7 7 | |
| 475 | bsr 32 . . 0110000111111111 .......... U U U U 18 18 7 7 | |
| 476 | btst 8 r . 0000...100...... A+-DXWLdxI U U U U 4 4 4 4 | |
| 477 | btst 32 r d 0000...100000... .......... U U U U 6 6 4 4 | |
| 478 | btst 8 s . 0000100000...... A+-DXWLdx. U U U U 8 8 4 4 | |
| 479 | btst 32 s d 0000100000000... .......... U U U U 10 10 4 4 | |
| 480 | callm 32 . . 0000011011...... A..DXWLdx. . . U U . . 60 60 not properly emulated | |
| 481 | cas 8 . . 0000101011...... A+-DXWL... . . U U . . 12 12 | |
| 482 | cas 16 . . 0000110011...... A+-DXWL... . . U U . . 12 12 | |
| 483 | cas 32 . . 0000111011...... A+-DXWL... . . U U . . 12 12 | |
| 484 | cas2 16 . . 0000110011111100 .......... . . U U . . 12 12 | |
| 485 | cas2 32 . . 0000111011111100 .......... . . U U . . 12 12 | |
| 486 | chk 16 . d 0100...110000... .......... U U U U 10 8 8 8 | |
| 487 | chk 16 . . 0100...110...... A+-DXWLdxI U U U U 10 8 8 8 | |
| 488 | chk 32 . d 0100...100000... .......... . . U U . . 8 8 | |
| 489 | chk 32 . . 0100...100...... A+-DXWLdxI . . U U . . 8 8 | |
| 490 | chk2cmp2 8 . pcdi 0000000011111010 .......... . . U U . . 23 23 | |
| 491 | chk2cmp2 8 . pcix 0000000011111011 .......... . . U U . . 23 23 | |
| 492 | chk2cmp2 8 . . 0000000011...... A..DXWL... . . U U . . 18 18 | |
| 493 | chk2cmp2 16 . pcdi 0000001011111010 .......... . . U U . . 23 23 | |
| 494 | chk2cmp2 16 . pcix 0000001011111011 .......... . . U U . . 23 23 | |
| 495 | chk2cmp2 16 . . 0000001011...... A..DXWL... . . U U . . 18 18 | |
| 496 | chk2cmp2 32 . pcdi 0000010011111010 .......... . . U U . . 23 23 | |
| 497 | chk2cmp2 32 . pcix 0000010011111011 .......... . . U U . . 23 23 | |
| 498 | chk2cmp2 32 . . 0000010011...... A..DXWL... . . U U . . 18 18 | |
| 499 | clr 8 . d 0100001000000... .......... U U U U 4 4 2 2 | |
| 500 | clr 8 . . 0100001000...... A+-DXWL... U U U U 8 4 4 4 | |
| 501 | clr 16 . d 0100001001000... .......... U U U U 4 4 2 2 | |
| 502 | clr 16 . . 0100001001...... A+-DXWL... U U U U 8 4 4 4 | |
| 503 | clr 32 . d 0100001010000... .......... U U U U 6 6 2 2 | |
| 504 | clr 32 . . 0100001010...... A+-DXWL... U U U U 12 6 4 4 | |
| 505 | cmp 8 . d 1011...000000... .......... U U U U 4 4 2 2 | |
| 506 | cmp 8 . . 1011...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 507 | cmp 16 . d 1011...001000... .......... U U U U 4 4 2 2 | |
| 508 | cmp 16 . a 1011...001001... .......... U U U U 4 4 2 2 | |
| 509 | cmp 16 . . 1011...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 510 | cmp 32 . d 1011...010000... .......... U U U U 6 6 2 2 | |
| 511 | cmp 32 . a 1011...010001... .......... U U U U 6 6 2 2 | |
| 512 | cmp 32 . . 1011...010...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 513 | cmpa 16 . d 1011...011000... .......... U U U U 6 6 4 4 | |
| 514 | cmpa 16 . a 1011...011001... .......... U U U U 6 6 4 4 | |
| 515 | cmpa 16 . . 1011...011...... A+-DXWLdxI U U U U 6 6 4 4 | |
| 516 | cmpa 32 . d 1011...111000... .......... U U U U 6 6 4 4 | |
| 517 | cmpa 32 . a 1011...111001... .......... U U U U 6 6 4 4 | |
| 518 | cmpa 32 . . 1011...111...... A+-DXWLdxI U U U U 6 6 4 4 | |
| 519 | cmpi 8 . d 0000110000000... .......... U U U U 8 8 2 2 | |
| 520 | cmpi 8 . . 0000110000...... A+-DXWL... U U U U 8 8 2 2 | |
| 521 | cmpi 8 . pcdi 0000110000111010 .......... . . U U . . 7 7 | |
| 522 | cmpi 8 . pcix 0000110000111011 .......... . . U U . . 9 9 | |
| 523 | cmpi 16 . d 0000110001000... .......... U U U U 8 8 2 2 | |
| 524 | cmpi 16 . . 0000110001...... A+-DXWL... U U U U 8 8 2 2 | |
| 525 | cmpi 16 . pcdi 0000110001111010 .......... . . U U . . 7 7 | |
| 526 | cmpi 16 . pcix 0000110001111011 .......... . . U U . . 9 9 | |
| 527 | cmpi 32 . d 0000110010000... .......... U U U U 14 12 2 2 | |
| 528 | cmpi 32 . . 0000110010...... A+-DXWL... U U U U 12 12 2 2 | |
| 529 | cmpi 32 . pcdi 0000110010111010 .......... . . U U . . 7 7 | |
| 530 | cmpi 32 . pcix 0000110010111011 .......... . . U U . . 9 9 | |
| 531 | cmpm 8 . ax7 1011111100001... .......... U U U U 12 12 9 9 | |
| 532 | cmpm 8 . ay7 1011...100001111 .......... U U U U 12 12 9 9 | |
| 533 | cmpm 8 . axy7 1011111100001111 .......... U U U U 12 12 9 9 | |
| 534 | cmpm 8 . . 1011...100001... .......... U U U U 12 12 9 9 | |
| 535 | cmpm 16 . . 1011...101001... .......... U U U U 12 12 9 9 | |
| 536 | cmpm 32 . . 1011...110001... .......... U U U U 20 20 9 9 | |
| 537 | cpbcc 32 . . 1111...01....... .......... . . U . . . 4 . unemulated | |
| 538 | cpdbcc 32 . . 1111...001001... .......... . . U . . . 4 . unemulated | |
| 539 | cpgen 32 . . 1111...000...... .......... . . U . . . 4 . unemulated | |
| 540 | cpscc 32 . . 1111...001...... .......... . . U . . . 4 . unemulated | |
| 541 | cptrapcc 32 . . 1111...001111... .......... . . U . . . 4 . unemulated | |
| 542 | dbt 16 . . 0101000011001... .......... U U U U 12 12 6 6 | |
| 543 | dbf 16 . . 0101000111001... .......... U U U U 12 12 6 6 | |
| 544 | dbcc 16 . . 0101....11001... .......... U U U U 12 12 6 6 | |
| 545 | divs 16 . d 1000...111000... .......... U U U U 158 122 56 56 | |
| 546 | divs 16 . . 1000...111...... A+-DXWLdxI U U U U 158 122 56 56 | |
| 547 | divu 16 . d 1000...011000... .......... U U U U 140 108 44 44 | |
| 548 | divu 16 . . 1000...011...... A+-DXWLdxI U U U U 140 108 44 44 | |
| 549 | divl 32 . d 0100110001000... .......... . . U U . . 84 84 | |
| 550 | divl 32 . . 0100110001...... A+-DXWLdxI . . U U . . 84 84 | |
| 551 | eor 8 . d 1011...100000... .......... U U U U 4 4 2 2 | |
| 552 | eor 8 . . 1011...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 553 | eor 16 . d 1011...101000... .......... U U U U 4 4 2 2 | |
| 554 | eor 16 . . 1011...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 555 | eor 32 . d 1011...110000... .......... U U U U 8 6 2 2 | |
| 556 | eor 32 . . 1011...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 557 | eori 16 toc . 0000101000111100 .......... U U U U 20 16 12 12 | |
| 558 | eori 16 tos . 0000101001111100 .......... S S S S 20 16 12 12 | |
| 559 | eori 8 . d 0000101000000... .......... U U U U 8 8 2 2 | |
| 560 | eori 8 . . 0000101000...... A+-DXWL... U U U U 12 12 4 4 | |
| 561 | eori 16 . d 0000101001000... .......... U U U U 8 8 2 2 | |
| 562 | eori 16 . . 0000101001...... A+-DXWL... U U U U 12 12 4 4 | |
| 563 | eori 32 . d 0000101010000... .......... U U U U 16 14 2 2 | |
| 564 | eori 32 . . 0000101010...... A+-DXWL... U U U U 20 20 4 4 | |
| 565 | exg 32 dd . 1100...101000... .......... U U U U 6 6 2 2 | |
| 566 | exg 32 aa . 1100...101001... .......... U U U U 6 6 2 2 | |
| 567 | exg 32 da . 1100...110001... .......... U U U U 6 6 2 2 | |
| 568 | ext 16 . . 0100100010000... .......... U U U U 4 4 4 4 | |
| 569 | ext 32 . . 0100100011000... .......... U U U U 4 4 4 4 | |
| 570 | extb 32 . . 0100100111000... .......... . . U U . . 4 4 | |
| 571 | illegal 0 . . 0100101011111100 .......... U U U U 4 4 4 4 | |
| 572 | jmp 32 . . 0100111011...... A..DXWLdx. U U U U 4 4 0 0 | |
| 573 | jsr 32 . . 0100111010...... A..DXWLdx. U U U U 12 12 0 0 | |
| 574 | lea 32 . . 0100...111...... A..DXWLdx. U U U U 0 0 2 2 | |
| 575 | link 16 . a7 0100111001010111 .......... U U U U 16 16 5 5 | |
| 576 | link 16 . . 0100111001010... .......... U U U U 16 16 5 5 | |
| 577 | link 32 . a7 0100100000001111 .......... . . U U . . 6 6 | |
| 578 | link 32 . . 0100100000001... .......... . . U U . . 6 6 | |
| 579 | lsr 8 s . 1110...000001... .......... U U U U 6 6 4 4 | |
| 580 | lsr 16 s . 1110...001001... .......... U U U U 6 6 4 4 | |
| 581 | lsr 32 s . 1110...010001... .......... U U U U 8 8 4 4 | |
| 582 | lsr 8 r . 1110...000101... .......... U U U U 6 6 6 6 | |
| 583 | lsr 16 r . 1110...001101... .......... U U U U 6 6 6 6 | |
| 584 | lsr 32 r . 1110...010101... .......... U U U U 8 8 6 6 | |
| 585 | lsr 16 . . 1110001011...... A+-DXWL... U U U U 8 8 5 5 | |
| 586 | lsl 8 s . 1110...100001... .......... U U U U 6 6 4 4 | |
| 587 | lsl 16 s . 1110...101001... .......... U U U U 6 6 4 4 | |
| 588 | lsl 32 s . 1110...110001... .......... U U U U 8 8 4 4 | |
| 589 | lsl 8 r . 1110...100101... .......... U U U U 6 6 6 6 | |
| 590 | lsl 16 r . 1110...101101... .......... U U U U 6 6 6 6 | |
| 591 | lsl 32 r . 1110...110101... .......... U U U U 8 8 6 6 | |
| 592 | lsl 16 . . 1110001111...... A+-DXWL... U U U U 8 8 5 5 | |
| 593 | move 8 d d 0001...000000... .......... U U U U 4 4 2 2 | |
| 594 | move 8 d . 0001...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 595 | move 8 ai d 0001...010000... .......... U U U U 8 8 4 4 | |
| 596 | move 8 ai . 0001...010...... A+-DXWLdxI U U U U 8 8 4 4 | |
| 597 | move 8 pi d 0001...011000... .......... U U U U 8 8 4 4 | |
| 598 | move 8 pi . 0001...011...... A+-DXWLdxI U U U U 8 8 4 4 | |
| 599 | move 8 pi7 d 0001111011000... .......... U U U U 8 8 4 4 | |
| 600 | move 8 pi7 . 0001111011...... A+-DXWLdxI U U U U 8 8 4 4 | |
| 601 | move 8 pd d 0001...100000... .......... U U U U 8 8 5 5 | |
| 602 | move 8 pd . 0001...100...... A+-DXWLdxI U U U U 8 8 5 5 | |
| 603 | move 8 pd7 d 0001111100000... .......... U U U U 8 8 5 5 | |
| 604 | move 8 pd7 . 0001111100...... A+-DXWLdxI U U U U 8 8 5 5 | |
| 605 | move 8 di d 0001...101000... .......... U U U U 12 12 5 5 | |
| 606 | move 8 di . 0001...101...... A+-DXWLdxI U U U U 12 12 5 5 | |
| 607 | move 8 ix d 0001...110000... .......... U U U U 14 14 7 7 | |
| 608 | move 8 ix . 0001...110...... A+-DXWLdxI U U U U 14 14 7 7 | |
| 609 | move 8 aw d 0001000111000... .......... U U U U 12 12 4 4 | |
| 610 | move 8 aw . 0001000111...... A+-DXWLdxI U U U U 12 12 4 4 | |
| 611 | move 8 al d 0001001111000... .......... U U U U 16 16 6 6 | |
| 612 | move 8 al . 0001001111...... A+-DXWLdxI U U U U 16 16 6 6 | |
| 613 | move 16 d d 0011...000000... .......... U U U U 4 4 2 2 | |
| 614 | move 16 d a 0011...000001... .......... U U U U 4 4 2 2 | |
| 615 | move 16 d . 0011...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 616 | move 16 ai d 0011...010000... .......... U U U U 8 8 4 4 | |
| 617 | move 16 ai a 0011...010001... .......... U U U U 8 8 4 4 | |
| 618 | move 16 ai . 0011...010...... A+-DXWLdxI U U U U 8 8 4 4 | |
| 619 | move 16 pi d 0011...011000... .......... U U U U 8 8 4 4 | |
| 620 | move 16 pi a 0011...011001... .......... U U U U 8 8 4 4 | |
| 621 | move 16 pi . 0011...011...... A+-DXWLdxI U U U U 8 8 4 4 | |
| 622 | move 16 pd d 0011...100000... .......... U U U U 8 8 5 5 | |
| 623 | move 16 pd a 0011...100001... .......... U U U U 8 8 5 5 | |
| 624 | move 16 pd . 0011...100...... A+-DXWLdxI U U U U 8 8 5 5 | |
| 625 | move 16 di d 0011...101000... .......... U U U U 12 12 5 5 | |
| 626 | move 16 di a 0011...101001... .......... U U U U 12 12 5 5 | |
| 627 | move 16 di . 0011...101...... A+-DXWLdxI U U U U 12 12 5 5 | |
| 628 | move 16 ix d 0011...110000... .......... U U U U 14 14 7 7 | |
| 629 | move 16 ix a 0011...110001... .......... U U U U 14 14 7 7 | |
| 630 | move 16 ix . 0011...110...... A+-DXWLdxI U U U U 14 14 7 7 | |
| 631 | move 16 aw d 0011000111000... .......... U U U U 12 12 4 4 | |
| 632 | move 16 aw a 0011000111001... .......... U U U U 12 12 4 4 | |
| 633 | move 16 aw . 0011000111...... A+-DXWLdxI U U U U 12 12 4 4 | |
| 634 | move 16 al d 0011001111000... .......... U U U U 16 16 6 6 | |
| 635 | move 16 al a 0011001111001... .......... U U U U 16 16 6 6 | |
| 636 | move 16 al . 0011001111...... A+-DXWLdxI U U U U 16 16 6 6 | |
| 637 | move 32 d d 0010...000000... .......... U U U U 4 4 2 2 | |
| 638 | move 32 d a 0010...000001... .......... U U U U 4 4 2 2 | |
| 639 | move 32 d . 0010...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 640 | move 32 ai d 0010...010000... .......... U U U U 12 12 4 4 | |
| 641 | move 32 ai a 0010...010001... .......... U U U U 12 12 4 4 | |
| 642 | move 32 ai . 0010...010...... A+-DXWLdxI U U U U 12 12 4 4 | |
| 643 | move 32 pi d 0010...011000... .......... U U U U 12 12 4 4 | |
| 644 | move 32 pi a 0010...011001... .......... U U U U 12 12 4 4 | |
| 645 | move 32 pi . 0010...011...... A+-DXWLdxI U U U U 12 12 4 4 | |
| 646 | move 32 pd d 0010...100000... .......... U U U U 12 14 5 5 | |
| 647 | move 32 pd a 0010...100001... .......... U U U U 12 14 5 5 | |
| 648 | move 32 pd . 0010...100...... A+-DXWLdxI U U U U 12 14 5 5 | |
| 649 | move 32 di d 0010...101000... .......... U U U U 16 16 5 5 | |
| 650 | move 32 di a 0010...101001... .......... U U U U 16 16 5 5 | |
| 651 | move 32 di . 0010...101...... A+-DXWLdxI U U U U 16 16 5 5 | |
| 652 | move 32 ix d 0010...110000... .......... U U U U 18 18 7 7 | |
| 653 | move 32 ix a 0010...110001... .......... U U U U 18 18 7 7 | |
| 654 | move 32 ix . 0010...110...... A+-DXWLdxI U U U U 18 18 7 7 | |
| 655 | move 32 aw d 0010000111000... .......... U U U U 16 16 4 4 | |
| 656 | move 32 aw a 0010000111001... .......... U U U U 16 16 4 4 | |
| 657 | move 32 aw . 0010000111...... A+-DXWLdxI U U U U 16 16 4 4 | |
| 658 | move 32 al d 0010001111000... .......... U U U U 20 20 6 6 | |
| 659 | move 32 al a 0010001111001... .......... U U U U 20 20 6 6 | |
| 660 | move 32 al . 0010001111...... A+-DXWLdxI U U U U 20 20 6 6 | |
| 661 | movea 16 . d 0011...001000... .......... U U U U 4 4 2 2 | |
| 662 | movea 16 . a 0011...001001... .......... U U U U 4 4 2 2 | |
| 663 | movea 16 . . 0011...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 664 | movea 32 . d 0010...001000... .......... U U U U 4 4 2 2 | |
| 665 | movea 32 . a 0010...001001... .......... U U U U 4 4 2 2 | |
| 666 | movea 32 . . 0010...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 667 | move 16 frc d 0100001011000... .......... . U U U . 4 4 4 | |
| 668 | move 16 frc . 0100001011...... A+-DXWL... . U U U . 8 4 4 | |
| 669 | move 16 toc d 0100010011000... .......... U U U U 12 12 4 4 | |
| 670 | move 16 toc . 0100010011...... A+-DXWLdxI U U U U 12 12 4 4 | |
| 671 | move 16 frs d 0100000011000... .......... U S S S 6 4 8 8 U only for 000 | |
| 672 | move 16 frs . 0100000011...... A+-DXWL... U S S S 8 8 8 8 U only for 000 | |
| 673 | move 16 tos d 0100011011000... .......... S S S S 12 12 8 8 | |
| 674 | move 16 tos . 0100011011...... A+-DXWLdxI S S S S 12 12 8 8 | |
| 675 | move 32 fru . 0100111001101... .......... S S S S 4 6 2 2 | |
| 676 | move 32 tou . 0100111001100... .......... S S S S 4 6 2 2 | |
| 677 | movec 32 cr . 0100111001111010 .......... . S S S . 12 6 6 | |
| 678 | movec 32 rc . 0100111001111011 .......... . S S S . 10 12 12 | |
| 679 | movem 16 re pd 0100100010100... .......... U U U U 8 8 4 4 | |
| 680 | movem 16 re . 0100100010...... A..DXWL... U U U U 8 8 4 4 | |
| 681 | movem 32 re pd 0100100011100... .......... U U U U 8 8 4 4 | |
| 682 | movem 32 re . 0100100011...... A..DXWL... U U U U 8 8 4 4 | |
| 683 | movem 16 er pi 0100110010011... .......... U U U U 12 12 8 8 | |
| 684 | movem 16 er pcdi 0100110010111010 .......... U U U U 16 16 9 9 | |
| 685 | movem 16 er pcix 0100110010111011 .......... U U U U 18 18 11 11 | |
| 686 | movem 16 er . 0100110010...... A..DXWL... U U U U 12 12 8 8 | |
| 687 | movem 32 er pi 0100110011011... .......... U U U U 12 12 8 8 | |
| 688 | movem 32 er pcdi 0100110011111010 .......... U U U U 16 16 9 9 | |
| 689 | movem 32 er pcix 0100110011111011 .......... U U U U 18 18 11 11 | |
| 690 | movem 32 er . 0100110011...... A..DXWL... U U U U 12 12 8 8 | |
| 691 | movep 16 er . 0000...100001... .......... U U U U 16 16 12 12 | |
| 692 | movep 32 er . 0000...101001... .......... U U U U 24 24 18 18 | |
| 693 | movep 16 re . 0000...110001... .......... U U U U 16 16 11 11 | |
| 694 | movep 32 re . 0000...111001... .......... U U U U 24 24 17 17 | |
| 695 | moveq 32 . . 0111...0........ .......... U U U U 4 4 2 2 | |
| 696 | moves 8 . . 0000111000...... A+-DXWL... . S S S . 14 5 5 | |
| 697 | moves 16 . . 0000111001...... A+-DXWL... . S S S . 14 5 5 | |
| 698 | moves 32 . . 0000111010...... A+-DXWL... . S S S . 16 5 5 | |
| 699 | move16 32 . . 1111011000100... .......... . . . U . . . 4 TODO: correct timing | |
| 700 | muls 16 . d 1100...111000... .......... U U U U 54 32 27 27 | |
| 701 | muls 16 . . 1100...111...... A+-DXWLdxI U U U U 54 32 27 27 | |
| 702 | mulu 16 . d 1100...011000... .......... U U U U 54 30 27 27 | |
| 703 | mulu 16 . . 1100...011...... A+-DXWLdxI U U U U 54 30 27 27 | |
| 704 | mull 32 . d 0100110000000... .......... . . U U . . 43 43 | |
| 705 | mull 32 . . 0100110000...... A+-DXWLdxI . . U U . . 43 43 | |
| 706 | nbcd 8 . d 0100100000000... .......... U U U U 6 6 6 6 | |
| 707 | nbcd 8 . . 0100100000...... A+-DXWL... U U U U 8 8 6 6 | |
| 708 | neg 8 . d 0100010000000... .......... U U U U 4 4 2 2 | |
| 709 | neg 8 . . 0100010000...... A+-DXWL... U U U U 8 8 4 4 | |
| 710 | neg 16 . d 0100010001000... .......... U U U U 4 4 2 2 | |
| 711 | neg 16 . . 0100010001...... A+-DXWL... U U U U 8 8 4 4 | |
| 712 | neg 32 . d 0100010010000... .......... U U U U 6 6 2 2 | |
| 713 | neg 32 . . 0100010010...... A+-DXWL... U U U U 12 12 4 4 | |
| 714 | negx 8 . d 0100000000000... .......... U U U U 4 4 2 2 | |
| 715 | negx 8 . . 0100000000...... A+-DXWL... U U U U 8 8 4 4 | |
| 716 | negx 16 . d 0100000001000... .......... U U U U 4 4 2 2 | |
| 717 | negx 16 . . 0100000001...... A+-DXWL... U U U U 8 8 4 4 | |
| 718 | negx 32 . d 0100000010000... .......... U U U U 6 6 2 2 | |
| 719 | negx 32 . . 0100000010...... A+-DXWL... U U U U 12 12 4 4 | |
| 720 | nop 0 . . 0100111001110001 .......... U U U U 4 4 2 2 | |
| 721 | not 8 . d 0100011000000... .......... U U U U 4 4 2 2 | |
| 722 | not 8 . . 0100011000...... A+-DXWL... U U U U 8 8 4 4 | |
| 723 | not 16 . d 0100011001000... .......... U U U U 4 4 2 2 | |
| 724 | not 16 . . 0100011001...... A+-DXWL... U U U U 8 8 4 4 | |
| 725 | not 32 . d 0100011010000... .......... U U U U 6 6 2 2 | |
| 726 | not 32 . . 0100011010...... A+-DXWL... U U U U 12 12 4 4 | |
| 727 | or 8 er d 1000...000000... .......... U U U U 4 4 2 2 | |
| 728 | or 8 er . 1000...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 729 | or 16 er d 1000...001000... .......... U U U U 4 4 2 2 | |
| 730 | or 16 er . 1000...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 731 | or 32 er d 1000...010000... .......... U U U U 6 6 2 2 | |
| 732 | or 32 er . 1000...010...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 733 | or 8 re . 1000...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 734 | or 16 re . 1000...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 735 | or 32 re . 1000...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 736 | ori 16 toc . 0000000000111100 .......... U U U U 20 16 12 12 | |
| 737 | ori 16 tos . 0000000001111100 .......... S S S S 20 16 12 12 | |
| 738 | ori 8 . d 0000000000000... .......... U U U U 8 8 2 2 | |
| 739 | ori 8 . . 0000000000...... A+-DXWL... U U U U 12 12 4 4 | |
| 740 | ori 16 . d 0000000001000... .......... U U U U 8 8 2 2 | |
| 741 | ori 16 . . 0000000001...... A+-DXWL... U U U U 12 12 4 4 | |
| 742 | ori 32 . d 0000000010000... .......... U U U U 16 14 2 2 | |
| 743 | ori 32 . . 0000000010...... A+-DXWL... U U U U 20 20 4 4 | |
| 744 | pack 16 rr . 1000...101000... .......... . . U U . . 6 6 | |
| 745 | pack 16 mm ax7 1000111101001... .......... . . U U . . 13 13 | |
| 746 | pack 16 mm ay7 1000...101001111 .......... . . U U . . 13 13 | |
| 747 | pack 16 mm axy7 1000111101001111 .......... . . U U . . 13 13 | |
| 748 | pack 16 mm . 1000...101001... .......... . . U U . . 13 13 | |
| 749 | pea 32 . . 0100100001...... A..DXWLdx. U U U U 6 6 5 5 | |
| 750 | pflush 32 . . 1111010100011000 .......... . . . S . . . 4 TODO: correct timing | |
| 751 | reset 0 . . 0100111001110000 .......... S S S S 0 0 0 0 | |
| 752 | ror 8 s . 1110...000011... .......... U U U U 6 6 8 8 | |
| 753 | ror 16 s . 1110...001011... .......... U U U U 6 6 8 8 | |
| 754 | ror 32 s . 1110...010011... .......... U U U U 8 8 8 8 | |
| 755 | ror 8 r . 1110...000111... .......... U U U U 6 6 8 8 | |
| 756 | ror 16 r . 1110...001111... .......... U U U U 6 6 8 8 | |
| 757 | ror 32 r . 1110...010111... .......... U U U U 8 8 8 8 | |
| 758 | ror 16 . . 1110011011...... A+-DXWL... U U U U 8 8 7 7 | |
| 759 | rol 8 s . 1110...100011... .......... U U U U 6 6 8 8 | |
| 760 | rol 16 s . 1110...101011... .......... U U U U 6 6 8 8 | |
| 761 | rol 32 s . 1110...110011... .......... U U U U 8 8 8 8 | |
| 762 | rol 8 r . 1110...100111... .......... U U U U 6 6 8 8 | |
| 763 | rol 16 r . 1110...101111... .......... U U U U 6 6 8 8 | |
| 764 | rol 32 r . 1110...110111... .......... U U U U 8 8 8 8 | |
| 765 | rol 16 . . 1110011111...... A+-DXWL... U U U U 8 8 7 7 | |
| 766 | roxr 8 s . 1110...000010... .......... U U U U 6 6 12 12 | |
| 767 | roxr 16 s . 1110...001010... .......... U U U U 6 6 12 12 | |
| 768 | roxr 32 s . 1110...010010... .......... U U U U 8 8 12 12 | |
| 769 | roxr 8 r . 1110...000110... .......... U U U U 6 6 12 12 | |
| 770 | roxr 16 r . 1110...001110... .......... U U U U 6 6 12 12 | |
| 771 | roxr 32 r . 1110...010110... .......... U U U U 8 8 12 12 | |
| 772 | roxr 16 . . 1110010011...... A+-DXWL... U U U U 8 8 5 5 | |
| 773 | roxl 8 s . 1110...100010... .......... U U U U 6 6 12 12 | |
| 774 | roxl 16 s . 1110...101010... .......... U U U U 6 6 12 12 | |
| 775 | roxl 32 s . 1110...110010... .......... U U U U 8 8 12 12 | |
| 776 | roxl 8 r . 1110...100110... .......... U U U U 6 6 12 12 | |
| 777 | roxl 16 r . 1110...101110... .......... U U U U 6 6 12 12 | |
| 778 | roxl 32 r . 1110...110110... .......... U U U U 8 8 12 12 | |
| 779 | roxl 16 . . 1110010111...... A+-DXWL... U U U U 8 8 5 5 | |
| 780 | rtd 32 . . 0100111001110100 .......... . U U U . 16 10 10 | |
| 781 | rte 32 . . 0100111001110011 .......... S S S S 20 24 20 20 bus fault not emulated | |
| 782 | rtm 32 . . 000001101100.... .......... . . U U . . 19 19 not properly emulated | |
| 783 | rtr 32 . . 0100111001110111 .......... U U U U 20 20 14 14 | |
| 784 | rts 32 . . 0100111001110101 .......... U U U U 16 16 10 10 | |
| 785 | sbcd 8 rr . 1000...100000... .......... U U U U 6 6 4 4 | |
| 786 | sbcd 8 mm ax7 1000111100001... .......... U U U U 18 18 16 16 | |
| 787 | sbcd 8 mm ay7 1000...100001111 .......... U U U U 18 18 16 16 | |
| 788 | sbcd 8 mm axy7 1000111100001111 .......... U U U U 18 18 16 16 | |
| 789 | sbcd 8 mm . 1000...100001... .......... U U U U 18 18 16 16 | |
| 790 | st 8 . d 0101000011000... .......... U U U U 6 4 4 4 | |
| 791 | st 8 . . 0101000011...... A+-DXWL... U U U U 8 8 6 6 | |
| 792 | sf 8 . d 0101000111000... .......... U U U U 4 4 4 4 | |
| 793 | sf 8 . . 0101000111...... A+-DXWL... U U U U 8 8 6 6 | |
| 794 | scc 8 . d 0101....11000... .......... U U U U 4 4 4 4 | |
| 795 | scc 8 . . 0101....11...... A+-DXWL... U U U U 8 8 6 6 | |
| 796 | stop 0 . . 0100111001110010 .......... S S S S 4 4 8 8 | |
| 797 | sub 8 er d 1001...000000... .......... U U U U 4 4 2 2 | |
| 798 | sub 8 er . 1001...000...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 799 | sub 16 er d 1001...001000... .......... U U U U 4 4 2 2 | |
| 800 | sub 16 er a 1001...001001... .......... U U U U 4 4 2 2 | |
| 801 | sub 16 er . 1001...001...... A+-DXWLdxI U U U U 4 4 2 2 | |
| 802 | sub 32 er d 1001...010000... .......... U U U U 6 6 2 2 | |
| 803 | sub 32 er a 1001...010001... .......... U U U U 6 6 2 2 | |
| 804 | sub 32 er . 1001...010...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 805 | sub 8 re . 1001...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 806 | sub 16 re . 1001...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 807 | sub 32 re . 1001...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 808 | suba 16 . d 1001...011000... .......... U U U U 8 8 2 2 | |
| 809 | suba 16 . a 1001...011001... .......... U U U U 8 8 2 2 | |
| 810 | suba 16 . . 1001...011...... A+-DXWLdxI U U U U 8 8 2 2 | |
| 811 | suba 32 . d 1001...111000... .......... U U U U 6 6 2 2 | |
| 812 | suba 32 . a 1001...111001... .......... U U U U 6 6 2 2 | |
| 813 | suba 32 . . 1001...111...... A+-DXWLdxI U U U U 6 6 2 2 | |
| 814 | subi 8 . d 0000010000000... .......... U U U U 8 8 2 2 | |
| 815 | subi 8 . . 0000010000...... A+-DXWL... U U U U 12 12 4 4 | |
| 816 | subi 16 . d 0000010001000... .......... U U U U 8 8 2 2 | |
| 817 | subi 16 . . 0000010001...... A+-DXWL... U U U U 12 12 4 4 | |
| 818 | subi 32 . d 0000010010000... .......... U U U U 16 14 2 2 | |
| 819 | subi 32 . . 0000010010...... A+-DXWL... U U U U 20 20 4 4 | |
| 820 | subq 8 . d 0101...100000... .......... U U U U 4 4 2 2 | |
| 821 | subq 8 . . 0101...100...... A+-DXWL... U U U U 8 8 4 4 | |
| 822 | subq 16 . d 0101...101000... .......... U U U U 4 4 2 2 | |
| 823 | subq 16 . a 0101...101001... .......... U U U U 8 4 2 2 | |
| 824 | subq 16 . . 0101...101...... A+-DXWL... U U U U 8 8 4 4 | |
| 825 | subq 32 . d 0101...110000... .......... U U U U 8 8 2 2 | |
| 826 | subq 32 . a 0101...110001... .......... U U U U 8 8 2 2 | |
| 827 | subq 32 . . 0101...110...... A+-DXWL... U U U U 12 12 4 4 | |
| 828 | subx 8 rr . 1001...100000... .......... U U U U 4 4 2 2 | |
| 829 | subx 16 rr . 1001...101000... .......... U U U U 4 4 2 2 | |
| 830 | subx 32 rr . 1001...110000... .......... U U U U 8 6 2 2 | |
| 831 | subx 8 mm ax7 1001111100001... .......... U U U U 18 18 12 12 | |
| 832 | subx 8 mm ay7 1001...100001111 .......... U U U U 18 18 12 12 | |
| 833 | subx 8 mm axy7 1001111100001111 .......... U U U U 18 18 12 12 | |
| 834 | subx 8 mm . 1001...100001... .......... U U U U 18 18 12 12 | |
| 835 | subx 16 mm . 1001...101001... .......... U U U U 18 18 12 12 | |
| 836 | subx 32 mm . 1001...110001... .......... U U U U 30 30 12 12 | |
| 837 | swap 32 . . 0100100001000... .......... U U U U 4 4 4 4 | |
| 838 | tas 8 . d 0100101011000... .......... U U U U 4 4 4 4 | |
| 839 | tas 8 . . 0100101011...... A+-DXWL... U U U U 14 14 12 12 | |
| 840 | trap 0 . . 010011100100.... .......... U U U U 4 4 4 4 | |
| 841 | trapt 0 . . 0101000011111100 .......... . . U U . . 4 4 | |
| 842 | trapt 16 . . 0101000011111010 .......... . . U U . . 6 6 | |
| 843 | trapt 32 . . 0101000011111011 .......... . . U U . . 8 8 | |
| 844 | trapf 0 . . 0101000111111100 .......... . . U U . . 4 4 | |
| 845 | trapf 16 . . 0101000111111010 .......... . . U U . . 6 6 | |
| 846 | trapf 32 . . 0101000111111011 .......... . . U U . . 8 8 | |
| 847 | trapcc 0 . . 0101....11111100 .......... . . U U . . 4 4 | |
| 848 | trapcc 16 . . 0101....11111010 .......... . . U U . . 6 6 | |
| 849 | trapcc 32 . . 0101....11111011 .......... . . U U . . 8 8 | |
| 850 | trapv 0 . . 0100111001110110 .......... U U U U 4 4 4 4 | |
| 851 | tst 8 . d 0100101000000... .......... U U U U 4 4 2 2 | |
| 852 | tst 8 . . 0100101000...... A+-DXWL... U U U U 4 4 2 2 | |
| 853 | tst 8 . pcdi 0100101000111010 .......... . . U U . . 7 7 | |
| 854 | tst 8 . pcix 0100101000111011 .......... . . U U . . 9 9 | |
| 855 | tst 8 . i 0100101000111100 .......... . . U U . . 6 6 | |
| 856 | tst 16 . d 0100101001000... .......... U U U U 4 4 2 2 | |
| 857 | tst 16 . a 0100101001001... .......... . . U U . . 2 2 | |
| 858 | tst 16 . . 0100101001...... A+-DXWL... U U U U 4 4 2 2 | |
| 859 | tst 16 . pcdi 0100101001111010 .......... . . U U . . 7 7 | |
| 860 | tst 16 . pcix 0100101001111011 .......... . . U U . . 9 9 | |
| 861 | tst 16 . i 0100101001111100 .......... . . U U . . 6 6 | |
| 862 | tst 32 . d 0100101010000... .......... U U U U 4 4 2 2 | |
| 863 | tst 32 . a 0100101010001... .......... . . U U . . 2 2 | |
| 864 | tst 32 . . 0100101010...... A+-DXWL... U U U U 4 4 2 2 | |
| 865 | tst 32 . pcdi 0100101010111010 .......... . . U U . . 7 7 | |
| 866 | tst 32 . pcix 0100101010111011 .......... . . U U . . 9 9 | |
| 867 | tst 32 . i 0100101010111100 .......... . . U U . . 6 6 | |
| 868 | unlk 32 . a7 0100111001011111 .......... U U U U 12 12 6 6 | |
| 869 | unlk 32 . . 0100111001011... .......... U U U U 12 12 6 6 | |
| 870 | unpk 16 rr . 1000...110000... .......... . . U U . . 8 8 | |
| 871 | unpk 16 mm ax7 1000111110001... .......... . . U U . . 13 13 | |
| 872 | unpk 16 mm ay7 1000...110001111 .......... . . U U . . 13 13 | |
| 873 | unpk 16 mm axy7 1000111110001111 .......... . . U U . . 13 13 | |
| 874 | unpk 16 mm . 1000...110001... .......... . . U U . . 13 13 | |
| 358 | 1010 0 . . 1010............ .......... U U U U U 4 4 4 4 4 | |
| 359 | 1111 0 . . 1111............ .......... U U U U U 4 4 4 4 4 | |
| 360 | 040fpu0 32 . . 11110010........ .......... . . . . U . . . . 0 | |
| 361 | 040fpu1 32 . . 11110011........ .......... . . . . U . . . . 0 | |
| 362 | abcd 8 rr . 1100...100000... .......... U U U U U 6 6 4 4 4 | |
| 363 | abcd 8 mm ax7 1100111100001... .......... U U U U U 18 18 16 16 16 | |
| 364 | abcd 8 mm ay7 1100...100001111 .......... U U U U U 18 18 16 16 16 | |
| 365 | abcd 8 mm axy7 1100111100001111 .......... U U U U U 18 18 16 16 16 | |
| 366 | abcd 8 mm . 1100...100001... .......... U U U U U 18 18 16 16 16 | |
| 367 | add 8 er d 1101...000000... .......... U U U U U 4 4 2 2 2 | |
| 368 | add 8 er . 1101...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 369 | add 16 er d 1101...001000... .......... U U U U U 4 4 2 2 2 | |
| 370 | add 16 er a 1101...001001... .......... U U U U U 4 4 2 2 2 | |
| 371 | add 16 er . 1101...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 372 | add 32 er d 1101...010000... .......... U U U U U 6 6 2 2 2 | |
| 373 | add 32 er a 1101...010001... .......... U U U U U 6 6 2 2 2 | |
| 374 | add 32 er . 1101...010...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 375 | add 8 re . 1101...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 376 | add 16 re . 1101...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 377 | add 32 re . 1101...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 378 | adda 16 . d 1101...011000... .......... U U U U U 8 8 2 2 2 | |
| 379 | adda 16 . a 1101...011001... .......... U U U U U 8 8 2 2 2 | |
| 380 | adda 16 . . 1101...011...... A+-DXWLdxI U U U U U 8 8 2 2 2 | |
| 381 | adda 32 . d 1101...111000... .......... U U U U U 6 6 2 2 2 | |
| 382 | adda 32 . a 1101...111001... .......... U U U U U 6 6 2 2 2 | |
| 383 | adda 32 . . 1101...111...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 384 | addi 8 . d 0000011000000... .......... U U U U U 8 8 2 2 2 | |
| 385 | addi 8 . . 0000011000...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 386 | addi 16 . d 0000011001000... .......... U U U U U 8 8 2 2 2 | |
| 387 | addi 16 . . 0000011001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 388 | addi 32 . d 0000011010000... .......... U U U U U 16 14 2 2 2 | |
| 389 | addi 32 . . 0000011010...... A+-DXWL... U U U U U 20 20 4 4 4 | |
| 390 | addq 8 . d 0101...000000... .......... U U U U U 4 4 2 2 2 | |
| 391 | addq 8 . . 0101...000...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 392 | addq 16 . d 0101...001000... .......... U U U U U 4 4 2 2 2 | |
| 393 | addq 16 . a 0101...001001... .......... U U U U U 4 4 2 2 2 | |
| 394 | addq 16 . . 0101...001...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 395 | addq 32 . d 0101...010000... .......... U U U U U 8 8 2 2 2 | |
| 396 | addq 32 . a 0101...010001... .......... U U U U U 8 8 2 2 2 | |
| 397 | addq 32 . . 0101...010...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 398 | addx 8 rr . 1101...100000... .......... U U U U U 4 4 2 2 2 | |
| 399 | addx 16 rr . 1101...101000... .......... U U U U U 4 4 2 2 2 | |
| 400 | addx 32 rr . 1101...110000... .......... U U U U U 8 6 2 2 2 | |
| 401 | addx 8 mm ax7 1101111100001... .......... U U U U U 18 18 12 12 12 | |
| 402 | addx 8 mm ay7 1101...100001111 .......... U U U U U 18 18 12 12 12 | |
| 403 | addx 8 mm axy7 1101111100001111 .......... U U U U U 18 18 12 12 12 | |
| 404 | addx 8 mm . 1101...100001... .......... U U U U U 18 18 12 12 12 | |
| 405 | addx 16 mm . 1101...101001... .......... U U U U U 18 18 12 12 12 | |
| 406 | addx 32 mm . 1101...110001... .......... U U U U U 30 30 12 12 12 | |
| 407 | and 8 er d 1100...000000... .......... U U U U U 4 4 2 2 2 | |
| 408 | and 8 er . 1100...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 409 | and 16 er d 1100...001000... .......... U U U U U 4 4 2 2 2 | |
| 410 | and 16 er . 1100...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 411 | and 32 er d 1100...010000... .......... U U U U U 6 6 2 2 2 | |
| 412 | and 32 er . 1100...010...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 413 | and 8 re . 1100...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 414 | and 16 re . 1100...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 415 | and 32 re . 1100...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 416 | andi 16 toc . 0000001000111100 .......... U U U U U 20 16 12 12 12 | |
| 417 | andi 16 tos . 0000001001111100 .......... S S S S S 20 16 12 12 12 | |
| 418 | andi 8 . d 0000001000000... .......... U U U U U 8 8 2 2 2 | |
| 419 | andi 8 . . 0000001000...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 420 | andi 16 . d 0000001001000... .......... U U U U U 8 8 2 2 2 | |
| 421 | andi 16 . . 0000001001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 422 | andi 32 . d 0000001010000... .......... U U U U U 14 14 2 2 2 | |
| 423 | andi 32 . . 0000001010...... A+-DXWL... U U U U U 20 20 4 4 4 | |
| 424 | asr 8 s . 1110...000000... .......... U U U U U 6 6 6 6 6 | |
| 425 | asr 16 s . 1110...001000... .......... U U U U U 6 6 6 6 6 | |
| 426 | asr 32 s . 1110...010000... .......... U U U U U 8 8 6 6 6 | |
| 427 | asr 8 r . 1110...000100... .......... U U U U U 6 6 6 6 6 | |
| 428 | asr 16 r . 1110...001100... .......... U U U U U 6 6 6 6 6 | |
| 429 | asr 32 r . 1110...010100... .......... U U U U U 8 8 6 6 6 | |
| 430 | asr 16 . . 1110000011...... A+-DXWL... U U U U U 8 8 5 5 5 | |
| 431 | asl 8 s . 1110...100000... .......... U U U U U 6 6 8 8 8 | |
| 432 | asl 16 s . 1110...101000... .......... U U U U U 6 6 8 8 8 | |
| 433 | asl 32 s . 1110...110000... .......... U U U U U 8 8 8 8 8 | |
| 434 | asl 8 r . 1110...100100... .......... U U U U U 6 6 8 8 8 | |
| 435 | asl 16 r . 1110...101100... .......... U U U U U 6 6 8 8 8 | |
| 436 | asl 32 r . 1110...110100... .......... U U U U U 8 8 8 8 8 | |
| 437 | asl 16 . . 1110000111...... A+-DXWL... U U U U U 8 8 6 6 6 | |
| 438 | bcc 8 . . 0110............ .......... U U U U U 10 10 6 6 6 | |
| 439 | bcc 16 . . 0110....00000000 .......... U U U U U 10 10 6 6 6 | |
| 440 | bcc 32 . . 0110....11111111 .......... U U U U U 10 10 6 6 6 | |
| 441 | bchg 8 r . 0000...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 442 | bchg 32 r d 0000...101000... .......... U U U U U 8 8 4 4 4 | |
| 443 | bchg 8 s . 0000100001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 444 | bchg 32 s d 0000100001000... .......... U U U U U 12 12 4 4 4 | |
| 445 | bclr 8 r . 0000...110...... A+-DXWL... U U U U U 8 10 4 4 4 | |
| 446 | bclr 32 r d 0000...110000... .......... U U U U U 10 10 4 4 4 | |
| 447 | bclr 8 s . 0000100010...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 448 | bclr 32 s d 0000100010000... .......... U U U U U 14 14 4 4 4 | |
| 449 | bfchg 32 . d 1110101011000... .......... . . U U U . . 12 12 12 timing not quite correct | |
| 450 | bfchg 32 . . 1110101011...... A..DXWL... . . U U U . . 20 20 20 | |
| 451 | bfclr 32 . d 1110110011000... .......... . . U U U . . 12 12 12 | |
| 452 | bfclr 32 . . 1110110011...... A..DXWL... . . U U U . . 20 20 20 | |
| 453 | bfexts 32 . d 1110101111000... .......... . . U U U . . 8 8 8 | |
| 454 | bfexts 32 . . 1110101111...... A..DXWLdx. . . U U U . . 15 15 15 | |
| 455 | bfextu 32 . d 1110100111000... .......... . . U U U . . 8 8 8 | |
| 456 | bfextu 32 . . 1110100111...... A..DXWLdx. . . U U U . . 15 15 15 | |
| 457 | bfffo 32 . d 1110110111000... .......... . . U U U . . 18 18 18 | |
| 458 | bfffo 32 . . 1110110111...... A..DXWLdx. . . U U U . . 28 28 28 | |
| 459 | bfins 32 . d 1110111111000... .......... . . U U U . . 10 10 10 | |
| 460 | bfins 32 . . 1110111111...... A..DXWL... . . U U U . . 17 17 17 | |
| 461 | bfset 32 . d 1110111011000... .......... . . U U U . . 12 12 12 | |
| 462 | bfset 32 . . 1110111011...... A..DXWL... . . U U U . . 20 20 20 | |
| 463 | bftst 32 . d 1110100011000... .......... . . U U U . . 6 6 6 | |
| 464 | bftst 32 . . 1110100011...... A..DXWLdx. . . U U U . . 13 13 13 | |
| 465 | bkpt 0 . . 0100100001001... .......... . U U U U . 10 10 10 10 | |
| 466 | bra 8 . . 01100000........ .......... U U U U U 10 10 10 10 10 | |
| 467 | bra 16 . . 0110000000000000 .......... U U U U U 10 10 10 10 10 | |
| 468 | bra 32 . . 0110000011111111 .......... U U U U U 10 10 10 10 10 | |
| 469 | bset 32 r d 0000...111000... .......... U U U U U 8 8 4 4 4 | |
| 470 | bset 8 r . 0000...111...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 471 | bset 8 s . 0000100011...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 472 | bset 32 s d 0000100011000... .......... U U U U U 12 12 4 4 4 | |
| 473 | bsr 8 . . 01100001........ .......... U U U U U 18 18 7 7 7 | |
| 474 | bsr 16 . . 0110000100000000 .......... U U U U U 18 18 7 7 7 | |
| 475 | bsr 32 . . 0110000111111111 .......... U U U U U 18 18 7 7 7 | |
| 476 | btst 8 r . 0000...100...... A+-DXWLdxI U U U U U 4 4 4 4 4 | |
| 477 | btst 32 r d 0000...100000... .......... U U U U U 6 6 4 4 4 | |
| 478 | btst 8 s . 0000100000...... A+-DXWLdx. U U U U U 8 8 4 4 4 | |
| 479 | btst 32 s d 0000100000000... .......... U U U U U 10 10 4 4 4 | |
| 480 | callm 32 . . 0000011011...... A..DXWLdx. . . U U U . . 60 60 60 not properly emulated | |
| 481 | cas 8 . . 0000101011...... A+-DXWL... . . U U U . . 12 12 12 | |
| 482 | cas 16 . . 0000110011...... A+-DXWL... . . U U U . . 12 12 12 | |
| 483 | cas 32 . . 0000111011...... A+-DXWL... . . U U U . . 12 12 12 | |
| 484 | cas2 16 . . 0000110011111100 .......... . . U U U . . 12 12 12 | |
| 485 | cas2 32 . . 0000111011111100 .......... . . U U U . . 12 12 12 | |
| 486 | chk 16 . d 0100...110000... .......... U U U U U 10 8 8 8 8 | |
| 487 | chk 16 . . 0100...110...... A+-DXWLdxI U U U U U 10 8 8 8 8 | |
| 488 | chk 32 . d 0100...100000... .......... . . U U U . . 8 8 8 | |
| 489 | chk 32 . . 0100...100...... A+-DXWLdxI . . U U U . . 8 8 8 | |
| 490 | chk2cmp2 8 . pcdi 0000000011111010 .......... . . U U U . . 23 23 23 | |
| 491 | chk2cmp2 8 . pcix 0000000011111011 .......... . . U U U . . 23 23 23 | |
| 492 | chk2cmp2 8 . . 0000000011...... A..DXWL... . . U U U . . 18 18 18 | |
| 493 | chk2cmp2 16 . pcdi 0000001011111010 .......... . . U U U . . 23 23 23 | |
| 494 | chk2cmp2 16 . pcix 0000001011111011 .......... . . U U U . . 23 23 23 | |
| 495 | chk2cmp2 16 . . 0000001011...... A..DXWL... . . U U U . . 18 18 18 | |
| 496 | chk2cmp2 32 . pcdi 0000010011111010 .......... . . U U U . . 23 23 23 | |
| 497 | chk2cmp2 32 . pcix 0000010011111011 .......... . . U U U . . 23 23 23 | |
| 498 | chk2cmp2 32 . . 0000010011...... A..DXWL... . . U U U . . 18 18 18 | |
| 499 | clr 8 . d 0100001000000... .......... U U U U U 4 4 2 2 2 | |
| 500 | clr 8 . . 0100001000...... A+-DXWL... U U U U U 8 4 4 4 4 | |
| 501 | clr 16 . d 0100001001000... .......... U U U U U 4 4 2 2 2 | |
| 502 | clr 16 . . 0100001001...... A+-DXWL... U U U U U 8 4 4 4 4 | |
| 503 | clr 32 . d 0100001010000... .......... U U U U U 6 6 2 2 2 | |
| 504 | clr 32 . . 0100001010...... A+-DXWL... U U U U U 12 6 4 4 4 | |
| 505 | cmp 8 . d 1011...000000... .......... U U U U U 4 4 2 2 2 | |
| 506 | cmp 8 . . 1011...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 507 | cmp 16 . d 1011...001000... .......... U U U U U 4 4 2 2 2 | |
| 508 | cmp 16 . a 1011...001001... .......... U U U U U 4 4 2 2 2 | |
| 509 | cmp 16 . . 1011...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 510 | cmp 32 . d 1011...010000... .......... U U U U U 6 6 2 2 2 | |
| 511 | cmp 32 . a 1011...010001... .......... U U U U U 6 6 2 2 2 | |
| 512 | cmp 32 . . 1011...010...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 513 | cmpa 16 . d 1011...011000... .......... U U U U U 6 6 4 4 4 | |
| 514 | cmpa 16 . a 1011...011001... .......... U U U U U 6 6 4 4 4 | |
| 515 | cmpa 16 . . 1011...011...... A+-DXWLdxI U U U U U 6 6 4 4 4 | |
| 516 | cmpa 32 . d 1011...111000... .......... U U U U U 6 6 4 4 4 | |
| 517 | cmpa 32 . a 1011...111001... .......... U U U U U 6 6 4 4 4 | |
| 518 | cmpa 32 . . 1011...111...... A+-DXWLdxI U U U U U 6 6 4 4 4 | |
| 519 | cmpi 8 . d 0000110000000... .......... U U U U U 8 8 2 2 2 | |
| 520 | cmpi 8 . . 0000110000...... A+-DXWL... U U U U U 8 8 2 2 2 | |
| 521 | cmpi 8 . pcdi 0000110000111010 .......... . . U U U . . 7 7 7 | |
| 522 | cmpi 8 . pcix 0000110000111011 .......... . . U U U . . 9 9 9 | |
| 523 | cmpi 16 . d 0000110001000... .......... U U U U U 8 8 2 2 2 | |
| 524 | cmpi 16 . . 0000110001...... A+-DXWL... U U U U U 8 8 2 2 2 | |
| 525 | cmpi 16 . pcdi 0000110001111010 .......... . . U U U . . 7 7 7 | |
| 526 | cmpi 16 . pcix 0000110001111011 .......... . . U U U . . 9 9 9 | |
| 527 | cmpi 32 . d 0000110010000... .......... U U U U U 14 12 2 2 2 | |
| 528 | cmpi 32 . . 0000110010...... A+-DXWL... U U U U U 12 12 2 2 2 | |
| 529 | cmpi 32 . pcdi 0000110010111010 .......... . . U U U . . 7 7 7 | |
| 530 | cmpi 32 . pcix 0000110010111011 .......... . . U U U . . 9 9 9 | |
| 531 | cmpm 8 . ax7 1011111100001... .......... U U U U U 12 12 9 9 9 | |
| 532 | cmpm 8 . ay7 1011...100001111 .......... U U U U U 12 12 9 9 9 | |
| 533 | cmpm 8 . axy7 1011111100001111 .......... U U U U U 12 12 9 9 9 | |
| 534 | cmpm 8 . . 1011...100001... .......... U U U U U 12 12 9 9 9 | |
| 535 | cmpm 16 . . 1011...101001... .......... U U U U U 12 12 9 9 9 | |
| 536 | cmpm 32 . . 1011...110001... .......... U U U U U 20 20 9 9 9 | |
| 537 | cpbcc 32 . . 1111...01....... .......... . . U U . . . 4 4 . unemulated | |
| 538 | cpdbcc 32 . . 1111...001001... .......... . . U U . . . 4 4 . unemulated | |
| 539 | cpgen 32 . . 1111...000...... .......... . . U U . . . 4 4 . unemulated | |
| 540 | cpscc 32 . . 1111...001...... .......... . . U U . . . 4 4 . unemulated | |
| 541 | cptrapcc 32 . . 1111...001111... .......... . . U U . . . 4 4 . unemulated | |
| 542 | dbt 16 . . 0101000011001... .......... U U U U U 12 12 6 6 6 | |
| 543 | dbf 16 . . 0101000111001... .......... U U U U U 12 12 6 6 6 | |
| 544 | dbcc 16 . . 0101....11001... .......... U U U U U 12 12 6 6 6 | |
| 545 | divs 16 . d 1000...111000... .......... U U U U U 158 122 56 56 56 | |
| 546 | divs 16 . . 1000...111...... A+-DXWLdxI U U U U U 158 122 56 56 56 | |
| 547 | divu 16 . d 1000...011000... .......... U U U U U 140 108 44 44 44 | |
| 548 | divu 16 . . 1000...011...... A+-DXWLdxI U U U U U 140 108 44 44 44 | |
| 549 | divl 32 . d 0100110001000... .......... . . U U U . . 84 84 84 | |
| 550 | divl 32 . . 0100110001...... A+-DXWLdxI . . U U U . . 84 84 84 | |
| 551 | eor 8 . d 1011...100000... .......... U U U U U 4 4 2 2 2 | |
| 552 | eor 8 . . 1011...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 553 | eor 16 . d 1011...101000... .......... U U U U U 4 4 2 2 2 | |
| 554 | eor 16 . . 1011...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 555 | eor 32 . d 1011...110000... .......... U U U U U 8 6 2 2 2 | |
| 556 | eor 32 . . 1011...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 557 | eori 16 toc . 0000101000111100 .......... U U U U U 20 16 12 12 12 | |
| 558 | eori 16 tos . 0000101001111100 .......... S S S S S 20 16 12 12 12 | |
| 559 | eori 8 . d 0000101000000... .......... U U U U U 8 8 2 2 2 | |
| 560 | eori 8 . . 0000101000...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 561 | eori 16 . d 0000101001000... .......... U U U U U 8 8 2 2 2 | |
| 562 | eori 16 . . 0000101001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 563 | eori 32 . d 0000101010000... .......... U U U U U 16 14 2 2 2 | |
| 564 | eori 32 . . 0000101010...... A+-DXWL... U U U U U 20 20 4 4 4 | |
| 565 | exg 32 dd . 1100...101000... .......... U U U U U 6 6 2 2 2 | |
| 566 | exg 32 aa . 1100...101001... .......... U U U U U 6 6 2 2 2 | |
| 567 | exg 32 da . 1100...110001... .......... U U U U U 6 6 2 2 2 | |
| 568 | ext 16 . . 0100100010000... .......... U U U U U 4 4 4 4 4 | |
| 569 | ext 32 . . 0100100011000... .......... U U U U U 4 4 4 4 4 | |
| 570 | extb 32 . . 0100100111000... .......... . . U U U . . 4 4 4 | |
| 571 | illegal 0 . . 0100101011111100 .......... U U U U U 4 4 4 4 4 | |
| 572 | jmp 32 . . 0100111011...... A..DXWLdx. U U U U U 4 4 0 0 0 | |
| 573 | jsr 32 . . 0100111010...... A..DXWLdx. U U U U U 12 12 0 0 0 | |
| 574 | lea 32 . . 0100...111...... A..DXWLdx. U U U U U 0 0 2 2 2 | |
| 575 | link 16 . a7 0100111001010111 .......... U U U U U 16 16 5 5 5 | |
| 576 | link 16 . . 0100111001010... .......... U U U U U 16 16 5 5 5 | |
| 577 | link 32 . a7 0100100000001111 .......... . . U U U . . 6 6 6 | |
| 578 | link 32 . . 0100100000001... .......... . . U U U . . 6 6 6 | |
| 579 | lsr 8 s . 1110...000001... .......... U U U U U 6 6 4 4 4 | |
| 580 | lsr 16 s . 1110...001001... .......... U U U U U 6 6 4 4 4 | |
| 581 | lsr 32 s . 1110...010001... .......... U U U U U 8 8 4 4 4 | |
| 582 | lsr 8 r . 1110...000101... .......... U U U U U 6 6 6 6 6 | |
| 583 | lsr 16 r . 1110...001101... .......... U U U U U 6 6 6 6 6 | |
| 584 | lsr 32 r . 1110...010101... .......... U U U U U 8 8 6 6 6 | |
| 585 | lsr 16 . . 1110001011...... A+-DXWL... U U U U U 8 8 5 5 5 | |
| 586 | lsl 8 s . 1110...100001... .......... U U U U U 6 6 4 4 4 | |
| 587 | lsl 16 s . 1110...101001... .......... U U U U U 6 6 4 4 4 | |
| 588 | lsl 32 s . 1110...110001... .......... U U U U U 8 8 4 4 4 | |
| 589 | lsl 8 r . 1110...100101... .......... U U U U U 6 6 6 6 6 | |
| 590 | lsl 16 r . 1110...101101... .......... U U U U U 6 6 6 6 6 | |
| 591 | lsl 32 r . 1110...110101... .......... U U U U U 8 8 6 6 6 | |
| 592 | lsl 16 . . 1110001111...... A+-DXWL... U U U U U 8 8 5 5 5 | |
| 593 | move 8 d d 0001...000000... .......... U U U U U 4 4 2 2 2 | |
| 594 | move 8 d . 0001...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 595 | move 8 ai d 0001...010000... .......... U U U U U 8 8 4 4 4 | |
| 596 | move 8 ai . 0001...010...... A+-DXWLdxI U U U U U 8 8 4 4 4 | |
| 597 | move 8 pi d 0001...011000... .......... U U U U U 8 8 4 4 4 | |
| 598 | move 8 pi . 0001...011...... A+-DXWLdxI U U U U U 8 8 4 4 4 | |
| 599 | move 8 pi7 d 0001111011000... .......... U U U U U 8 8 4 4 4 | |
| 600 | move 8 pi7 . 0001111011...... A+-DXWLdxI U U U U U 8 8 4 4 4 | |
| 601 | move 8 pd d 0001...100000... .......... U U U U U 8 8 5 5 5 | |
| 602 | move 8 pd . 0001...100...... A+-DXWLdxI U U U U U 8 8 5 5 5 | |
| 603 | move 8 pd7 d 0001111100000... .......... U U U U U 8 8 5 5 5 | |
| 604 | move 8 pd7 . 0001111100...... A+-DXWLdxI U U U U U 8 8 5 5 5 | |
| 605 | move 8 di d 0001...101000... .......... U U U U U 12 12 5 5 5 | |
| 606 | move 8 di . 0001...101...... A+-DXWLdxI U U U U U 12 12 5 5 5 | |
| 607 | move 8 ix d 0001...110000... .......... U U U U U 14 14 7 7 7 | |
| 608 | move 8 ix . 0001...110...... A+-DXWLdxI U U U U U 14 14 7 7 7 | |
| 609 | move 8 aw d 0001000111000... .......... U U U U U 12 12 4 4 4 | |
| 610 | move 8 aw . 0001000111...... A+-DXWLdxI U U U U U 12 12 4 4 4 | |
| 611 | move 8 al d 0001001111000... .......... U U U U U 16 16 6 6 6 | |
| 612 | move 8 al . 0001001111...... A+-DXWLdxI U U U U U 16 16 6 6 6 | |
| 613 | move 16 d d 0011...000000... .......... U U U U U 4 4 2 2 2 | |
| 614 | move 16 d a 0011...000001... .......... U U U U U 4 4 2 2 2 | |
| 615 | move 16 d . 0011...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 616 | move 16 ai d 0011...010000... .......... U U U U U 8 8 4 4 4 | |
| 617 | move 16 ai a 0011...010001... .......... U U U U U 8 8 4 4 4 | |
| 618 | move 16 ai . 0011...010...... A+-DXWLdxI U U U U U 8 8 4 4 4 | |
| 619 | move 16 pi d 0011...011000... .......... U U U U U 8 8 4 4 4 | |
| 620 | move 16 pi a 0011...011001... .......... U U U U U 8 8 4 4 4 | |
| 621 | move 16 pi . 0011...011...... A+-DXWLdxI U U U U U 8 8 4 4 4 | |
| 622 | move 16 pd d 0011...100000... .......... U U U U U 8 8 5 5 5 | |
| 623 | move 16 pd a 0011...100001... .......... U U U U U 8 8 5 5 5 | |
| 624 | move 16 pd . 0011...100...... A+-DXWLdxI U U U U U 8 8 5 5 5 | |
| 625 | move 16 di d 0011...101000... .......... U U U U U 12 12 5 5 5 | |
| 626 | move 16 di a 0011...101001... .......... U U U U U 12 12 5 5 5 | |
| 627 | move 16 di . 0011...101...... A+-DXWLdxI U U U U U 12 12 5 5 5 | |
| 628 | move 16 ix d 0011...110000... .......... U U U U U 14 14 7 7 7 | |
| 629 | move 16 ix a 0011...110001... .......... U U U U U 14 14 7 7 7 | |
| 630 | move 16 ix . 0011...110...... A+-DXWLdxI U U U U U 14 14 7 7 7 | |
| 631 | move 16 aw d 0011000111000... .......... U U U U U 12 12 4 4 4 | |
| 632 | move 16 aw a 0011000111001... .......... U U U U U 12 12 4 4 4 | |
| 633 | move 16 aw . 0011000111...... A+-DXWLdxI U U U U U 12 12 4 4 4 | |
| 634 | move 16 al d 0011001111000... .......... U U U U U 16 16 6 6 6 | |
| 635 | move 16 al a 0011001111001... .......... U U U U U 16 16 6 6 6 | |
| 636 | move 16 al . 0011001111...... A+-DXWLdxI U U U U U 16 16 6 6 6 | |
| 637 | move 32 d d 0010...000000... .......... U U U U U 4 4 2 2 2 | |
| 638 | move 32 d a 0010...000001... .......... U U U U U 4 4 2 2 2 | |
| 639 | move 32 d . 0010...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 640 | move 32 ai d 0010...010000... .......... U U U U U 12 12 4 4 4 | |
| 641 | move 32 ai a 0010...010001... .......... U U U U U 12 12 4 4 4 | |
| 642 | move 32 ai . 0010...010...... A+-DXWLdxI U U U U U 12 12 4 4 4 | |
| 643 | move 32 pi d 0010...011000... .......... U U U U U 12 12 4 4 4 | |
| 644 | move 32 pi a 0010...011001... .......... U U U U U 12 12 4 4 4 | |
| 645 | move 32 pi . 0010...011...... A+-DXWLdxI U U U U U 12 12 4 4 4 | |
| 646 | move 32 pd d 0010...100000... .......... U U U U U 12 14 5 5 5 | |
| 647 | move 32 pd a 0010...100001... .......... U U U U U 12 14 5 5 5 | |
| 648 | move 32 pd . 0010...100...... A+-DXWLdxI U U U U U 12 14 5 5 5 | |
| 649 | move 32 di d 0010...101000... .......... U U U U U 16 16 5 5 5 | |
| 650 | move 32 di a 0010...101001... .......... U U U U U 16 16 5 5 5 | |
| 651 | move 32 di . 0010...101...... A+-DXWLdxI U U U U U 16 16 5 5 5 | |
| 652 | move 32 ix d 0010...110000... .......... U U U U U 18 18 7 7 7 | |
| 653 | move 32 ix a 0010...110001... .......... U U U U U 18 18 7 7 7 | |
| 654 | move 32 ix . 0010...110...... A+-DXWLdxI U U U U U 18 18 7 7 7 | |
| 655 | move 32 aw d 0010000111000... .......... U U U U U 16 16 4 4 4 | |
| 656 | move 32 aw a 0010000111001... .......... U U U U U 16 16 4 4 4 | |
| 657 | move 32 aw . 0010000111...... A+-DXWLdxI U U U U U 16 16 4 4 4 | |
| 658 | move 32 al d 0010001111000... .......... U U U U U 20 20 6 6 6 | |
| 659 | move 32 al a 0010001111001... .......... U U U U U 20 20 6 6 6 | |
| 660 | move 32 al . 0010001111...... A+-DXWLdxI U U U U U 20 20 6 6 6 | |
| 661 | movea 16 . d 0011...001000... .......... U U U U U 4 4 2 2 2 | |
| 662 | movea 16 . a 0011...001001... .......... U U U U U 4 4 2 2 2 | |
| 663 | movea 16 . . 0011...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 664 | movea 32 . d 0010...001000... .......... U U U U U 4 4 2 2 2 | |
| 665 | movea 32 . a 0010...001001... .......... U U U U U 4 4 2 2 2 | |
| 666 | movea 32 . . 0010...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 667 | move 16 frc d 0100001011000... .......... . U U U U . 4 4 4 4 | |
| 668 | move 16 frc . 0100001011...... A+-DXWL... . U U U U . 8 4 4 4 | |
| 669 | move 16 toc d 0100010011000... .......... U U U U U 12 12 4 4 4 | |
| 670 | move 16 toc . 0100010011...... A+-DXWLdxI U U U U U 12 12 4 4 4 | |
| 671 | move 16 frs d 0100000011000... .......... U S S S S 6 4 8 8 8 U only for 000 | |
| 672 | move 16 frs . 0100000011...... A+-DXWL... U S S S S 8 8 8 8 8 U only for 000 | |
| 673 | move 16 tos d 0100011011000... .......... S S S S S 12 12 8 8 8 | |
| 674 | move 16 tos . 0100011011...... A+-DXWLdxI S S S S S 12 12 8 8 8 | |
| 675 | move 32 fru . 0100111001101... .......... S S S S S 4 6 2 2 2 | |
| 676 | move 32 tou . 0100111001100... .......... S S S S S 4 6 2 2 2 | |
| 677 | movec 32 cr . 0100111001111010 .......... . S S S S . 12 6 6 6 | |
| 678 | movec 32 rc . 0100111001111011 .......... . S S S S . 10 12 12 12 | |
| 679 | movem 16 re pd 0100100010100... .......... U U U U U 8 8 4 4 4 | |
| 680 | movem 16 re . 0100100010...... A..DXWL... U U U U U 8 8 4 4 4 | |
| 681 | movem 32 re pd 0100100011100... .......... U U U U U 8 8 4 4 4 | |
| 682 | movem 32 re . 0100100011...... A..DXWL... U U U U U 8 8 4 4 4 | |
| 683 | movem 16 er pi 0100110010011... .......... U U U U U 12 12 8 8 8 | |
| 684 | movem 16 er pcdi 0100110010111010 .......... U U U U U 16 16 9 9 9 | |
| 685 | movem 16 er pcix 0100110010111011 .......... U U U U U 18 18 11 11 11 | |
| 686 | movem 16 er . 0100110010...... A..DXWL... U U U U U 12 12 8 8 8 | |
| 687 | movem 32 er pi 0100110011011... .......... U U U U U 12 12 8 8 8 | |
| 688 | movem 32 er pcdi 0100110011111010 .......... U U U U U 16 16 9 9 9 | |
| 689 | movem 32 er pcix 0100110011111011 .......... U U U U U 18 18 11 11 11 | |
| 690 | movem 32 er . 0100110011...... A..DXWL... U U U U U 12 12 8 8 8 | |
| 691 | movep 16 er . 0000...100001... .......... U U U U U 16 16 12 12 12 | |
| 692 | movep 32 er . 0000...101001... .......... U U U U U 24 24 18 18 18 | |
| 693 | movep 16 re . 0000...110001... .......... U U U U U 16 16 11 11 11 | |
| 694 | movep 32 re . 0000...111001... .......... U U U U U 24 24 17 17 17 | |
| 695 | moveq 32 . . 0111...0........ .......... U U U U U 4 4 2 2 2 | |
| 696 | moves 8 . . 0000111000...... A+-DXWL... . S S S S . 14 5 5 5 | |
| 697 | moves 16 . . 0000111001...... A+-DXWL... . S S S S . 14 5 5 5 | |
| 698 | moves 32 . . 0000111010...... A+-DXWL... . S S S S . 16 5 5 5 | |
| 699 | move16 32 . . 1111011000100... .......... . . . . U . . . . 4 TODO: correct timing | |
| 700 | muls 16 . d 1100...111000... .......... U U U U U 54 32 27 27 27 | |
| 701 | muls 16 . . 1100...111...... A+-DXWLdxI U U U U U 54 32 27 27 27 | |
| 702 | mulu 16 . d 1100...011000... .......... U U U U U 54 30 27 27 27 | |
| 703 | mulu 16 . . 1100...011...... A+-DXWLdxI U U U U U 54 30 27 27 27 | |
| 704 | mull 32 . d 0100110000000... .......... . . U U U . . 43 43 43 | |
| 705 | mull 32 . . 0100110000...... A+-DXWLdxI . . U U U . . 43 43 43 | |
| 706 | nbcd 8 . d 0100100000000... .......... U U U U U 6 6 6 6 6 | |
| 707 | nbcd 8 . . 0100100000...... A+-DXWL... U U U U U 8 8 6 6 6 | |
| 708 | neg 8 . d 0100010000000... .......... U U U U U 4 4 2 2 2 | |
| 709 | neg 8 . . 0100010000...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 710 | neg 16 . d 0100010001000... .......... U U U U U 4 4 2 2 2 | |
| 711 | neg 16 . . 0100010001...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 712 | neg 32 . d 0100010010000... .......... U U U U U 6 6 2 2 2 | |
| 713 | neg 32 . . 0100010010...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 714 | negx 8 . d 0100000000000... .......... U U U U U 4 4 2 2 2 | |
| 715 | negx 8 . . 0100000000...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 716 | negx 16 . d 0100000001000... .......... U U U U U 4 4 2 2 2 | |
| 717 | negx 16 . . 0100000001...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 718 | negx 32 . d 0100000010000... .......... U U U U U 6 6 2 2 2 | |
| 719 | negx 32 . . 0100000010...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 720 | nop 0 . . 0100111001110001 .......... U U U U U 4 4 2 2 2 | |
| 721 | not 8 . d 0100011000000... .......... U U U U U 4 4 2 2 2 | |
| 722 | not 8 . . 0100011000...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 723 | not 16 . d 0100011001000... .......... U U U U U 4 4 2 2 2 | |
| 724 | not 16 . . 0100011001...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 725 | not 32 . d 0100011010000... .......... U U U U U 6 6 2 2 2 | |
| 726 | not 32 . . 0100011010...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 727 | or 8 er d 1000...000000... .......... U U U U U 4 4 2 2 2 | |
| 728 | or 8 er . 1000...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 729 | or 16 er d 1000...001000... .......... U U U U U 4 4 2 2 2 | |
| 730 | or 16 er . 1000...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 731 | or 32 er d 1000...010000... .......... U U U U U 6 6 2 2 2 | |
| 732 | or 32 er . 1000...010...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 733 | or 8 re . 1000...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 734 | or 16 re . 1000...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 735 | or 32 re . 1000...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 736 | ori 16 toc . 0000000000111100 .......... U U U U U 20 16 12 12 12 | |
| 737 | ori 16 tos . 0000000001111100 .......... S S S S S 20 16 12 12 12 | |
| 738 | ori 8 . d 0000000000000... .......... U U U U U 8 8 2 2 2 | |
| 739 | ori 8 . . 0000000000...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 740 | ori 16 . d 0000000001000... .......... U U U U U 8 8 2 2 2 | |
| 741 | ori 16 . . 0000000001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 742 | ori 32 . d 0000000010000... .......... U U U U U 16 14 2 2 2 | |
| 743 | ori 32 . . 0000000010...... A+-DXWL... U U U U U 20 20 4 4 4 | |
| 744 | pack 16 rr . 1000...101000... .......... . . U U U . . 6 6 6 | |
| 745 | pack 16 mm ax7 1000111101001... .......... . . U U U . . 13 13 13 | |
| 746 | pack 16 mm ay7 1000...101001111 .......... . . U U U . . 13 13 13 | |
| 747 | pack 16 mm axy7 1000111101001111 .......... . . U U U . . 13 13 13 | |
| 748 | pack 16 mm . 1000...101001... .......... . . U U U . . 13 13 13 | |
| 749 | pea 32 . . 0100100001...... A..DXWLdx. U U U U U 6 6 5 5 5 | |
| 750 | pflush 32 . . 1111010100011000 .......... . . . . S . . . . 4 TODO: correct timing | |
| 751 | pmove 32 . . 1111000000...... A..DXWLdx. . . S S S . . 8 8 8 | |
| 752 | reset 0 . . 0100111001110000 .......... S S S S S 0 0 0 0 0 | |
| 753 | ror 8 s . 1110...000011... .......... U U U U U 6 6 8 8 8 | |
| 754 | ror 16 s . 1110...001011... .......... U U U U U 6 6 8 8 8 | |
| 755 | ror 32 s . 1110...010011... .......... U U U U U 8 8 8 8 8 | |
| 756 | ror 8 r . 1110...000111... .......... U U U U U 6 6 8 8 8 | |
| 757 | ror 16 r . 1110...001111... .......... U U U U U 6 6 8 8 8 | |
| 758 | ror 32 r . 1110...010111... .......... U U U U U 8 8 8 8 8 | |
| 759 | ror 16 . . 1110011011...... A+-DXWL... U U U U U 8 8 7 7 7 | |
| 760 | rol 8 s . 1110...100011... .......... U U U U U 6 6 8 8 8 | |
| 761 | rol 16 s . 1110...101011... .......... U U U U U 6 6 8 8 8 | |
| 762 | rol 32 s . 1110...110011... .......... U U U U U 8 8 8 8 8 | |
| 763 | rol 8 r . 1110...100111... .......... U U U U U 6 6 8 8 8 | |
| 764 | rol 16 r . 1110...101111... .......... U U U U U 6 6 8 8 8 | |
| 765 | rol 32 r . 1110...110111... .......... U U U U U 8 8 8 8 8 | |
| 766 | rol 16 . . 1110011111...... A+-DXWL... U U U U U 8 8 7 7 7 | |
| 767 | roxr 8 s . 1110...000010... .......... U U U U U 6 6 12 12 12 | |
| 768 | roxr 16 s . 1110...001010... .......... U U U U U 6 6 12 12 12 | |
| 769 | roxr 32 s . 1110...010010... .......... U U U U U 8 8 12 12 12 | |
| 770 | roxr 8 r . 1110...000110... .......... U U U U U 6 6 12 12 12 | |
| 771 | roxr 16 r . 1110...001110... .......... U U U U U 6 6 12 12 12 | |
| 772 | roxr 32 r . 1110...010110... .......... U U U U U 8 8 12 12 12 | |
| 773 | roxr 16 . . 1110010011...... A+-DXWL... U U U U U 8 8 5 5 5 | |
| 774 | roxl 8 s . 1110...100010... .......... U U U U U 6 6 12 12 12 | |
| 775 | roxl 16 s . 1110...101010... .......... U U U U U 6 6 12 12 12 | |
| 776 | roxl 32 s . 1110...110010... .......... U U U U U 8 8 12 12 12 | |
| 777 | roxl 8 r . 1110...100110... .......... U U U U U 6 6 12 12 12 | |
| 778 | roxl 16 r . 1110...101110... .......... U U U U U 6 6 12 12 12 | |
| 779 | roxl 32 r . 1110...110110... .......... U U U U U 8 8 12 12 12 | |
| 780 | roxl 16 . . 1110010111...... A+-DXWL... U U U U U 8 8 5 5 5 | |
| 781 | rtd 32 . . 0100111001110100 .......... . U U U U . 16 10 10 10 | |
| 782 | rte 32 . . 0100111001110011 .......... S S S S S 20 24 20 20 20 bus fault not emulated | |
| 783 | rtm 32 . . 000001101100.... .......... . . U U U . . 19 19 19 not properly emulated | |
| 784 | rtr 32 . . 0100111001110111 .......... U U U U U 20 20 14 14 14 | |
| 785 | rts 32 . . 0100111001110101 .......... U U U U U 16 16 10 10 10 | |
| 786 | sbcd 8 rr . 1000...100000... .......... U U U U U 6 6 4 4 4 | |
| 787 | sbcd 8 mm ax7 1000111100001... .......... U U U U U 18 18 16 16 16 | |
| 788 | sbcd 8 mm ay7 1000...100001111 .......... U U U U U 18 18 16 16 16 | |
| 789 | sbcd 8 mm axy7 1000111100001111 .......... U U U U U 18 18 16 16 16 | |
| 790 | sbcd 8 mm . 1000...100001... .......... U U U U U 18 18 16 16 16 | |
| 791 | st 8 . d 0101000011000... .......... U U U U U 6 4 4 4 4 | |
| 792 | st 8 . . 0101000011...... A+-DXWL... U U U U U 8 8 6 6 6 | |
| 793 | sf 8 . d 0101000111000... .......... U U U U U 4 4 4 4 4 | |
| 794 | sf 8 . . 0101000111...... A+-DXWL... U U U U U 8 8 6 6 6 | |
| 795 | scc 8 . d 0101....11000... .......... U U U U U 4 4 4 4 4 | |
| 796 | scc 8 . . 0101....11...... A+-DXWL... U U U U U 8 8 6 6 6 | |
| 797 | stop 0 . . 0100111001110010 .......... S S S S S 4 4 8 8 8 | |
| 798 | sub 8 er d 1001...000000... .......... U U U U U 4 4 2 2 2 | |
| 799 | sub 8 er . 1001...000...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 800 | sub 16 er d 1001...001000... .......... U U U U U 4 4 2 2 2 | |
| 801 | sub 16 er a 1001...001001... .......... U U U U U 4 4 2 2 2 | |
| 802 | sub 16 er . 1001...001...... A+-DXWLdxI U U U U U 4 4 2 2 2 | |
| 803 | sub 32 er d 1001...010000... .......... U U U U U 6 6 2 2 2 | |
| 804 | sub 32 er a 1001...010001... .......... U U U U U 6 6 2 2 2 | |
| 805 | sub 32 er . 1001...010...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 806 | sub 8 re . 1001...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 807 | sub 16 re . 1001...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 808 | sub 32 re . 1001...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 809 | suba 16 . d 1001...011000... .......... U U U U U 8 8 2 2 2 | |
| 810 | suba 16 . a 1001...011001... .......... U U U U U 8 8 2 2 2 | |
| 811 | suba 16 . . 1001...011...... A+-DXWLdxI U U U U U 8 8 2 2 2 | |
| 812 | suba 32 . d 1001...111000... .......... U U U U U 6 6 2 2 2 | |
| 813 | suba 32 . a 1001...111001... .......... U U U U U 6 6 2 2 2 | |
| 814 | suba 32 . . 1001...111...... A+-DXWLdxI U U U U U 6 6 2 2 2 | |
| 815 | subi 8 . d 0000010000000... .......... U U U U U 8 8 2 2 2 | |
| 816 | subi 8 . . 0000010000...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 817 | subi 16 . d 0000010001000... .......... U U U U U 8 8 2 2 2 | |
| 818 | subi 16 . . 0000010001...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 819 | subi 32 . d 0000010010000... .......... U U U U U 16 14 2 2 2 | |
| 820 | subi 32 . . 0000010010...... A+-DXWL... U U U U U 20 20 4 4 4 | |
| 821 | subq 8 . d 0101...100000... .......... U U U U U 4 4 2 2 2 | |
| 822 | subq 8 . . 0101...100...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 823 | subq 16 . d 0101...101000... .......... U U U U U 4 4 2 2 2 | |
| 824 | subq 16 . a 0101...101001... .......... U U U U U 8 4 2 2 2 | |
| 825 | subq 16 . . 0101...101...... A+-DXWL... U U U U U 8 8 4 4 4 | |
| 826 | subq 32 . d 0101...110000... .......... U U U U U 8 8 2 2 2 | |
| 827 | subq 32 . a 0101...110001... .......... U U U U U 8 8 2 2 2 | |
| 828 | subq 32 . . 0101...110...... A+-DXWL... U U U U U 12 12 4 4 4 | |
| 829 | subx 8 rr . 1001...100000... .......... U U U U U 4 4 2 2 2 | |
| 830 | subx 16 rr . 1001...101000... .......... U U U U U 4 4 2 2 2 | |
| 831 | subx 32 rr . 1001...110000... .......... U U U U U 8 6 2 2 2 | |
| 832 | subx 8 mm ax7 1001111100001... .......... U U U U U 18 18 12 12 12 | |
| 833 | subx 8 mm ay7 1001...100001111 .......... U U U U U 18 18 12 12 12 | |
| 834 | subx 8 mm axy7 1001111100001111 .......... U U U U U 18 18 12 12 12 | |
| 835 | subx 8 mm . 1001...100001... .......... U U U U U 18 18 12 12 12 | |
| 836 | subx 16 mm . 1001...101001... .......... U U U U U 18 18 12 12 12 | |
| 837 | subx 32 mm . 1001...110001... .......... U U U U U 30 30 12 12 12 | |
| 838 | swap 32 . . 0100100001000... .......... U U U U U 4 4 4 4 4 | |
| 839 | tas 8 . d 0100101011000... .......... U U U U U 4 4 4 4 4 | |
| 840 | tas 8 . . 0100101011...... A+-DXWL... U U U U U 14 14 12 12 12 | |
| 841 | trap 0 . . 010011100100.... .......... U U U U U 4 4 4 4 4 | |
| 842 | trapt 0 . . 0101000011111100 .......... . . U U U . . 4 4 4 | |
| 843 | trapt 16 . . 0101000011111010 .......... . . U U U . . 6 6 6 | |
| 844 | trapt 32 . . 0101000011111011 .......... . . U U U . . 8 8 8 | |
| 845 | trapf 0 . . 0101000111111100 .......... . . U U U . . 4 4 4 | |
| 846 | trapf 16 . . 0101000111111010 .......... . . U U U . . 6 6 6 | |
| 847 | trapf 32 . . 0101000111111011 .......... . . U U U . . 8 8 8 | |
| 848 | trapcc 0 . . 0101....11111100 .......... . . U U U . . 4 4 4 | |
| 849 | trapcc 16 . . 0101....11111010 .......... . . U U U . . 6 6 6 | |
| 850 | trapcc 32 . . 0101....11111011 .......... . . U U U . . 8 8 8 | |
| 851 | trapv 0 . . 0100111001110110 .......... U U U U U 4 4 4 4 4 | |
| 852 | tst 8 . d 0100101000000... .......... U U U U U 4 4 2 2 2 | |
| 853 | tst 8 . . 0100101000...... A+-DXWL... U U U U U 4 4 2 2 2 | |
| 854 | tst 8 . pcdi 0100101000111010 .......... . . U U U . . 7 7 7 | |
| 855 | tst 8 . pcix 0100101000111011 .......... . . U U U . . 9 9 9 | |
| 856 | tst 8 . i 0100101000111100 .......... . . U U U . . 6 6 6 | |
| 857 | tst 16 . d 0100101001000... .......... U U U U U 4 4 2 2 2 | |
| 858 | tst 16 . a 0100101001001... .......... . . U U U . . 2 2 2 | |
| 859 | tst 16 . . 0100101001...... A+-DXWL... U U U U U 4 4 2 2 2 | |
| 860 | tst 16 . pcdi 0100101001111010 .......... . . U U U . . 7 7 7 | |
| 861 | tst 16 . pcix 0100101001111011 .......... . . U U U . . 9 9 9 | |
| 862 | tst 16 . i 0100101001111100 .......... . . U U U . . 6 6 6 | |
| 863 | tst 32 . d 0100101010000... .......... U U U U U 4 4 2 2 2 | |
| 864 | tst 32 . a 0100101010001... .......... . . U U U . . 2 2 2 | |
| 865 | tst 32 . . 0100101010...... A+-DXWL... U U U U U 4 4 2 2 2 | |
| 866 | tst 32 . pcdi 0100101010111010 .......... . . U U U . . 7 7 7 | |
| 867 | tst 32 . pcix 0100101010111011 .......... . . U U U . . 9 9 9 | |
| 868 | tst 32 . i 0100101010111100 .......... . . U U U . . 6 6 6 | |
| 869 | unlk 32 . a7 0100111001011111 .......... U U U U U 12 12 6 6 6 | |
| 870 | unlk 32 . . 0100111001011... .......... U U U U U 12 12 6 6 6 | |
| 871 | unpk 16 rr . 1000...110000... .......... . . U U U . . 8 8 8 | |
| 872 | unpk 16 mm ax7 1000111110001... .......... . . U U U . . 13 13 13 | |
| 873 | unpk 16 mm ay7 1000...110001111 .......... . . U U U . . 13 13 13 | |
| 874 | unpk 16 mm axy7 1000111110001111 .......... . . U U U . . 13 13 13 | |
| 875 | unpk 16 mm . 1000...110001... .......... . . U U U . . 13 13 13 | |
| 875 | 876 | |
| 876 | 877 | |
| 877 | 878 | |
| r5955 | r5956 | |
| 6666 | 6667 | m68k->dfc = REG_DA[(word2 >> 12) & 15] & 7; |
| 6667 | 6668 | return; |
| 6668 | 6669 | case 0x002: /* CACR */ |
| 6670 | /* Only EC020 and later have CACR */ | |
| 6669 | 6671 | if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type)) |
| 6670 | 6672 | { |
| 6673 | /* 68030 can write all bits except 5-7, 040 can write all */ | |
| 6671 | 6674 | if (CPU_TYPE_IS_040_PLUS(m68k->cpu_type)) |
| 6672 | 6675 | { |
| 6673 | 6676 | m68k->cacr = REG_DA[(word2 >> 12) & 15]; |
| 6674 | 6677 | } |
| 6678 | else if (CPU_TYPE_IS_030_PLUS(m68k->cpu_type)) | |
| 6679 | { | |
| 6680 | m68k->cacr = REG_DA[(word2 >> 12) & 15] & 0xff1f; | |
| 6681 | } | |
| 6675 | 6682 | else |
| 6676 | 6683 | { |
| 6677 | /* non 68040 can only set the lower 4 bits (C,CE,F,E) */ | |
| 6678 | 6684 | m68k->cacr = REG_DA[(word2 >> 12) & 15] & 0x0f; |
| 6679 | 6685 | } |
| 6680 | 6686 | return; |
| r5955 | r5956 | |
| 7991 | 7997 | |
| 7992 | 7998 | M68KMAKE_OP(pflush, 32, ., .) |
| 7993 | 7999 | { |
| 7994 | if(CPU_TYPE_IS_040_PLUS(m68k->cpu_type)) | |
| 8000 | if ((CPU_TYPE_IS_040_PLUS(m68k->cpu_type)) && (m68k->has_pmmu)) | |
| 7995 | 8001 | { |
| 7996 | 8002 | // Nothing to do, unless address translation cache is emulated |
| 8003 | logerror("680x0: unhandled PFLUSH\n"); | |
| 7997 | 8004 | return; |
| 7998 | 8005 | } |
| 7999 | 8006 | m68ki_exception_illegal(m68k); |
| 8000 | 8007 | } |
| 8001 | 8008 | |
| 8009 | M68KMAKE_OP(pmove, 32, ., .) | |
| 8010 | { | |
| 8011 | UINT16 modes; | |
| 8012 | UINT32 ea; | |
| 8002 | 8013 | |
| 8014 | modes = m68ki_read_imm_16(m68k); | |
| 8015 | ea = M68KMAKE_GET_EA_AY_32; | |
| 8016 | ||
| 8017 | if ((CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type)) && (m68k->has_pmmu)) | |
| 8018 | { | |
| 8019 | logerror("680x0: unhandled PMOVE modes %x ea %x\n", modes, ea); | |
| 8020 | } | |
| 8021 | else | |
| 8022 | { | |
| 8023 | m68ki_exception_illegal(m68k); | |
| 8024 | } | |
| 8025 | } | |
| 8026 | ||
| 8003 | 8027 | M68KMAKE_OP(reset, 0, ., .) |
| 8004 | 8028 | { |
| 8005 | 8029 | if(m68k->s_flag) |
| r5955 | r5956 | |
|---|---|---|
| 5 | 5 | #if 0 |
| 6 | 6 | static const char copyright_notice[] = |
| 7 | 7 | "MUSASHI\n" |
| 8 | "Version 4.0 | |
| 8 | "Version 4.10 | |
| 9 | 9 | "A portable Motorola M680x0 processor emulation engine.\n" |
| 10 | 10 | "Copyright Karl Stenerud. All rights reserved.\n" |
| 11 | 11 | "\n" |
| r5955 | r5956 | |
| 17 | 17 | "(Karl Stenerud).\n" |
| 18 | 18 | "\n" |
| 19 | 19 | "The latest version of this code can be obtained at:\n" |
| 20 | "http://kstenerud.cjb.net\n" | |
| 20 | "http://kstenerud.cjb.net or http://mamedev.org\n" | |
| 21 | 21 | ; |
| 22 | 22 | #endif |
| 23 | 23 | |
| r5955 | r5956 | |
| 85 | 85 | /* Number of clock cycles to use for exception processing. |
| 86 | 86 | * I used 4 for any vectors that are undocumented for processing times. |
| 87 | 87 | */ |
| 88 | const UINT8 m68ki_exception_cycle_table[ | |
| 88 | const UINT8 m68ki_exception_cycle_table[5][256] = | |
| 89 | 89 | { |
| 90 | 90 | { /* 000 */ |
| 91 | 91 | 40, /* 0: Reset - Initial Stack Pointer */ |
| r5955 | r5956 | |
| 306 | 306 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, |
| 307 | 307 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 |
| 308 | 308 | }, |
| 309 | { /* 030 - not correct */ | |
| 310 | 4, /* 0: Reset - Initial Stack Pointer */ | |
| 311 | 4, /* 1: Reset - Initial Program Counter */ | |
| 312 | 50, /* 2: Bus Error (unemulated) */ | |
| 313 | 50, /* 3: Address Error (unemulated) */ | |
| 314 | 20, /* 4: Illegal Instruction */ | |
| 315 | 38, /* 5: Divide by Zero */ | |
| 316 | 40, /* 6: CHK */ | |
| 317 | 20, /* 7: TRAPV */ | |
| 318 | 34, /* 8: Privilege Violation */ | |
| 319 | 25, /* 9: Trace */ | |
| 320 | 20, /* 10: 1010 */ | |
| 321 | 20, /* 11: 1111 */ | |
| 322 | 4, /* 12: RESERVED */ | |
| 323 | 4, /* 13: Coprocessor Protocol Violation (unemulated) */ | |
| 324 | 4, /* 14: Format Error */ | |
| 325 | 30, /* 15: Uninitialized Interrupt */ | |
| 326 | 4, /* 16: RESERVED */ | |
| 327 | 4, /* 17: RESERVED */ | |
| 328 | 4, /* 18: RESERVED */ | |
| 329 | 4, /* 19: RESERVED */ | |
| 330 | 4, /* 20: RESERVED */ | |
| 331 | 4, /* 21: RESERVED */ | |
| 332 | 4, /* 22: RESERVED */ | |
| 333 | 4, /* 23: RESERVED */ | |
| 334 | 30, /* 24: Spurious Interrupt */ | |
| 335 | 30, /* 25: Level 1 Interrupt Autovector */ | |
| 336 | 30, /* 26: Level 2 Interrupt Autovector */ | |
| 337 | 30, /* 27: Level 3 Interrupt Autovector */ | |
| 338 | 30, /* 28: Level 4 Interrupt Autovector */ | |
| 339 | 30, /* 29: Level 5 Interrupt Autovector */ | |
| 340 | 30, /* 30: Level 6 Interrupt Autovector */ | |
| 341 | 30, /* 31: Level 7 Interrupt Autovector */ | |
| 342 | 20, /* 32: TRAP #0 */ | |
| 343 | 20, /* 33: TRAP #1 */ | |
| 344 | 20, /* 34: TRAP #2 */ | |
| 345 | 20, /* 35: TRAP #3 */ | |
| 346 | 20, /* 36: TRAP #4 */ | |
| 347 | 20, /* 37: TRAP #5 */ | |
| 348 | 20, /* 38: TRAP #6 */ | |
| 349 | 20, /* 39: TRAP #7 */ | |
| 350 | 20, /* 40: TRAP #8 */ | |
| 351 | 20, /* 41: TRAP #9 */ | |
| 352 | 20, /* 42: TRAP #10 */ | |
| 353 | 20, /* 43: TRAP #11 */ | |
| 354 | 20, /* 44: TRAP #12 */ | |
| 355 | 20, /* 45: TRAP #13 */ | |
| 356 | 20, /* 46: TRAP #14 */ | |
| 357 | 20, /* 47: TRAP #15 */ | |
| 358 | 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ | |
| 359 | 4, /* 49: FP Inexact Result (unemulated) */ | |
| 360 | 4, /* 50: FP Divide by Zero (unemulated) */ | |
| 361 | 4, /* 51: FP Underflow (unemulated) */ | |
| 362 | 4, /* 52: FP Operand Error (unemulated) */ | |
| 363 | 4, /* 53: FP Overflow (unemulated) */ | |
| 364 | 4, /* 54: FP Signaling NAN (unemulated) */ | |
| 365 | 4, /* 55: FP Unimplemented Data Type (unemulated) */ | |
| 366 | 4, /* 56: MMU Configuration Error (unemulated) */ | |
| 367 | 4, /* 57: MMU Illegal Operation Error (unemulated) */ | |
| 368 | 4, /* 58: MMU Access Level Violation Error (unemulated) */ | |
| 369 | 4, /* 59: RESERVED */ | |
| 370 | 4, /* 60: RESERVED */ | |
| 371 | 4, /* 61: RESERVED */ | |
| 372 | 4, /* 62: RESERVED */ | |
| 373 | 4, /* 63: RESERVED */ | |
| 374 | /* 64-255: User Defined */ | |
| 375 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
| 376 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
| 377 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
| 378 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
| 379 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
| 380 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 | |
| 381 | }, | |
| 309 | 382 | { /* 040 */ // TODO: these values are not correct |
| 310 | 383 | 4, /* 0: Reset - Initial Stack Pointer */ |
| 311 | 384 | 4, /* 1: Reset - Initial Program Counter */ |
| r5955 | r5956 | |
| 407 | 480 | CPU STATE DESCRIPTION |
| 408 | 481 | ***************************************************************************/ |
| 409 | 482 | |
| 410 | #define MASK_ALL | |
| 483 | #define MASK_ALL | |
| 411 | 484 | #define MASK_24BIT_SPACE (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020) |
| 412 | #define MASK_32BIT_SPACE (CPU_TYPE_020 | CPU_TYPE_040) | |
| 413 | #define MASK_010_OR_LATER (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040) | |
| 414 | #define MASK_020_OR_LATER (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040) | |
| 415 | #define MASK_040_OR_LATER (CPU_TYPE_040) | |
| 485 | #define MASK_32BIT_SPACE (CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040) | |
| 486 | #define MASK_010_OR_LATER (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040) | |
| 487 | #define MASK_020_OR_LATER (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040) | |
| 488 | #define MASK_030_OR_LATER (CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040) | |
| 489 | #define MASK_040_OR_LATER (CPU_TYPE_040 | CPU_TYPE_EC040) | |
| 416 | 490 | |
| 417 | 491 | #define M68K_STATE_ENTRY(_name, _format, _member, _datamask, _flags, _mask) \ |
| 418 | 492 | CPU_STATE_ENTRY(M68K_##_name, #_name, _format, m68ki_cpu_core, _member, _datamask, _mask, _flags) |
| r5955 | r5956 | |
| 484 | 558 | cpu_get_type(device) == CPU_M68010 || |
| 485 | 559 | cpu_get_type(device) == CPU_M68EC020 || |
| 486 | 560 | cpu_get_type(device) == CPU_M68020 || |
| 561 | cpu_get_type(device) == CPU_M68EC030 || | |
| 562 | cpu_get_type(device) == CPU_M68030 || | |
| 563 | cpu_get_type(device) == CPU_M68EC040 || | |
| 487 | 564 | cpu_get_type(device) == CPU_M68040 || |
| 488 | 565 | cpu_get_type(device) == CPU_SCC68070); |
| 489 | 566 | return (m68ki_cpu_core *)device->token; |
| r5955 | r5956 | |
| 1039 | 1116 | m68k->cyc_movem_l = 3; |
| 1040 | 1117 | m68k->cyc_shift = 1; |
| 1041 | 1118 | m68k->cyc_reset = 132; |
| 1119 | m68k->has_pmmu = 0; | |
| 1042 | 1120 | } |
| 1043 | 1121 | |
| 1044 | 1122 | CPU_GET_INFO( m68000 ) |
| r5955 | r5956 | |
| 1082 | 1160 | m68k->cyc_movem_l = 3; |
| 1083 | 1161 | m68k->cyc_shift = 1; |
| 1084 | 1162 | m68k->cyc_reset = 132; |
| 1163 | m68k->has_pmmu = 0; | |
| 1085 | 1164 | } |
| 1086 | 1165 | |
| 1087 | 1166 | CPU_GET_INFO( m68008 ) |
| r5955 | r5956 | |
| 1129 | 1208 | m68k->cyc_movem_l = 3; |
| 1130 | 1209 | m68k->cyc_shift = 1; |
| 1131 | 1210 | m68k->cyc_reset = 130; |
| 1211 | m68k->has_pmmu = 0; | |
| 1132 | 1212 | } |
| 1133 | 1213 | |
| 1134 | 1214 | CPU_GET_INFO( m68010 ) |
| r5955 | r5956 | |
| 1172 | 1252 | m68k->cyc_movem_l = 2; |
| 1173 | 1253 | m68k->cyc_shift = 0; |
| 1174 | 1254 | m68k->cyc_reset = 518; |
| 1255 | m68k->has_pmmu = 0; | |
| 1175 | 1256 | } |
| 1176 | 1257 | |
| 1177 | 1258 | CPU_GET_INFO( m68020 ) |
| r5955 | r5956 | |
| 1247 | 1328 | m68k->cyc_movem_l = 2; |
| 1248 | 1329 | m68k->cyc_shift = 0; |
| 1249 | 1330 | m68k->cyc_reset = 518; |
| 1331 | m68k->has_pmmu = 0; | |
| 1250 | 1332 | } |
| 1251 | 1333 | |
| 1252 | 1334 | CPU_GET_INFO( m68ec020 ) |
| r5955 | r5956 | |
| 1267 | 1349 | } |
| 1268 | 1350 | |
| 1269 | 1351 | /**************************************************************************** |
| 1352 | * M68030 section | |
| 1353 | ****************************************************************************/ | |
| 1354 | ||
| 1355 | static CPU_INIT( m68030 ) | |
| 1356 | { | |
| 1357 | m68ki_cpu_core *m68k = get_safe_token(device); | |
| 1358 | ||
| 1359 | CPU_INIT_CALL(m68k); | |
| 1360 | ||
| 1361 | m68k->cpu_type = CPU_TYPE_030; | |
| 1362 | m68k->state.subtypemask = m68k->cpu_type; | |
| 1363 | m68k->dasm_type = M68K_CPU_TYPE_68030; | |
| 1364 | m68k->memory = interface_d32; | |
| 1365 | m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ | |
| 1366 | m68k->cyc_instruction = m68ki_cycles[3]; | |
| 1367 | m68k->cyc_exception = m68ki_exception_cycle_table[3]; | |
| 1368 | m68k->cyc_bcc_notake_b = -2; | |
| 1369 | m68k->cyc_bcc_notake_w = 0; | |
| 1370 | m68k->cyc_dbcc_f_noexp = 0; | |
| 1371 | m68k->cyc_dbcc_f_exp = 4; | |
| 1372 | m68k->cyc_scc_r_true = 0; | |
| 1373 | m68k->cyc_movem_w = 2; | |
| 1374 | m68k->cyc_movem_l = 2; | |
| 1375 | m68k->cyc_shift = 0; | |
| 1376 | m68k->cyc_reset = 518; | |
| 1377 | m68k->has_pmmu = 1; | |
| 1378 | } | |
| 1379 | ||
| 1380 | CPU_GET_INFO( m68030 ) | |
| 1381 | { | |
| 1382 | m68ki_cpu_core *m68k = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL; | |
| 1383 | int sr; | |
| 1384 | ||
| 1385 | switch (state) | |
| 1386 | { | |
| 1387 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1388 | case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 20; break; | |
| 1389 | case CPUINFO_INT_MIN_CYCLES: info->i = 2; break; | |
| 1390 | case CPUINFO_INT_MAX_CYCLES: info->i = 158; break; | |
| 1391 | ||
| 1392 | case CPUINFO_INT_DATABUS_WIDTH_PROGRAM: info->i = 32; break; | |
| 1393 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32; break; | |
| 1394 | ||
| 1395 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1396 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(m68030); break; | |
| 1397 | ||
| 1398 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1399 | case DEVINFO_STR_NAME: strcpy(info->s, "68030"); break; | |
| 1400 | ||
| 1401 | case CPUINFO_STR_FLAGS: | |
| 1402 | sr = m68ki_get_sr(m68k); | |
| 1403 | sprintf(info->s, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", | |
| 1404 | sr & 0x8000 ? 'T':'.', | |
| 1405 | sr & 0x4000 ? 't':'.', | |
| 1406 | sr & 0x2000 ? 'S':'.', | |
| 1407 | sr & 0x1000 ? 'M':'.', | |
| 1408 | sr & 0x0800 ? '?':'.', | |
| 1409 | sr & 0x0400 ? 'I':'.', | |
| 1410 | sr & 0x0200 ? 'I':'.', | |
| 1411 | sr & 0x0100 ? 'I':'.', | |
| 1412 | sr & 0x0080 ? '?':'.', | |
| 1413 | sr & 0x0040 ? '?':'.', | |
| 1414 | sr & 0x0020 ? '?':'.', | |
| 1415 | sr & 0x0010 ? 'X':'.', | |
| 1416 | sr & 0x0008 ? 'N':'.', | |
| 1417 | sr & 0x0004 ? 'Z':'.', | |
| 1418 | sr & 0x0002 ? 'V':'.', | |
| 1419 | sr & 0x0001 ? 'C':'.'); | |
| 1420 | break; | |
| 1421 | ||
| 1422 | default: CPU_GET_INFO_CALL(m68k); break; | |
| 1423 | } | |
| 1424 | } | |
| 1425 | ||
| 1426 | ||
| 1427 | /**************************************************************************** | |
| 1428 | * M680EC30 section | |
| 1429 | ****************************************************************************/ | |
| 1430 | ||
| 1431 | static CPU_INIT( m68ec030 ) | |
| 1432 | { | |
| 1433 | m68ki_cpu_core *m68k = get_safe_token(device); | |
| 1434 | ||
| 1435 | CPU_INIT_CALL(m68k); | |
| 1436 | ||
| 1437 | m68k->cpu_type = CPU_TYPE_EC030; | |
| 1438 | m68k->state.subtypemask = m68k->cpu_type; | |
| 1439 | m68k->dasm_type = M68K_CPU_TYPE_68EC030; | |
| 1440 | m68k->memory = interface_d32; | |
| 1441 | m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ | |
| 1442 | m68k->cyc_instruction = m68ki_cycles[3]; | |
| 1443 | m68k->cyc_exception = m68ki_exception_cycle_table[3]; | |
| 1444 | m68k->cyc_bcc_notake_b = -2; | |
| 1445 | m68k->cyc_bcc_notake_w = 0; | |
| 1446 | m68k->cyc_dbcc_f_noexp = 0; | |
| 1447 | m68k->cyc_dbcc_f_exp = 4; | |
| 1448 | m68k->cyc_scc_r_true = 0; | |
| 1449 | m68k->cyc_movem_w = 2; | |
| 1450 | m68k->cyc_movem_l = 2; | |
| 1451 | m68k->cyc_shift = 0; | |
| 1452 | m68k->cyc_reset = 518; | |
| 1453 | m68k->has_pmmu = 0; /* EC030 lacks the PMMU and is effectively a die-shrink 68020 */ | |
| 1454 | } | |
| 1455 | ||
| 1456 | CPU_GET_INFO( m68ec030 ) | |
| 1457 | { | |
| 1458 | switch (state) | |
| 1459 | { | |
| 1460 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1461 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(m68ec030); break; | |
| 1462 | ||
| 1463 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1464 | case DEVINFO_STR_NAME: strcpy(info->s, "68EC030"); break; | |
| 1465 | ||
| 1466 | default: CPU_GET_INFO_CALL(m68030); break; | |
| 1467 | } | |
| 1468 | } | |
| 1469 | ||
| 1470 | /**************************************************************************** | |
| 1270 | 1471 | * M68040 section |
| 1271 | 1472 | ****************************************************************************/ |
| 1272 | 1473 | |
| r5955 | r5956 | |
| 1281 | 1482 | m68k->dasm_type = M68K_CPU_TYPE_68040; |
| 1282 | 1483 | m68k->memory = interface_d32; |
| 1283 | 1484 | m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ |
| 1284 | m68k->cyc_instruction = m68ki_cycles[2]; | |
| 1285 | m68k->cyc_exception = m68ki_exception_cycle_table[2]; | |
| 1485 | m68k->cyc_instruction = m68ki_cycles[4]; | |
| 1486 | m68k->cyc_exception = m68ki_exception_cycle_table[4]; | |
| 1286 | 1487 | m68k->cyc_bcc_notake_b = -2; |
| 1287 | 1488 | m68k->cyc_bcc_notake_w = 0; |
| 1288 | 1489 | m68k->cyc_dbcc_f_noexp = 0; |
| r5955 | r5956 | |
| 1292 | 1493 | m68k->cyc_movem_l = 2; |
| 1293 | 1494 | m68k->cyc_shift = 0; |
| 1294 | 1495 | m68k->cyc_reset = 518; |
| 1496 | m68k->has_pmmu = 1; | |
| 1295 | 1497 | } |
| 1296 | 1498 | |
| 1297 | 1499 | CPU_GET_INFO( m68040 ) |
| r5955 | r5956 | |
| 1340 | 1542 | } |
| 1341 | 1543 | } |
| 1342 | 1544 | |
| 1545 | /**************************************************************************** | |
| 1546 | * M680EC30 section | |
| 1547 | ****************************************************************************/ | |
| 1343 | 1548 | |
| 1549 | static CPU_INIT( m68ec040 ) | |
| 1550 | { | |
| 1551 | m68ki_cpu_core *m68k = get_safe_token(device); | |
| 1552 | ||
| 1553 | CPU_INIT_CALL(m68k); | |
| 1554 | ||
| 1555 | m68k->cpu_type = CPU_TYPE_EC040; | |
| 1556 | m68k->state.subtypemask = m68k->cpu_type; | |
| 1557 | m68k->dasm_type = M68K_CPU_TYPE_68EC040; | |
| 1558 | m68k->memory = interface_d32; | |
| 1559 | m68k->sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ | |
| 1560 | m68k->cyc_instruction = m68ki_cycles[4]; | |
| 1561 | m68k->cyc_exception = m68ki_exception_cycle_table[4]; | |
| 1562 | m68k->cyc_bcc_notake_b = -2; | |
| 1563 | m68k->cyc_bcc_notake_w = 0; | |
| 1564 | m68k->cyc_dbcc_f_noexp = 0; | |
| 1565 | m68k->cyc_dbcc_f_exp = 4; | |
| 1566 | m68k->cyc_scc_r_true = 0; | |
| 1567 | m68k->cyc_movem_w = 2; | |
| 1568 | m68k->cyc_movem_l = 2; | |
| 1569 | m68k->cyc_shift = 0; | |
| 1570 | m68k->cyc_reset = 518; | |
| 1571 | m68k->has_pmmu = 1; | |
| 1572 | } | |
| 1573 | ||
| 1574 | CPU_GET_INFO( m68ec040 ) | |
| 1575 | { | |
| 1576 | switch (state) | |
| 1577 | { | |
| 1578 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1579 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(m68ec040); break; | |
| 1580 | ||
| 1581 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1582 | case DEVINFO_STR_NAME: strcpy(info->s, "68EC040"); break; | |
| 1583 | ||
| 1584 | default: CPU_GET_INFO_CALL(m68040); break; | |
| 1585 | } | |
| 1586 | } | |
| 1587 | ||
| 1344 | 1588 | /**************************************************************************** |
| 1345 | 1589 | * SCC-68070 section |
| 1346 | 1590 | ****************************************************************************/ |
| r5955 | r5956 | |
| 1370 | 1614 | default: CPU_GET_INFO_CALL(m68k); break; |
| 1371 | 1615 | } |
| 1372 | 1616 | } |
| 1617 |
| r5955 | r5956 | |
|---|---|---|
| 135 | 135 | #define Z180_INT_ASCI0 8 /* Internal ASCI channel 0 */ |
| 136 | 136 | #define Z180_INT_ASCI1 9 /* Internal ASCI channel 1 */ |
| 137 | 137 | |
| 138 | #ifdef UNUSED_DEFINITION | |
| 138 | 139 | /* MMU mapped memory lookup */ |
| 139 | 140 | extern UINT8 z180_readmem(const device_config *device, offs_t offset); |
| 140 | 141 | extern void z180_writemem(const device_config *device, offs_t offset, UINT8 data); |
| 142 | #endif | |
| 141 | 143 | |
| 142 | 144 | extern CPU_GET_INFO( z180 ); |
| 143 | 145 | #define CPU_Z180 CPU_GET_INFO_NAME( z180 ) |
| r5955 | r5956 | |
|---|---|---|
| 69 | 69 | * Read a byte from given memory location |
| 70 | 70 | ***************************************************************/ |
| 71 | 71 | #define RM(cs,addr) memory_read_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr)) |
| 72 | #ifdef UNUSED_FUNCTION | |
| 72 | 73 | UINT8 z180_readmem(const device_config *device, offs_t offset) |
| 73 | 74 | { |
| 74 | 75 | z180_state *cpustate = get_safe_token(device); |
| 75 | 76 | return RM(cpustate, offset); |
| 76 | 77 | } |
| 78 | #endif | |
| 77 | 79 | |
| 78 | 80 | /*************************************************************** |
| 79 | 81 | * Write a byte to given memory location |
| 80 | 82 | ***************************************************************/ |
| 81 | 83 | #define WM(cs,addr,value) memory_write_byte_8le((cs)->program, MMU_REMAP_ADDR(cs,addr),value) |
| 84 | #ifdef UNUSED_FUNCTION | |
| 82 | 85 | void z180_writemem(const device_config *device, offs_t offset, UINT8 data) |
| 83 | 86 | { |
| 84 | 87 | z180_state *cpustate = get_safe_token(device); |
| 85 | 88 | WM(cpustate, offset, data); |
| 86 | 89 | } |
| 90 | #endif | |
| 87 | 91 | |
| 88 | ||
| 89 | 92 | /*************************************************************** |
| 90 | 93 | * Read a word from given memory location |
| 91 | 94 | ***************************************************************/ |
| r5955 | r5956 | |
|---|---|---|
| 3 | 3 | #include "v60.h" |
| 4 | 4 | |
| 5 | 5 | // Register names |
| 6 | const char *const v60_reg_names[69] = { | |
| 6 | static const char *const v60_reg_names[69] = { | |
| 7 | 7 | "R0", "R1", "R2", "R3", |
| 8 | 8 | "R4", "R5", "R6", "R7", |
| 9 | 9 | "R8", "R9", "R10", "R11", |
| r5955 | r5956 | |
|---|---|---|
| 78 | 78 | V60_REGMAX |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | extern const char *const v60_reg_names[]; | |
| 82 | 81 | void v60_stall(const device_config *device); |
| 83 | 82 | |
| 84 | 83 | CPU_GET_INFO( v60 ); |
| r5955 | r5956 | |
|---|---|---|
| 1655 | 1655 | /* SUB : .... .... 0100 FJJJ : A-202 */ |
| 1656 | 1656 | static size_t dsp56k_op_sub(dsp56k_core* cpustate, const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1657 | 1657 | { |
| 1658 | UINT64 useVal = 0; | |
| 1659 | typed_pointer S = {NULL, DT_BYTE}; | |
| 1660 | typed_pointer D = {NULL, DT_BYTE}; | |
| 1661 | ||
| 1662 | decode_JJJF_table(cpustate, BITS(op_byte,0x0007), BITS(op_byte,0x0008), &S, &D); | |
| 1663 | ||
| 1664 | /* Get on with it. */ | |
| 1665 | switch(S.data_type) | |
| 1666 | { | |
| 1667 | case DT_WORD: useVal = (UINT64)*((UINT16*)S.addr) << 16; break; | |
| 1668 | case DT_DOUBLE_WORD: useVal = (UINT64)*((UINT32*)S.addr); break; | |
| 1669 | case DT_LONG_WORD: useVal = (UINT64)*((UINT64*)S.addr); break; | |
| 1670 | } | |
| 1671 | ||
| 1672 | /* Sign-extend word for proper sub op */ | |
| 1673 | if ((S.data_type == DT_WORD) && useVal & U64(0x0000000080000000)) | |
| 1674 | useVal |= U64(0x000000ff00000000); | |
| 1675 | ||
| 1676 | /* Operate*/ | |
| 1677 | *((UINT64*)D.addr) -= useVal; | |
| 1678 | ||
| 1679 | d_register->addr = D.addr; | |
| 1680 | d_register->data_type = D.data_type; | |
| 1681 | ||
| 1658 | 1682 | /* S L E U N Z V C */ |
| 1659 | 1683 | /* * * * * * * * * */ |
| 1660 | return 0; | |
| 1684 | /* TODO S, L, E, U, V, C */ | |
| 1685 | if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0); | |
| 1686 | if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0); | |
| 1687 | ||
| 1688 | cycles += 2; /* TODO: + mv oscillator cycles */ | |
| 1689 | return 1; | |
| 1661 | 1690 | } |
| 1662 | 1691 | |
| 1663 | 1692 | /* CLR24 : .... .... 0101 F001 : A-62 */ |
| r5955 | r5956 | |
| 2995 | 3024 | /* TODO: Verify, since it's not in the docs, but it must be true */ |
| 2996 | 3025 | PC += 2; |
| 2997 | 3026 | |
| 2998 | SP++; | |
| 2999 | SSH = PC; | |
| 3000 | SSL = SR; | |
| 3027 | /* TODO: This is a hacky implementation of Long vs Fast Interrupts. Do it right someday! */ | |
| 3028 | if (PC < WORD(0x40)) | |
| 3029 | { | |
| 3030 | /* Long interrupt gets the previous PC, not the current one */ | |
| 3031 | SP++; | |
| 3032 | SSH = cpustate->ppc; | |
| 3033 | SSL = SR; | |
| 3001 | 3034 | |
| 3002 | cpustate->ppc = PC; | |
| 3003 | PC = branchOffset; | |
| 3035 | cpustate->ppc = cpustate->ppc; | |
| 3036 | PC = branchOffset; | |
| 3037 | } | |
| 3038 | else | |
| 3039 | { | |
| 3040 | /* Normal operation */ | |
| 3041 | SP++; | |
| 3042 | SSH = PC; | |
| 3043 | SSL = SR; | |
| 3004 | 3044 | |
| 3045 | cpustate->ppc = PC; | |
| 3046 | PC = branchOffset; | |
| 3047 | } | |
| 3048 | ||
| 3005 | 3049 | /* S L E U N Z V C */ |
| 3006 | 3050 | /* - - - - - - - - */ |
| 3007 | 3051 | cycles += 4; /* TODO: + jx oscillator cycles */ |
| r5955 | r5956 | |
|---|---|---|
| 276 | 276 | // 1-12 Make sure you're not masked out against the Interrupt Mask Bits (disabled is handled for free here) |
| 277 | 277 | if (priority >= I_bits(cpustate)) |
| 278 | 278 | { |
| 279 | // TODO: Implement long interrupts & fast interrupts correctly! | |
| 280 | // Right now they are handled in the JSR & BSR ops. SupahLame. | |
| 281 | cpustate->ppc = PC; | |
| 282 | ||
| 279 | 283 | // Are you anything but the Host Command interrupt? |
| 280 | 284 | if (interrupt_index != 22) |
| 281 | 285 | { |
| r5955 | r5956 | |
| 287 | 291 | // The host command input has a floating vector. |
| 288 | 292 | const UINT16 irq_vector = HV_bits(cpustate) << 1; |
| 289 | 293 | |
| 290 | cpustate->ppc = PC; | |
| 291 | 294 | PC = irq_vector; |
| 292 | 295 | |
| 293 | 296 | // TODO: 5-9 5-11 Gotta' Clear HC (HCP gets it too) when taking this exception! |
| r5955 | r5956 | |
|---|---|---|
| 141 | 141 | { |
| 142 | 142 | /* If it changes state from asserted to cleared. Call the reset function. */ |
| 143 | 143 | if (cpustate->reset_state == TRUE) |
| 144 | | |
| 144 | CPU_RESET_NAME(dsp56k)(cpustate->device); | |
| 145 | 145 | |
| 146 | 146 | cpustate->reset_state = FALSE; |
| 147 | 147 | } |
| r5955 | r5956 | |
|---|---|---|
| 19 | 19 | extern CPU_GET_INFO( arm ); |
| 20 | 20 | #define CPU_ARM CPU_GET_INFO_NAME( arm ) |
| 21 | 21 | |
| 22 | extern UINT32 arm_disasm(char *pBuf, UINT32 pc, UINT32 opcode); | |
| 23 | ||
| 24 | 22 | enum |
| 25 | 23 | { |
| 26 | 24 | ARM32_PC=0, |
| r5955 | r5956 | |
|---|---|---|
| 99 | 99 | return pBuf; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | UINT32 arm_disasm( char *pBuf, UINT32 pc, UINT32 opcode ) | |
| 102 | static UINT32 arm_disasm( char *pBuf, UINT32 pc, UINT32 opcode ) | |
| 103 | 103 | { |
| 104 | 104 | const char *pBuf0; |
| 105 | 105 |
| r5955 | r5956 | |
|---|---|---|
| 173 | 173 | #endif |
| 174 | 174 | } SH2; |
| 175 | 175 | |
| 176 | TIMER_CALLBACK( sh2_timer_callback ); | |
| 177 | TIMER_CALLBACK( sh2_dmac_callback ); | |
| 178 | ||
| 179 | 176 | void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irqcallback); |
| 180 | 177 | void sh2_recalc_irq(SH2 *sh2); |
| 181 | 178 | void sh2_set_irq_line(SH2 *sh2, int irqline, int state); |
| r5955 | r5956 | |
|---|---|---|
| 77 | 77 | void sh2_set_ftcsr_read_callback(const device_config *device, void (*callback)(UINT32)); |
| 78 | 78 | void sh2_set_frt_input(const device_config *device, int state); |
| 79 | 79 | |
| 80 | extern unsigned DasmSH2( char *dst, unsigned pc, UINT16 opcode ); | |
| 81 | ||
| 82 | 80 | /*************************************************************************** |
| 83 | 81 | COMPILER-SPECIFIC OPTIONS |
| 84 | 82 | ***************************************************************************/ |
| r5955 | r5956 | |
|---|---|---|
| 573 | 573 | return 0; |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode) | |
| 576 | static unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode) | |
| 577 | 577 | { |
| 578 | 578 | UINT32 flags; |
| 579 | 579 |
| r5955 | r5956 | |
|---|---|---|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | TIMER_CALLBACK( sh2_timer_callback ) | |
| 109 | static TIMER_CALLBACK( sh2_timer_callback ) | |
| 110 | 110 | { |
| 111 | 111 | SH2 *sh2 = (SH2 *)ptr; |
| 112 | 112 | UINT16 frc; |
| r5955 | r5956 | |
| 133 | 133 | sh2_timer_activate(sh2); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | TIMER_CALLBACK( sh2_dmac_callback ) | |
| 136 | static TIMER_CALLBACK( sh2_dmac_callback ) | |
| 137 | 137 | { |
| 138 | 138 | int dma = param & 1; |
| 139 | 139 | SH2 *sh2 = (SH2 *)ptr; |
| r5955 | r5956 | |
|---|---|---|
| 97 | 97 | WRITE32_HANDLER( sh4_internal_w ); |
| 98 | 98 | READ32_HANDLER( sh4_internal_r ); |
| 99 | 99 | |
| 100 | extern unsigned DasmSH4( char *dst, unsigned pc, UINT16 opcode ); | |
| 101 | ||
| 102 | 100 | void sh4_set_frt_input(const device_config *device, int state); |
| 103 | 101 | void sh4_set_irln_input(const device_config *device, int value); |
| 104 | 102 | void sh4_set_ftcsr_callback(const device_config *device, sh4_ftcsr_callback callback); |
| r5955 | r5956 | |
|---|---|---|
| 782 | 782 | return 0; |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | unsigned DasmSH4(char *buffer, unsigned pc, UINT16 opcode) | |
| 785 | static unsigned DasmSH4(char *buffer, unsigned pc, UINT16 opcode) | |
| 786 | 786 | { |
| 787 | 787 | UINT32 flags; |
| 788 | 788 |
| r5955 | r5956 | |
|---|---|---|
| 1 | 1 | #include "debugger.h" |
| 2 | 2 | #include "i960.h" |
| 3 | #include "i960dis.h" | |
| 4 | 3 | #include <math.h> |
| 5 | 4 | |
| 6 | 5 | CPU_DISASSEMBLE( i960 ); |
| r5955 | r5956 | |
|---|---|---|
| 154 | 154 | |
| 155 | 155 | #define READ32(dis,offs) ((dis)->oprom[(offs) + 0] | ((dis)->oprom[(offs) + 1] << 8) | ((dis)->oprom[(offs) + 2] << 16) | ((dis)->oprom[(offs) + 3] << 24)) |
| 156 | 156 | |
| 157 | char *i960_disassemble(disassemble_t *diss) | |
| 157 | static char *i960_disassemble(disassemble_t *diss) | |
| 158 | 158 | { |
| 159 | 159 | unsigned char op,op2; |
| 160 | 160 | unsigned char mode, modeh, model; |
| r5955 | r5956 | |
|---|---|---|
| 11 | 11 | UINT32 disflags; |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | char *i960_disassemble(disassemble_t *diss); | |
| 15 | ||
| 16 | 14 | #endif /* __I960DIS_H__ */ |
| r5955 | r5956 | |
|---|---|---|
| 492 | 492 | extern void arm7_dt_r_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, UINT32 (*read32)(arm_state *cpustate, UINT32 addr)); |
| 493 | 493 | extern void arm7_dt_w_callback(arm_state *cpustate, UINT32 insn, UINT32 *prn, void (*write32)(arm_state *cpustate, UINT32 addr, UINT32 data)); |
| 494 | 494 | |
| 495 | extern UINT32 arm7_disasm(char *pBuf, UINT32 pc, UINT32 opcode); | |
| 496 | extern UINT32 thumb_disasm(char *pBuf, UINT32 pc, UINT16 opcode); | |
| 497 | ||
| 498 | 495 | #ifdef UNUSED_DEFINITION |
| 499 | 496 | extern char *(*arm7_dasm_cop_dt_callback)(arm_state *cpustate, char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 500 | 497 | extern char *(*arm7_dasm_cop_rt_callback)(arm_state *cpustate, char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| r5955 | r5956 | |
|---|---|---|
| 198 | 198 | return pBuf; |
| 199 | 199 | } /* WriteBranchAddress */ |
| 200 | 200 | |
| 201 | UINT32 arm7_disasm( char *pBuf, UINT32 pc, UINT32 opcode ) | |
| 201 | static UINT32 arm7_disasm( char *pBuf, UINT32 pc, UINT32 opcode ) | |
| 202 | 202 | { |
| 203 | 203 | const char *pBuf0; |
| 204 | 204 | |
| r5955 | r5956 | |
| 692 | 692 | return dasmflags | DASMFLAG_SUPPORTED; |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode ) | |
| 695 | static UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode ) | |
| 696 | 696 | { |
| 697 | 697 | const char *pBuf0; |
| 698 | 698 | UINT32 dasmflags = 0; |
| r5955 | r5956 | |
|---|---|---|
| 275 | 275 | x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); |
| 276 | 276 | |
| 277 | 277 | /* go ahead and draw the outer box now */ |
| 278 | ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_FI | |
| 278 | ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); | |
| 279 | 279 | |
| 280 | 280 | /* draw the title */ |
| 281 | 281 | x0 = 0.5f - 0.5f * titlewidth; |
| r5955 | r5956 | |
| 518 | 518 | x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); |
| 519 | 519 | |
| 520 | 520 | /* go ahead and draw the outer box now */ |
| 521 | ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_FI | |
| 521 | ui_draw_outlined_box(boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); | |
| 522 | 522 | |
| 523 | 523 | /* draw the title */ |
| 524 | 524 | x0 = 0.5f - 0.5f * titlewidth; |
| r5955 | r5956 | |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | /* go ahead and draw the outer box now */ |
| 921 | ui_draw_outlined_box(boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_FI | |
| 921 | ui_draw_outlined_box(boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); | |
| 922 | 922 | |
| 923 | 923 | /* draw the title */ |
| 924 | 924 | x0 = 0.5f - 0.5f * titlewidth; |
| r5955 | r5956 | |
|---|---|---|
| 64 | 64 | ***************************************************************************/ |
| 65 | 65 | |
| 66 | 66 | |
| 67 | #define DEVTEMPLATE_ID1(x) DEVTEMPLATE_ID(x,) | |
| 68 | #define DEVTEMPLATE_DERIVED_ID1(x) DEVTEMPLATE_DERIVED_ID(x,) | |
| 69 | ||
| 67 | 70 | /* flag bits for DEVTEMPLATE_FEATURES */ |
| 68 | 71 | #define DT_HAS_START 0x0001 |
| 69 | 72 | #define DT_HAS_RESET 0x0002 |
| r5955 | r5956 | |
| 164 | 167 | |
| 165 | 168 | /* --- the following bits of info are returned as pointers --- */ |
| 166 | 169 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_ROM_REGION) |
| 167 | case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_ID( | |
| 170 | case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_ID1(ROM_NAME()); break; | |
| 168 | 171 | #endif |
| 169 | 172 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_MACHINE_CONFIG) |
| 170 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_ID( | |
| 173 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_ID1(MACHINE_DRIVER_NAME()); break; | |
| 171 | 174 | #endif |
| 172 | 175 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_CONTRACT_LIST) |
| 173 | case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_ID( | |
| 176 | case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_ID1(DEVICE_CONTRACT_LIST_NAME()); break; | |
| 174 | 177 | #endif |
| 175 | 178 | |
| 176 | 179 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 177 | 180 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_START) |
| 178 | case DEVINFO_FCT_START: info->start = DEVTEMPLATE_ID( | |
| 181 | case DEVINFO_FCT_START: info->start = DEVTEMPLATE_ID1(DEVICE_START_NAME()); break; | |
| 179 | 182 | #endif |
| 180 | 183 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_RESET) |
| 181 | case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_ID( | |
| 184 | case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_ID1(DEVICE_RESET_NAME()); break; | |
| 182 | 185 | #endif |
| 183 | 186 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_STOP) |
| 184 | case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_ID( | |
| 187 | case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_ID1(DEVICE_STOP_NAME()); break; | |
| 185 | 188 | #endif |
| 186 | 189 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_EXECUTE) |
| 187 | case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_ID( | |
| 190 | case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_ID1(DEVICE_EXECUTE_NAME()); break; | |
| 188 | 191 | #endif |
| 189 | 192 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_NVRAM) |
| 190 | case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_ID( | |
| 193 | case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_ID1(DEVICE_NVRAM_NAME()); break; | |
| 191 | 194 | #endif |
| 192 | 195 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_VALIDITY_CHECK) |
| 193 | case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_ID( | |
| 196 | case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_ID1(DEVICE_VALIDITY_CHECK_NAME()); break; | |
| 194 | 197 | #endif |
| 195 | 198 | #if ((DEVTEMPLATE_FEATURES) & DT_HAS_CUSTOM_CONFIG) |
| 196 | case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_ID( | |
| 199 | case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_ID1(DEVICE_CUSTOM_CONFIG_NAME()); break; | |
| 197 | 200 | #endif |
| 198 | 201 | |
| 199 | 202 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| r5955 | r5956 | |
| 239 | 242 | { |
| 240 | 243 | /* --- the following bits of info are returned as pointers --- */ |
| 241 | 244 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_ROM_REGION) |
| 242 | case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_DERIVED_ID( | |
| 245 | case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_DERIVED_ID1(ROM_NAME()); break; | |
| 243 | 246 | #endif |
| 244 | 247 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_MACHINE_CONFIG) |
| 245 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_DERIVED_ID( | |
| 248 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_DERIVED_ID1(MACHINE_DRIVER_NAME()); break; | |
| 246 | 249 | #endif |
| 247 | 250 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CONTRACT_LIST) |
| 248 | case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_DERIVED_ID( | |
| 251 | case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_DERIVED_ID1(DEVICE | |
| 249 | 252 | #endif |
| 250 | 253 | |
| 251 | 254 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 252 | 255 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_START) |
| 253 | case DEVINFO_FCT_START: info->start = DEVTEMPLATE_DERIVED_ID( | |
| 256 | case DEVINFO_FCT_START: info->start = DEVTEMPLATE_DERIVED_ID1(DEVICE_START_NAME()); break; | |
| 254 | 257 | #endif |
| 255 | 258 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_RESET) |
| 256 | case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_DERIVED_ID( | |
| 259 | case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_DERIVED_ID1(DEVICE_RESET_NAME()); break; | |
| 257 | 260 | #endif |
| 258 | 261 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_STOP) |
| 259 | case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_DERIVED_ID( | |
| 262 | case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_DERIVED_ID1(DEVICE_STORE_NAME()); break; | |
| 260 | 263 | #endif |
| 261 | 264 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_EXECUTE) |
| 262 | case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_DERIVED_ID( | |
| 265 | case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_DERIVED_ID1(DEVICE_EXECUTE_NAME()); break; | |
| 263 | 266 | #endif |
| 264 | 267 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_NVRAM) |
| 265 | case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_DERIVED_ID( | |
| 268 | case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_DERIVED_ID1(DEVICE_NVRAM_NAME()); break; | |
| 266 | 269 | #endif |
| 267 | 270 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_VALIDITY_CHECK) |
| 268 | case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_DERIVED_ID( | |
| 271 | case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_DERIVED_ID1(DEVICE_VALIDITY_CHECK_NAME()); break; | |
| 269 | 272 | #endif |
| 270 | 273 | #if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CUSTOM_CONFIG) |
| 271 | case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_DERIVED_ID( | |
| 274 | case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_DERIVED_ID1(DEVICE_CUSTOM_CONFIG_NAME()); break; | |
| 272 | 275 | #endif |
| 273 | 276 | |
| 274 | 277 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| r5955 | r5956 | |
|---|---|---|
| 33 | 33 | #define UI_MENU_POOL_SIZE 65536 |
| 34 | 34 | #define UI_MENU_ALLOC_ITEMS 256 |
| 35 | 35 | |
| 36 | #define MENU_TEXTCOLOR ARGB_WHITE | |
| 37 | #define MENU_SELECTCOLOR MAKE_ARGB(0xff,0xff,0xff,0x00) | |
| 38 | #define MENU_UNAVAILABLECOLOR MAKE_ARGB(0xff,0x40,0x40,0x40) | |
| 39 | ||
| 40 | 36 | #define VISIBLE_GAMES_IN_LIST 15 |
| 41 | 37 | |
| 42 | 38 | #define MAX_PHYSICAL_DIPS 10 |
| r5955 | r5956 | |
| 242 | 238 | static const char backtext[] = "Return to " CAPSTARTGAMENOUN; |
| 243 | 239 | static const char exittext[] = "Exit"; |
| 244 | 240 | |
| 245 | static const rgb_t text_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0xff); | |
| 246 | static const rgb_t text_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x80); | |
| 247 | static const rgb_t sel_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x00); | |
| 248 | static const rgb_t sel_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x00); | |
| 249 | static const rgb_t mouseover_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80); | |
| 250 | static const rgb_t mouseover_bgcolor = MAKE_ARGB(0x70,0x40,0x40,0x00); | |
| 251 | static const rgb_t mousedown_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80); | |
| 252 | static const rgb_t mousedown_bgcolor = MAKE_ARGB(0xB0,0x60,0x60,0x00); | |
| 253 | 241 | |
| 254 | 242 | |
| 255 | ||
| 256 | 243 | /*************************************************************************** |
| 257 | 244 | FUNCTION PROTOTYPES |
| 258 | 245 | ***************************************************************************/ |
| r5955 | r5956 | |
| 815 | 802 | x2 = visible_left + visible_width + UI_BOX_LR_BORDER; |
| 816 | 803 | y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER; |
| 817 | 804 | if (!customonly) |
| 818 | ui_draw_outlined_box(x1, y1, x2, y2, UI_ | |
| 805 | ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR); | |
| 819 | 806 | |
| 820 | 807 | /* determine the first visible line based on the current selection */ |
| 821 | 808 | top_line = menu->selected - visible_lines / 2; |
| r5955 | r5956 | |
| 848 | 835 | int itemnum = top_line + linenum; |
| 849 | 836 | const ui_menu_item *item = &menu->item[itemnum]; |
| 850 | 837 | const char *itemtext = item->text; |
| 851 | rgb_t fgcolor = text_fgcolor; | |
| 852 | rgb_t bgcolor = text_bgcolor; | |
| 838 | rgb_t fgcolor = UI_TEXT_COLOR; | |
| 839 | rgb_t bgcolor = UI_TEXT_BG_COLOR; | |
| 840 | rgb_t fgcolor2 = UI_SUBITEM_COLOR; | |
| 841 | rgb_t fgcolor3 = UI_CLONE_COLOR; | |
| 853 | 842 | float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; |
| 854 | 843 | float line_y0 = line_y; |
| 855 | 844 | float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; |
| r5955 | r5956 | |
| 862 | 851 | /* if we're selected, draw with a different background */ |
| 863 | 852 | if (itemnum == menu->selected) |
| 864 | 853 | { |
| 865 | fgcolor = sel_fgcolor; | |
| 866 | bgcolor = sel_bgcolor; | |
| 854 | fgcolor = UI_SELECTED_COLOR; | |
| 855 | bgcolor = UI_SELECTED_BG_COLOR; | |
| 856 | fgcolor2 = UI_SELECTED_COLOR; | |
| 857 | fgcolor3 = UI_SELECTED_COLOR; | |
| 867 | 858 | } |
| 868 | 859 | |
| 869 | 860 | /* else if the mouse is over this item, draw with a different background */ |
| 870 | 861 | else if (itemnum == menu->hover) |
| 871 | 862 | { |
| 872 | fgcolor = mouseover_fgcolor; | |
| 873 | bgcolor = mouseover_bgcolor; | |
| 863 | fgcolor = UI_MOUSEOVER_COLOR; | |
| 864 | bgcolor = UI_MOUSEOVER_BG_COLOR; | |
| 865 | fgcolor2 = UI_MOUSEOVER_COLOR; | |
| 866 | fgcolor3 = UI_MOUSEOVER_COLOR; | |
| 874 | 867 | } |
| 875 | 868 | |
| 876 | 869 | /* if we have some background hilighting to do, add a quad behind everything else */ |
| 877 | if (bgcolor != | |
| 870 | if (bgcolor != UI | |
| 878 | 871 | render_ui_add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture, |
| 879 | 872 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); |
| 880 | 873 | |
| r5955 | r5956 | |
| 908 | 901 | |
| 909 | 902 | /* if we're just a divider, draw a line */ |
| 910 | 903 | else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) |
| 911 | render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, | |
| 904 | render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 912 | 905 | |
| 913 | 906 | /* if we don't have a subitem, just draw the string centered */ |
| 914 | 907 | else if (item->subtext == NULL) |
| r5955 | r5956 | |
| 939 | 932 | |
| 940 | 933 | /* draw the subitem right-justified */ |
| 941 | 934 | ui_draw_text_full(subitem_text, effective_left + item_width, line_y, effective_width - item_width, |
| 942 | JUSTIFY_RIGHT, WRAP_TRUNCATE, subitem_invert ? | |
| 935 | JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 | |
| 943 | 936 | |
| 944 | 937 | /* apply arrows */ |
| 945 | 938 | if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW)) |
| r5955 | r5956 | |
| 989 | 982 | ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER, |
| 990 | 983 | target_y - UI_BOX_TB_BORDER, |
| 991 | 984 | target_x + target_width + UI_BOX_LR_BORDER, |
| 992 | target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? | |
| 985 | target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI | |
| 993 | 986 | ui_draw_text_full(item->subtext, target_x, target_y, target_width, |
| 994 | JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, | |
| 987 | JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI | |
| 995 | 988 | } |
| 996 | 989 | |
| 997 | /* if there is somthing special to add, do it by calling the passed routine */ | |
| 990 | /* if there is something special to add, do it by calling the passed routine */ | |
| 998 | 991 | if (menu->custom != NULL) |
| 999 | 992 | { |
| 1000 | 993 | void *selectedref = (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL; |
| r5955 | r5956 | |
| 1051 | 1044 | ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER - gutter_width, |
| 1052 | 1045 | target_y - UI_BOX_TB_BORDER, |
| 1053 | 1046 | target_x + target_width + gutter_width + UI_BOX_LR_BORDER, |
| 1054 | target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ? UI_REDCOLOR : UI_ | |
| 1047 | target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR); | |
| 1055 | 1048 | ui_draw_text_full(text, target_x, target_y, target_width, |
| 1056 | JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, | |
| 1049 | JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, U | |
| 1057 | 1050 | |
| 1058 | 1051 | /* draw the "return to prior menu" text with a hilight behind it */ |
| 1059 | 1052 | render_ui_add_quad( target_x + 0.5f * UI_LINE_WIDTH, |
| 1060 | 1053 | target_y + target_height - line_height, |
| 1061 | 1054 | target_x + target_width - 0.5f * UI_LINE_WIDTH, |
| 1062 | 1055 | target_y + target_height, |
| 1063 | | |
| 1056 | UI | |
| 1064 | 1057 | hilight_texture, |
| 1065 | 1058 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); |
| 1066 | 1059 | ui_draw_text_full(backtext, target_x, target_y + target_height - line_height, target_width, |
| 1067 | JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, | |
| 1060 | JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI | |
| 1068 | 1061 | |
| 1069 | 1062 | /* artificially set the hover to the last item so a double-click exits */ |
| 1070 | 1063 | menu->hover = menu->numitems - 1; |
| r5955 | r5956 | |
| 2108 | 2101 | y2 = y1 + bottom; |
| 2109 | 2102 | |
| 2110 | 2103 | /* draw extra menu area */ |
| 2111 | ui_draw_outlined_box(x1, y1, x2, y2, UI_ | |
| 2104 | ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR); | |
| 2112 | 2105 | y1 += (float)DIP_SWITCH_SPACING; |
| 2113 | 2106 | |
| 2114 | 2107 | /* iterate over DIP switches */ |
| r5955 | r5956 | |
| 2157 | 2150 | JUSTIFY_RIGHT, |
| 2158 | 2151 | WRAP_NEVER, |
| 2159 | 2152 | DRAW_NORMAL, |
| 2160 | | |
| 2153 | U | |
| 2161 | 2154 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA), |
| 2162 | 2155 | NULL , |
| 2163 | 2156 | NULL); |
| r5955 | r5956 | |
| 2173 | 2166 | float innerx1; |
| 2174 | 2167 | |
| 2175 | 2168 | /* first outline the switch */ |
| 2176 | ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_ | |
| 2169 | ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR); | |
| 2177 | 2170 | |
| 2178 | 2171 | /* compute x1/x2 for the inner filled in switch */ |
| 2179 | 2172 | innerx1 = x1 + (switch_field_width - switch_width) / 2; |
| r5955 | r5956 | |
| 2183 | 2176 | { |
| 2184 | 2177 | float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off; |
| 2185 | 2178 | render_ui_add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT, |
| 2186 | (selectedmask & (1 << toggle)) ? | |
| 2179 | (selectedmask & (1 << toggle)) ? | |
| 2187 | 2180 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 2188 | 2181 | } |
| 2189 | 2182 | else |
| 2190 | 2183 | { |
| 2191 | 2184 | render_ui_add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT, |
| 2192 | | |
| 2185 | | |
| 2193 | 2186 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 2194 | 2187 | } |
| 2195 | 2188 | |
| r5955 | r5956 | |
| 2877 | 2870 | x2 = 1.0f - UI_BOX_LR_BORDER; |
| 2878 | 2871 | |
| 2879 | 2872 | /* draw extra menu area */ |
| 2880 | ui_draw_outlined_box(x1, y1, x2, y2, UI_ | |
| 2873 | ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR); | |
| 2881 | 2874 | y1 += UI_BOX_TB_BORDER; |
| 2882 | 2875 | |
| 2883 | 2876 | /* determine the text height */ |
| r5955 | r5956 | |
| 2897 | 2890 | current_x = bar_left + bar_width * percentage; |
| 2898 | 2891 | |
| 2899 | 2892 | /* fill in the percentage */ |
| 2900 | render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, | |
| 2893 | render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, UI | |
| 2901 | 2894 | |
| 2902 | 2895 | /* draw the top and bottom lines */ |
| 2903 | render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2904 | render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2896 | render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2897 | render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2905 | 2898 | |
| 2906 | 2899 | /* draw default marker */ |
| 2907 | render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2908 | render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2900 | render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2901 | render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 2909 | 2902 | |
| 2910 | 2903 | /* draw the actual text */ |
| 2911 | 2904 | ui_draw_text_full(astring_c(tempstring), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, |
| 2912 | JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, | |
| 2905 | JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, U | |
| 2913 | 2906 | |
| 2914 | 2907 | astring_free(tempstring); |
| 2915 | 2908 | } |
| r5955 | r5956 | |
| 3473 | 3466 | if (menustate->error) |
| 3474 | 3467 | ui_draw_text_box("The selected game is missing one or more required ROM or CHD images. " |
| 3475 | 3468 | "Please select a different game.\n\nPress any key to continue.", |
| 3476 | JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR); | |
| 3469 | JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); | |
| 3477 | 3470 | } |
| 3478 | 3471 | |
| 3479 | 3472 | |
| r5955 | r5956 | |
| 3649 | 3642 | y2 = origy1 - UI_BOX_TB_BORDER; |
| 3650 | 3643 | |
| 3651 | 3644 | /* draw a box */ |
| 3652 | ui_draw_outlined_box(x1, y1, x2, y2, UI_ | |
| 3645 | ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR); | |
| 3653 | 3646 | |
| 3654 | 3647 | /* take off the borders */ |
| 3655 | 3648 | x1 += UI_BOX_LR_BORDER; |
| r5955 | r5956 | |
| 3659 | 3652 | |
| 3660 | 3653 | /* draw the text within it */ |
| 3661 | 3654 | ui_draw_text_full(&tempbuf[0][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 3662 | DRAW_NORMAL, | |
| 3655 | DRAW_NORMAL, U | |
| 3663 | 3656 | |
| 3664 | 3657 | /* determine the text to render below */ |
| 3665 | 3658 | driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL; |
| r5955 | r5956 | |
| 3738 | 3731 | y2 = origy2 + bottom; |
| 3739 | 3732 | |
| 3740 | 3733 | /* draw a box */ |
| 3741 | color = UI_FILLCOLOR; | |
| 3734 | color = UI_BACKGROUND_COLOR; | |
| 3735 | if (driver != NULL) | |
| 3736 | color = UI_GREEN_COLOR; | |
| 3742 | 3737 | if (driver != NULL && (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_NO_SOUND | GAME_IMPERFECT_SOUND)) != 0) |
| 3743 | color = UI_YELLOWCOLOR; | |
| 3738 | color = UI_YELLOW_COLOR; | |
| 3744 | 3739 | if (driver != NULL && (driver->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) != 0) |
| 3745 | color = UI_REDCOLOR; | |
| 3740 | color = UI_RED_COLOR; | |
| 3746 | 3741 | ui_draw_outlined_box(x1, y1, x2, y2, color); |
| 3747 | 3742 | |
| 3748 | 3743 | /* take off the borders */ |
| r5955 | r5956 | |
| 3755 | 3750 | for (line = 0; line < 4; line++) |
| 3756 | 3751 | { |
| 3757 | 3752 | ui_draw_text_full(&tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 3758 | DRAW_NORMAL, | |
| 3753 | DRAW_NORMAL, U | |
| 3759 | 3754 | y1 += ui_get_line_height(); |
| 3760 | 3755 | } |
| 3761 | 3756 | } |
| r5955 | r5956 | |
|---|---|---|
| 136 | 136 | /* banking constants */ |
| 137 | 137 | #define MAX_BANKS (STATIC_BANKMAX - STATIC_BANK1) /* maximum number of banks */ |
| 138 | 138 | #define MAX_BANK_ENTRIES 4096 /* maximum number of possible bank values */ |
| 139 | #define MAX_EXPLICIT_BANKS 6 | |
| 139 | #define MAX_EXPLICIT_BANKS 96 | |
| 140 | 140 | |
| 141 | 141 | /* address map lookup table definitions */ |
| 142 | 142 | #define LEVEL1_BITS 18 /* number of address bits in the level 1 table */ |
| r5955 | r5956 | |
| 3427 | 3427 | "bank 20", "bank 21", "bank 22", "bank 23", |
| 3428 | 3428 | "bank 24", "bank 25", "bank 26", "bank 27", |
| 3429 | 3429 | "bank 28", "bank 29", "bank 30", "bank 31", |
| 3430 | "bank 32", "ram[33]", "ram[34]", "ram[35]", | |
| 3431 | "ram[36]", "ram[37]", "ram[38]", "ram[39]", | |
| 3432 | "ram[40]", "ram[41]", "ram[42]", "ram[43]", | |
| 3433 | "ram[44]", "ram[45]", "ram[46]", "ram[47]", | |
| 3434 | "ram[48]", "ram[49]", "ram[50]", "ram[51]", | |
| 3435 | "ram[52]", "ram[53]", "ram[54]", "ram[55]", | |
| 3436 | "ram[56]", "ram[57]", "ram[58]", "ram[59]", | |
| 3437 | "ram[60]", "ram[61]", "ram[62]", "ram[63]", | |
| 3438 | "ram[64]", "ram[65]", "ram[66]", "ram", | |
| 3430 | "bank 32", "bank 33", "bank 34", "bank 35", | |
| 3431 | "bank 36", "bank 37", "bank 38", "bank 39", | |
| 3432 | "bank 40", "bank 41", "bank 42", "bank 43", | |
| 3433 | "bank 44", "bank 45", "bank 46", "bank 47", | |
| 3434 | "bank 48", "bank 49", "bank 50", "bank 51", | |
| 3435 | "bank 52", "bank 53", "bank 54", "bank 55", | |
| 3436 | "bank 56", "bank 57", "bank 58", "bank 59", | |
| 3437 | "bank 60", "bank 61", "bank 62", "bank 63", | |
| 3438 | "bank 64", "bank 65", "bank 66", "bank 67", | |
| 3439 | "bank 68", "bank 69", "bank 70", "bank 71", | |
| 3440 | "bank 72", "bank 73", "bank 74", "bank 75", | |
| 3441 | "bank 76", "bank 77", "bank 78", "bank 79", | |
| 3442 | "bank 80", "bank 81", "bank 82", "bank 83", | |
| 3443 | "bank 84", "bank 85", "bank 86", "bank 87", | |
| 3444 | "bank 88", "bank 89", "bank 90", "bank 91", | |
| 3445 | "bank 92", "bank 93", "bank 94", "bank 95", | |
| 3446 | "bank 96", "ram[97]", "ram[98]", "ram[99]", | |
| 3447 | "ram[100]", "ram[101]", "ram[102]", "ram[103]", | |
| 3448 | "ram[104]", "ram[105]", "ram[106]", "ram[107]", | |
| 3449 | "ram[108]", "ram[109]", "ram[110]", "ram[111]", | |
| 3450 | "ram[112]", "ram[113]", "ram[114]", "ram[115]", | |
| 3451 | "ram[116]", "ram[117]", "ram[118]", "ram[119]", | |
| 3452 | "ram[120]", "ram[121]", "ram[122]", "ram", | |
| 3439 | 3453 | "rom", "nop", "unmapped", "watchpoint" |
| 3440 | 3454 | }; |
| 3441 | 3455 | |
| r5955 | r5956 | |
| 3443 | 3457 | if (entry < STATIC_COUNT) |
| 3444 | 3458 | return strings[entry]; |
| 3445 | 3459 | else |
| 3446 | return table->handlers[entry]->name ? table->handlers[entry]->name : "???"; | |
| 3460 | return (table->handlers[entry]->name != NULL) ? table->handlers[entry]->name : "???"; | |
| 3447 | 3461 | } |
| 3448 | 3462 | |
| 3449 | 3463 |
| r5955 | r5956 | |
|---|---|---|
| 40 | 40 | { |
| 41 | 41 | STATIC_INVALID = 0, /* invalid - should never be used */ |
| 42 | 42 | STATIC_BANK1 = 1, /* first memory bank */ |
| 43 | /* entries 1-64 are for fixed banks 1-64 specified by the driver */ | |
| 44 | /* entries 65-122 are for dynamically allocated internal banks */ | |
| 43 | /* entries 1-96 are for fixed banks 1-96 specified by the driver */ | |
| 44 | /* entries 97-122 are for dynamically allocated internal banks */ | |
| 45 | 45 | STATIC_BANKMAX = 122, /* last memory bank */ |
| 46 | 46 | STATIC_RAM, /* RAM - reads/writes map to dynamic banks */ |
| 47 | 47 | STATIC_ROM, /* ROM - reads = RAM; writes = UNMAP */ |
| r5955 | r5956 | |
|---|---|---|
| 273 | 273 | /* if no driver, use the internal empty driver */ |
| 274 | 274 | if (driver == NULL) |
| 275 | 275 | { |
| 276 | driver = & | |
| 276 | driver = &GAME | |
| 277 | 277 | if (firstgame) |
| 278 | 278 | started_empty = TRUE; |
| 279 | 279 | } |
| r5955 | r5956 | |
|---|---|---|
| 103 | 103 | MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, audio, _func) |
| 104 | 104 | |
| 105 | 105 | #define MDRV_LASERDISC_OVERLAY(_update, _width, _height, _format) \ |
| 106 | MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, | |
| 106 | MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, VIDEO_UPDATE_NAME(_update)) \ | |
| 107 | 107 | MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overwidth, _width) \ |
| 108 | 108 | MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overheight, _height) \ |
| 109 | 109 | MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overformat, _format) |
| r5955 | r5956 | |
|---|---|---|
| 744 | 744 | MACROS FOR BUILDING INPUT PORTS |
| 745 | 745 | ***************************************************************************/ |
| 746 | 746 | |
| 747 | /* so that "0" can be used for unneeded input ports */ | |
| 748 | #define ipt_0 NULL | |
| 749 | ||
| 750 | /* name of table */ | |
| 751 | #define INPUT_PORTS_NAME(_name) ipt_##_name | |
| 752 | ||
| 747 | 753 | /* start of table */ |
| 748 | 754 | #define INPUT_PORTS_START(_name) \ |
| 749 | const input_port_token | |
| 755 | const input_port_token INPUT_PORTS_NAME(_name)[] = { | |
| 750 | 756 | |
| 751 | 757 | /* end of table */ |
| 752 | 758 | #define INPUT_PORTS_END \ |
| r5955 | r5956 | |
| 754 | 760 | |
| 755 | 761 | /* aliasing */ |
| 756 | 762 | #define INPUT_PORTS_EXTERN(_name) \ |
| 757 | extern const input_port_token | |
| 763 | extern const input_port_token INPUT_PORTS_NAME(_name)[] | |
| 758 | 764 | |
| 759 | 765 | /* including */ |
| 760 | 766 | #define PORT_INCLUDE(_name) \ |
| 761 | 767 | TOKEN_UINT32_PACK1(INPUT_TOKEN_INCLUDE, 8), \ |
| 762 | TOKEN_PTR(tokenptr, & | |
| 768 | TOKEN_PTR(tokenptr, &INPUT_PORTS_NAME(_name)[0]), | |
| 763 | 769 | |
| 764 | 770 | /* start of a new input port (with included tag) */ |
| 765 | 771 | #define PORT_START(_tag) \ |
| r5955 | r5956 | |
|---|---|---|
| 36 | 36 | * |
| 37 | 37 | *************************************/ |
| 38 | 38 | |
| 39 | static | |
| 39 | static void task_check( | |
| 40 | 40 | { |
| 41 | discrete_task_context *task = (discrete_task_context *) node->context; | |
| 42 | 41 | int inputnum; |
| 43 | 42 | const linked_list_entry *node_entry; |
| 44 | 43 | const linked_list_entry *step_entry; |
| 45 | 44 | |
| 46 | /* Determine, which nodes in the task are referenced | |
| 45 | /* Determine, which nodes in the task are referenced by nodes | |
| 47 | 46 | * and add them to the list of nodes to be buffered for further processing |
| 48 | 47 | */ |
| 49 | 48 | for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next) |
| 50 | 49 | { |
| 51 | node_description *node = (node_description *) node_entry->ptr; | |
| 52 | int found = 0; | |
| 50 | const node_description *task_node = (node_description *) node_entry->ptr; | |
| 53 | 51 | |
| 54 | for (step_entry = | |
| 52 | for (step_entry = | |
| 55 | 53 | { |
| 56 | node_description *snode = (node_description *) step_entry->ptr; | |
| 54 | node_description *dest_node = (node_description *) step_entry->ptr; | |
| 57 | 55 | |
| 58 | 56 | /* loop over all active inputs */ |
| 59 | for (inputnum = 0; inputnum < snode->active_inputs; inputnum++) | |
| 57 | for (inputnum = 0; inputnum < dest_node->active_inputs; inputnum++) | |
| 60 | 58 | { |
| 61 | int inputnode = snode->block->input_node[inputnum]; | |
| 59 | int inputnode = dest_node->block->input_node[inputnum]; | |
| 62 | 60 | if IS_VALUE_A_NODE(inputnode) |
| 63 | 61 | { |
| 64 | if (NODE_DEFAULT_NODE(node->block->node) == NODE_DEFAULT_NODE(inputnode)) | |
| 62 | if (NODE_DEFAULT_NODE(task_node->block->node) == NODE_DEFAULT_NODE(inputnode)) | |
| 65 | 63 | { |
| 66 | int i; | |
| 67 | found = 0; | |
| 64 | discrete_source_node *source; | |
| 65 | int i, found = -1; | |
| 66 | ||
| 68 | 67 | for (i = 0; i < task->numbuffered; i++) |
| 69 | 68 | if (task->nodes[i]->block->node == inputnode) |
| 70 | found = 1; | |
| 71 | if (!found) | |
| 69 | { | |
| 70 | found = i; | |
| 71 | break; | |
| 72 | } | |
| 73 | ||
| 74 | if (found<0) | |
| 72 | 75 | { |
| 73 | 76 | if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS) |
| 74 | 77 | fatalerror("dso_task_start - Number of maximum buffered nodes exceeded"); |
| 75 | 78 | |
| 76 | discrete_log(node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_BLOCKINDEX(snode)); | |
| 77 | task->node_buf[task->numbuffered] = auto_alloc_array(node->info->device->machine, double, 2048); | |
| 78 | task->dest[task->numbuffered] = (double **) &snode->input[inputnum]; | |
| 79 | task->nodes[task->numbuffered] = discrete_find_node(node->info, inputnode); | |
| 79 | task->node_buf[task->numbuffered] = auto_alloc_array(task_node->info->device->machine, double, 2048); | |
| 80 | task->source[task->numbuffered] = (double *) dest_node->input[inputnum]; | |
| 81 | task->nodes[task->numbuffered] = discrete_find_node(task_node->info, inputnode); | |
| 82 | i = task->numbuffered; | |
| 80 | 83 | task->numbuffered++; |
| 81 | 84 | } |
| 85 | discrete_log(task_node->info, "dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, task->task_group, NODE_BLOCKINDEX(dest_node), dest_task->task_group); | |
| 86 | ||
| 87 | /* register into source list */ | |
| 88 | source = auto_alloc(dest_node->info->device->machine, discrete_source_node); | |
| 89 | linked_list_add(dest_node->info, | |
| 90 | (linked_list_entry **) (FPTR) &dest_task->source_list, | |
| 91 | source); | |
| 92 | source->task = task; | |
| 93 | source->output_node = i; | |
| 94 | ||
| 95 | /* point the input to a buffered location */ | |
| 96 | dest_node->input[inputnum] = &source->buffer; | |
| 97 | ||
| 82 | 98 | } |
| 83 | 99 | } |
| 84 | 100 | } |
| r5955 | r5956 | |
| 86 | 102 | } |
| 87 | 103 | } |
| 88 | 104 | |
| 89 | static DISCRETE_ST | |
| 105 | static DISCRETE_START( dso_task_start ) | |
| 90 | 106 | { |
| 91 | discrete_task_context *task = (discrete_task_context *) node->context; | |
| 107 | discrete_task *task = (discrete_task *) node->context; | |
| 108 | const linked_list_entry *task_entry; | |
| 109 | ||
| 110 | task->task_group = (int) DISCRETE_INPUT(0); | |
| 111 | ||
| 112 | if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) | |
| 113 | fatalerror("discrete_dso_task: illegal task_group %d", task->task_group); | |
| 114 | ||
| 115 | for (task_entry = node->info->task_list; task_entry != NULL; task_entry = task_entry->next) | |
| 116 | { | |
| 117 | discrete_task *dest_task = (discrete_task *) task_entry->ptr; | |
| 118 | ||
| 119 | if (task->task_group > dest_task->task_group) | |
| 120 | task_check(dest_task, task); | |
| 121 | } | |
| 122 | ||
| 123 | } | |
| 124 | ||
| 125 | static DISCRETE_STEP( dso_task_end ) | |
| 126 | { | |
| 127 | discrete_task *task = (discrete_task *) node->context; | |
| 92 | 128 | int i; |
| 93 | 129 | |
| 94 | 130 | for (i = 0; i < task->numbuffered; i++) |
| 95 | *(task->ptr[i]++) = * | |
| 131 | *(task->ptr[i]++) = * | |
| 96 | 132 | } |
| 97 | 133 | |
| 134 | static DISCRETE_STEP( dso_task_start ) | |
| 135 | { | |
| 136 | const discrete_task *task = (discrete_task *) node->context; | |
| 137 | const linked_list_entry *entry; | |
| 138 | ||
| 139 | /* update source node buffer */ | |
| 140 | for (entry = task->source_list; entry != 0; entry = entry->next) | |
| 141 | { | |
| 142 | discrete_source_node *sn = (discrete_source_node *) entry->ptr; | |
| 143 | sn->buffer = *sn->ptr++; | |
| 144 | } | |
| 145 | } | |
| 146 | ||
| 147 | ||
| 98 | 148 | static DISCRETE_RESET( dso_task ) |
| 99 | 149 | { |
| 100 | 150 | /* nothing to do - just avoid being stepped */ |
| r5955 | r5956 | |
|---|---|---|
| 63 | 63 | /* Read the node input value if allowed */ |
| 64 | 64 | if (node) |
| 65 | 65 | { |
| 66 | struct dss_input_context *context = (struct dss_input_context *)node->context; | |
| 67 | ||
| 68 | 66 | /* Bring the system up to now */ |
| 69 | 67 | stream_update(info->discrete_stream); |
| 70 | 68 | |
| 71 | if ((node->module->type >= DSS_INPUT_DATA) && (node->module->type <= DSS_INPUT_PULSE)) | |
| 72 | { | |
| 73 | data = context->data; | |
| 74 | } | |
| 69 | data = (UINT8) node->output[NODE_CHILD_NODE_NUM(offset)]; | |
| 75 | 70 | } |
| 76 | 71 | else |
| 77 | | |
| 72 | fa | |
| 78 | 73 | |
| 79 | 74 | return data; |
| 80 | 75 | } |
| r5955 | r5956 | |
|---|---|---|
| 109 | 109 | double countdown; |
| 110 | 110 | int state; |
| 111 | 111 | int last_trig; |
| 112 | int type; | |
| 112 | 113 | }; |
| 113 | 114 | |
| 114 | 115 | struct dss_ramp_context |
| r5955 | r5956 | |
| 272 | 273 | * |
| 273 | 274 | * DST_CLAMP - Simple signal clamping circuit |
| 274 | 275 | * |
| 275 | * input[0] - Enable ramp | |
| 276 | * input[1] - Input value | |
| 277 | * input[2] - Minimum value | |
| 278 | * input[3] - Maximum value | |
| 279 | * input[4] - Clamp output when disabled | |
| 276 | * input[0] - Input value | |
| 277 | * input[1] - Minimum value | |
| 278 | * input[2] - Maximum value | |
| 280 | 279 | * |
| 281 | 280 | ************************************************************************/ |
| 282 | #define DST_CLAMP__ENABLE DISCRETE_INPUT(0) | |
| 283 | #define DST_CLAMP__IN DISCRETE_INPUT(1) | |
| 284 | #define DST_CLAMP__MIN DISCRETE_INPUT(2) | |
| 285 | #define DST_CLAMP__MAX DISCRETE_INPUT(3) | |
| 286 | #define DST_CLAMP__CLAMP DISCRETE_INPUT(4) | |
| 281 | #define DST_CLAMP__IN DISCRETE_INPUT(0) | |
| 282 | #define DST_CLAMP__MIN DISCRETE_INPUT(1) | |
| 283 | #define DST_CLAMP__MAX DISCRETE_INPUT(2) | |
| 287 | 284 | |
| 288 | 285 | static DISCRETE_STEP(dst_clamp) |
| 289 | 286 | { |
| 290 | if(DST_CLAMP__ENABLE) | |
| 291 | { | |
| 292 | if (DST_CLAMP__IN < DST_CLAMP__MIN) node->output[0] = DST_CLAMP__MIN; | |
| 293 | else if (DST_CLAMP__IN > DST_CLAMP__MAX) node->output[0] = DST_CLAMP__MAX; | |
| 294 | else node->output[0]= DST_CLAMP__IN; | |
| 295 | } | |
| 296 | else | |
| 297 | { | |
| 298 | node->output[0] = DST_CLAMP__CLAMP; | |
| 299 | } | |
| 287 | if (DST_CLAMP__IN < DST_CLAMP__MIN) node->output[0] = DST_CLAMP__MIN; | |
| 288 | else if (DST_CLAMP__IN > DST_CLAMP__MAX) node->output[0] = DST_CLAMP__MAX; | |
| 289 | else node->output[0]= DST_CLAMP__IN; | |
| 300 | 290 | } |
| 301 | 291 | |
| 302 | 292 | |
| r5955 | r5956 | |
| 1167 | 1157 | bit_mask = bit_mask << 1; |
| 1168 | 1158 | } |
| 1169 | 1159 | } |
| 1170 | else | |
| 1160 | else if (c_bit_flag != 0) | |
| 1171 | 1161 | { |
| 1172 | 1162 | /* no r_nodes, so just do high pass filtering */ |
| 1173 | 1163 | for (bit = 0; bit < context->size; bit++) |
| r5955 | r5956 | |
| 1183 | 1173 | i += ((type == DISC_MIXER_IS_OP_AMP) ? v_ref - vTemp : vTemp) / info->r[bit]; |
| 1184 | 1174 | } |
| 1185 | 1175 | } |
| 1176 | else | |
| 1177 | { | |
| 1178 | /* no r_nodes or c_nodes, mixing only */ | |
| 1179 | if (type == DISC_MIXER_IS_OP_AMP) | |
| 1180 | { | |
| 1181 | for (bit = 0; bit < context->size; bit++) | |
| 1182 | i += ( v_ref - DST_MIXER__IN(bit) ) / info->r[bit]; | |
| 1183 | } | |
| 1184 | else | |
| 1185 | { | |
| 1186 | for (bit = 0; bit < context->size; bit++) | |
| 1187 | i += DST_MIXER__IN(bit) / info->r[bit]; | |
| 1188 | } | |
| 1189 | } | |
| 1186 | 1190 | |
| 1187 | 1191 | if (type == DISC_MIXER_IS_OP_AMP_WITH_RI) |
| 1188 | 1192 | i += v_ref / rI; |
| r5955 | r5956 | |
| 1222 | 1226 | } |
| 1223 | 1227 | } |
| 1224 | 1228 | |
| 1229 | ||
| 1225 | 1230 | static DISCRETE_RESET(dst_mixer) |
| 1226 | 1231 | { |
| 1227 | 1232 | const discrete_mixer_desc *info = (const discrete_mixer_desc *)node->custom; |
| r5955 | r5956 | |
| 1366 | 1371 | { |
| 1367 | 1372 | struct dst_size_context *context = (struct dst_size_context *)node->context; |
| 1368 | 1373 | |
| 1369 | context->size = node->active_inputs - | |
| 1374 | context->size = node->active_inputs - 1; | |
| 1370 | 1375 | |
| 1371 | 1376 | DISCRETE_STEP_CALL(dst_multiplex); |
| 1372 | 1377 | } |
| r5955 | r5956 | |
| 1414 | 1419 | context->last_trig = trigger; |
| 1415 | 1420 | |
| 1416 | 1421 | /* Is it the proper edge trigger */ |
| 1417 | if (( | |
| 1422 | if ((context->type | |
| 1418 | 1423 | { |
| 1419 | 1424 | if (!context->state) |
| 1420 | 1425 | { |
| 1421 | 1426 | /* We have first trigger */ |
| 1422 | 1427 | context->state = 1; |
| 1423 | node->output[0] = ( | |
| 1428 | node->output[0] = (context->type | |
| 1424 | 1429 | context->countdown = DST_ONESHOT__WIDTH; |
| 1425 | 1430 | } |
| 1426 | 1431 | else |
| 1427 | 1432 | { |
| 1428 | 1433 | /* See if we retrigger */ |
| 1429 | if ( | |
| 1434 | if (context->type | |
| 1430 | 1435 | { |
| 1431 | 1436 | /* Retrigger */ |
| 1432 | 1437 | context->countdown = DST_ONESHOT__WIDTH; |
| r5955 | r5956 | |
| 1441 | 1446 | context->countdown -= node->info->sample_time; |
| 1442 | 1447 | if(context->countdown <= 0.0) |
| 1443 | 1448 | { |
| 1444 | node->output[0] = ( | |
| 1449 | node->output[0] = (context->type | |
| 1445 | 1450 | context->countdown = 0; |
| 1446 | 1451 | context->state = 0; |
| 1447 | 1452 | } |
| r5955 | r5956 | |
| 1458 | 1463 | context->state = 0; |
| 1459 | 1464 | |
| 1460 | 1465 | context->last_trig = 0; |
| 1461 | node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; | |
| 1466 | context->type = DST_ONESHOT__TYPE; | |
| 1467 | ||
| 1468 | node->output[0] = (context->type & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; | |
| 1462 | 1469 | } |
| 1463 | 1470 | |
| 1464 | 1471 |
| r5955 | r5956 | |
|---|---|---|
| 67 | 67 | typedef struct _task_info task_info; |
| 68 | 68 | struct _task_info |
| 69 | 69 | { |
| 70 | discrete_task | |
| 70 | discrete_task | |
| 71 | 71 | int samples; |
| 72 | 72 | }; |
| 73 | 73 | |
| r5955 | r5956 | |
| 78 | 78 | * |
| 79 | 79 | *************************************/ |
| 80 | 80 | |
| 81 | static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device); | |
| 82 | static void find_input_nodes(discrete_info *info); | |
| 83 | static node_description *discrete_find_node(const discrete_info *info, int node); | |
| 81 | static void init_nodes(discrete_info *info, const linked_list_entry *block_list, const device_config *device); | |
| 82 | static void find_input_nodes(const discrete_info *info); | |
| 83 | static node_description *discrete_find_node(const discrete_info *info, const int node); | |
| 84 | 84 | static DEVICE_RESET( discrete ); |
| 85 | 85 | static STREAM_UPDATE( discrete_stream_update ); |
| 86 | 86 | static STREAM_UPDATE( buffer_stream_update ); |
| r5955 | r5956 | |
| 103 | 103 | { |
| 104 | 104 | vfprintf(disc_info->disclogfile, text, arg); |
| 105 | 105 | fprintf(disc_info->disclogfile, "\n"); |
| 106 | fflush(disc_info->disclogfile); | |
| 106 | 107 | } |
| 107 | 108 | |
| 108 | 109 | va_end(arg); |
| r5955 | r5956 | |
| 132 | 133 | return -1; |
| 133 | 134 | } |
| 134 | 135 | |
| 135 | INLINE void linked_list_add(const discrete_info *info, linked_list_entry ***list_tail_ptr, const void *ptr) | |
| 136 | INLINE void linked_list_tail_add(const discrete_info *info, linked_list_entry ***list_tail_ptr, const void *ptr) | |
| 136 | 137 | { |
| 137 | 138 | **list_tail_ptr = auto_alloc(info->device->machine, linked_list_entry); |
| 138 | 139 | (**list_tail_ptr)->ptr = ptr; |
| r5955 | r5956 | |
| 150 | 151 | |
| 151 | 152 | return cnt; |
| 152 | 153 | } |
| 154 | ||
| 155 | INLINE void linked_list_add(const discrete_info *info, linked_list_entry **list, const void *ptr) | |
| 156 | { | |
| 157 | linked_list_entry *entry; | |
| 158 | ||
| 159 | if (*list == NULL) | |
| 160 | { | |
| 161 | *list = auto_alloc(info->device->machine, linked_list_entry); | |
| 162 | (*list)->ptr = ptr; | |
| 163 | (*list)->next = NULL; | |
| 164 | } | |
| 165 | else | |
| 166 | { | |
| 167 | for (entry = *list; entry != NULL && entry->next != NULL; entry = entry->next) | |
| 168 | ; | |
| 169 | entry->next = auto_alloc(info->device->machine, linked_list_entry); | |
| 170 | entry->next->ptr = ptr; | |
| 171 | entry->next->next = NULL; | |
| 172 | } | |
| 173 | } | |
| 174 | ||
| 153 | 175 | /************************************* |
| 154 | 176 | * |
| 155 | 177 | * Included simulation objects |
| r5955 | r5956 | |
| 179 | 201 | { DSO_IMPORT ,"DSO_IMPORT" , 0 ,0 ,NULL ,NULL ,NULL ,NULL }, |
| 180 | 202 | |
| 181 | 203 | /* parallel modules */ |
| 182 | { DSO_TASK_START ,"DSO_TASK_START" , 0 ,0 ,NULL ,NULL ,NULL ,NULL }, | |
| 183 | { DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_step ,dso_task_start ,NULL }, | |
| 204 | { DSO_TASK_START ,"DSO_TASK_START" , 0 ,0 ,dso_task_reset ,dso_task_start_step ,dso_task_start_start ,NULL }, | |
| 205 | { DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_end_step ,NULL ,NULL }, | |
| 184 | 206 | { DSO_TASK_SYNC ,"DSO_TASK_SYNC" , 0 ,0 ,NULL ,NULL ,NULL ,NULL }, |
| 185 | 207 | |
| 186 | 208 | /* nop */ |
| r5955 | r5956 | |
| 395 | 417 | else |
| 396 | 418 | { |
| 397 | 419 | discrete_log(info, "discrete_build_list() - adding node %d (*current %p)\n", node_count, *current); |
| 398 | linked_list_add(info, current, &intf[node_count]); | |
| 420 | linked_list_tail_add(info, current, &intf[node_count]); | |
| 399 | 421 | } |
| 400 | 422 | |
| 401 | 423 | node_count++; |
| r5955 | r5956 | |
| 410 | 432 | |
| 411 | 433 | static void discrete_sanity_check(const discrete_info *info) |
| 412 | 434 | { |
| 413 | linked_list_entry *entry; | |
| 435 | const linked_list_entry *entry; | |
| 414 | 436 | int node_count = 0; |
| 415 | 437 | |
| 416 | 438 | discrete_log(info, "discrete_start() - Doing node list sanity check"); |
| r5955 | r5956 | |
| 449 | 471 | static DEVICE_START( discrete ) |
| 450 | 472 | { |
| 451 | 473 | linked_list_entry **intf; |
| 452 | linked_list_entry *entry; | |
| 453 | discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config; | |
| 474 | const linked_list_entry *entry; | |
| 475 | const discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config; | |
| 454 | 476 | discrete_info *info = get_safe_token(device); |
| 455 | 477 | char name[32]; |
| 456 | 478 | |
| r5955 | r5956 | |
| 482 | 504 | |
| 483 | 505 | /* Start with empty lists */ |
| 484 | 506 | info->node_list = NULL; |
| 485 | info->step_list = NULL; | |
| 486 | 507 | info->output_list = NULL; |
| 487 | 508 | info->input_list = NULL; |
| 488 | 509 | |
| r5955 | r5956 | |
| 562 | 583 | /* Task information */ |
| 563 | 584 | for (entry = info->task_list; entry != 0; entry = entry->next) |
| 564 | 585 | { |
| 565 | discrete_task | |
| 586 | discrete_task | |
| 566 | 587 | tt = list_run_time(task->list); |
| 567 | 588 | |
| 568 | printf("Task: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples); | |
| 589 | printf("Task(%d): %8.2f %15.2f\n", task->task_group, tt / (double) total * 100.0, tt / (double) info->total_samples); | |
| 569 | 590 | } |
| 570 | tt = list_run_time(info->step_list); | |
| 571 | 591 | |
| 572 | printf("Main: %8.2f %15.2f\n", tt / (double) total * 100.0, tt / (double) info->total_samples); | |
| 573 | ||
| 574 | 592 | printf("Average samples/stream_update: %8.2f\n", (double) info->total_samples / (double) info->total_stream_updates); |
| 575 | 593 | } |
| 576 | 594 | |
| 577 | 595 | static DEVICE_STOP( discrete ) |
| 578 | 596 | { |
| 579 | 597 | discrete_info *info = get_safe_token(device); |
| 580 | linked_list_entry *entry; | |
| 598 | const linked_list_entry *entry; | |
| 581 | 599 | |
| 582 | 600 | osd_work_queue_free(info->queue); |
| 583 | 601 | |
| r5955 | r5956 | |
| 615 | 633 | |
| 616 | 634 | static DEVICE_RESET( discrete ) |
| 617 | 635 | { |
| 618 | discrete_info *info = get_safe_token(device); | |
| 619 | linked_list_entry *entry; | |
| 636 | const discrete_info *info = get_safe_token(device); | |
| 637 | const linked_list_entry *entry; | |
| 620 | 638 | |
| 621 | 639 | /* loop over all nodes */ |
| 622 | 640 | for (entry = info->node_list; entry != 0; entry = entry->next) |
| r5955 | r5956 | |
| 643 | 661 | |
| 644 | 662 | static void *task_callback(void *param, int threadid) |
| 645 | 663 | { |
| 646 | task_info *ti = (task_info *) param; | |
| 664 | const task_info *ti = (task_info *) param; | |
| 665 | const linked_list_entry *entry; | |
| 666 | discrete_task *task = ti->task; | |
| 647 | 667 | int samples, i; |
| 648 | 668 | |
| 649 | 669 | /* set up task buffers */ |
| 650 | for (i = 0; i < ti->context->numbuffered; i++) | |
| 651 | ti->context->ptr[i] = &ti->context->node_buf[i][0]; | |
| 670 | for (i = 0; i < task->numbuffered; i++) | |
| 671 | task->ptr[i] = task->node_buf[i]; | |
| 652 | 672 | |
| 673 | /* initialize sources */ | |
| 674 | for (entry = task->source_list; entry != 0; entry = entry->next) | |
| 675 | { | |
| 676 | discrete_source_node *sn = (discrete_source_node *) entry->ptr; | |
| 677 | sn->ptr = sn->task->node_buf[sn->output_node]; | |
| 678 | } | |
| 679 | ||
| 653 | 680 | samples = ti->samples; |
| 654 | 681 | while (samples-- > 0) |
| 655 | 682 | { |
| 656 | step_nodes_in_list(ti->context->list); | |
| 683 | /* step */ | |
| 684 | step_nodes_in_list(task->list); | |
| 657 | 685 | } |
| 658 | /* reset ptr */ | |
| 659 | for (i = 0; i < ti->context->numbuffered; i++) | |
| 660 | ti->context->ptr[i] = &ti->context->node_buf[i][0]; | |
| 661 | 686 | |
| 662 | 687 | free(param); |
| 663 | 688 | return NULL; |
| 664 | 689 | } |
| 665 | 690 | |
| 666 | INLINE void discrete_stream_update_nodes(discrete_info *info) | |
| 667 | { | |
| 668 | linked_list_entry *entry; | |
| 669 | 691 | |
| 670 | if (DISCRETE_PROFILING) | |
| 671 | info->total_samples++; | |
| 672 | ||
| 673 | /* update task nodes */ | |
| 674 | for (entry = info->task_list; entry != 0; entry = entry->next) | |
| 675 | { | |
| 676 | discrete_task_context *task = (discrete_task_context *) entry->ptr; | |
| 677 | int i; | |
| 678 | ||
| 679 | for (i = task->numbuffered - 1; i >= 0 ; i--) | |
| 680 | **task->dest[i] = *task->ptr[i]++; | |
| 681 | } | |
| 682 | ||
| 683 | /* loop over all nodes */ | |
| 684 | step_nodes_in_list(info->step_list); | |
| 685 | } | |
| 686 | ||
| 687 | 692 | static STREAM_UPDATE( buffer_stream_update ) |
| 688 | 693 | { |
| 689 | node_description *node = (node_description *) param; | |
| 690 | struct dss_input_context *context = (struct dss_input_context *)node->context; | |
| 694 | const node_description *node = (node_description *) param; | |
| 695 | const struct dss_input_context *context = (struct dss_input_context *)node->context; | |
| 691 | 696 | stream_sample_t *ptr = outputs[0]; |
| 692 | 697 | int data = context->data; |
| 693 | 698 | int samplenum = samples; |
| r5955 | r5956 | |
| 700 | 705 | static STREAM_UPDATE( discrete_stream_update ) |
| 701 | 706 | { |
| 702 | 707 | discrete_info *info = (discrete_info *)param; |
| 703 | linked_list_entry *entry; | |
| 704 | int samplenum, outputnum; | |
| 708 | const linked_list_entry *entry; | |
| 709 | int outputnum, task_group; | |
| 705 | 710 | |
| 706 | 711 | if (samples == 0) |
| 707 | 712 | return; |
| r5955 | r5956 | |
| 719 | 724 | context->ptr = (stream_sample_t *) inputs[context->stream_in_number]; |
| 720 | 725 | } |
| 721 | 726 | |
| 722 | /* Queue tasks */ | |
| 723 | for (entry = info->task_list; entry != 0; entry = entry->next) | |
| 727 | for (task_group = 0; task_group < DISCRETE_MAX_TASK_GROUPS; task_group++) | |
| 724 | 728 | { |
| 725 | task_info *ti = (task_info *)malloc(sizeof(task_info)); | |
| 726 | discrete_task_context *task = (discrete_task_context *) entry->ptr; | |
| 729 | /* Queue tasks */ | |
| 730 | for (entry = info->task_list; entry != 0; entry = entry->next) | |
| 731 | { | |
| 732 | discrete_task *task = (discrete_task *) entry->ptr; | |
| 727 | 733 | |
| 728 | /* Fire task */ | |
| 729 | ti->context = task; | |
| 730 | ti->samples = samples; | |
| 731 | osd_work_item_queue(info->queue, task_callback, (void *) ti, WORK_ITEM_FLAG_AUTO_RELEASE); | |
| 734 | if (task->task_group == task_group) | |
| 735 | { | |
| 736 | task_info *ti = (task_info *)malloc(sizeof(task_info)); | |
| 737 | ||
| 738 | /* Fire task */ | |
| 739 | ti->task = task; | |
| 740 | ti->samples = samples; | |
| 741 | osd_work_item_queue(info->queue, task_callback, (void *) ti, WORK_ITEM_FLAG_AUTO_RELEASE); | |
| 742 | } | |
| 743 | } | |
| 744 | /* and wait for them */ | |
| 745 | osd_work_queue_wait(info->queue, osd_ticks_per_second()*10); | |
| 732 | 746 | } |
| 733 | 747 | |
| 734 | /* and wait for them */ | |
| 735 | osd_work_queue_wait(info->queue, osd_ticks_per_second()*10); | |
| 736 | ||
| 737 | /* Now we must do samples iterations of the node list, one output for each step */ | |
| 738 | for (samplenum = 0; samplenum < samples; samplenum++) | |
| 739 | discrete_stream_update_nodes(info); | |
| 740 | ||
| 741 | 748 | if (DISCRETE_PROFILING) |
| 749 | { | |
| 750 | info->total_samples += samples; | |
| 742 | 751 | info->total_stream_updates++; |
| 752 | } | |
| 743 | 753 | |
| 744 | 754 | } |
| 745 | 755 | |
| r5955 | r5956 | |
| 752 | 762 | *************************************/ |
| 753 | 763 | |
| 754 | 764 | |
| 755 | static void init_nodes(discrete_info *info, linked_list_entry *block_list, const device_config *device) | |
| 765 | static void init_nodes(discrete_info *info, const linked_list_entry *block_list, const device_config *device) | |
| 756 | 766 | { |
| 757 | linked_list_entry **task_node_list_ptr = NULL; | |
| 758 | linked_list_entry *entry; | |
| 767 | const linked_list_entry *entry; | |
| 759 | 768 | linked_list_entry *task_node_list = NULL; |
| 760 | discrete_task | |
| 769 | discrete_task | |
| 761 | 770 | /* list tail pointers */ |
| 762 | linked_list_entry ** | |
| 771 | linked_list_entry ** | |
| 763 | 772 | linked_list_entry **node_list_ptr = &info->node_list; |
| 764 | 773 | linked_list_entry **task_list_ptr = &info->task_list; |
| 765 | 774 | linked_list_entry **output_list_ptr = &info->output_list; |
| 766 | 775 | linked_list_entry **input_list_ptr = &info->input_list; |
| 776 | int has_tasks = 0; | |
| 767 | 777 | |
| 778 | /* check whether we have tasks ... */ | |
| 779 | for (entry = block_list; entry != NULL; entry = entry->next) | |
| 780 | { | |
| 781 | const discrete_sound_block *block = (discrete_sound_block *) entry->ptr; | |
| 782 | if (block->type == DSO_TASK_START) | |
| 783 | has_tasks = 1; | |
| 784 | } | |
| 785 | ||
| 786 | if (!has_tasks) | |
| 787 | { | |
| 788 | /* set up a main task */ | |
| 789 | task_node_list = NULL; | |
| 790 | task_node_list_ptr = &task_node_list; | |
| 791 | } | |
| 792 | ||
| 768 | 793 | /* loop over all nodes */ |
| 769 | 794 | for (entry = block_list; entry != NULL; entry = entry->next) |
| 770 | 795 | { |
| 771 | discrete_sound_block *block = (discrete_sound_block *) entry->ptr; | |
| 796 | const discrete_sound_block *block = (discrete_sound_block *) entry->ptr; | |
| 772 | 797 | node_description *node = auto_alloc_clear(info->device->machine, node_description); |
| 773 | 798 | int modulenum; |
| 774 | 799 | |
| r5955 | r5956 | |
| 808 | 833 | { |
| 809 | 834 | /* Output Node */ |
| 810 | 835 | case DSO_OUTPUT: |
| 811 | linked_list_add(info, &output_list_ptr, node); | |
| 836 | linked_list_tail_add(info, &output_list_ptr, node); | |
| 812 | 837 | break; |
| 813 | 838 | |
| 814 | 839 | /* CSVlog Node for debugging */ |
| r5955 | r5956 | |
| 823 | 848 | case DSO_TASK_START: |
| 824 | 849 | if (task_node_list_ptr != NULL) |
| 825 | 850 | fatalerror("init_nodes() - Nested DISCRETE_START_TASK."); |
| 851 | task = auto_alloc_clear(info->device->machine, discrete_task); | |
| 852 | node->context = task; | |
| 826 | 853 | task_node_list = NULL; |
| 827 | 854 | task_node_list_ptr = &task_node_list; |
| 828 | 855 | break; |
| r5955 | r5956 | |
| 830 | 857 | case DSO_TASK_END: |
| 831 | 858 | if (task_node_list_ptr == NULL) |
| 832 | 859 | fatalerror("init_nodes() - NO DISCRETE_START_TASK."); |
| 833 | task = auto_alloc_clear(info->device->machine, discrete_task_context); | |
| 834 | 860 | task->numbuffered = 0; |
| 835 | 861 | task->list = task_node_list; |
| 836 | linked_list_add(info, &task_list_ptr, task); | |
| 862 | task->task_group = -1; /* will be set later */ | |
| 863 | task->source_list = NULL; | |
| 864 | linked_list_tail_add(info, &task_list_ptr, task); | |
| 837 | 865 | node->context = task; |
| 838 | 866 | task = NULL; |
| 839 | 867 | task_node_list = NULL; |
| r5955 | r5956 | |
| 855 | 883 | /* if we are an stream input node, track that */ |
| 856 | 884 | if (block->type == DSS_INPUT_STREAM) |
| 857 | 885 | { |
| 858 | linked_list_add(info, &input_list_ptr, node); | |
| 886 | linked_list_tail_add(info, &input_list_ptr, node); | |
| 859 | 887 | } |
| 860 | 888 | else if (block->type == DSS_INPUT_BUFFER) |
| 861 | 889 | { |
| 862 | linked_list_add(info, &input_list_ptr, node); | |
| 890 | linked_list_tail_add(info, &input_list_ptr, node); | |
| 863 | 891 | } |
| 864 | 892 | |
| 865 | 893 | /* add to node list */ |
| 866 | linked_list_add(info, &node_list_ptr, node); | |
| 894 | linked_list_tail_add(info, &node_list_ptr, node); | |
| 867 | 895 | |
| 868 | 896 | /* our running order just follows the order specified */ |
| 869 | 897 | /* does the node step ? */ |
| r5955 | r5956 | |
| 871 | 899 | { |
| 872 | 900 | /* do we belong to a task? */ |
| 873 | 901 | if (task_node_list_ptr == NULL) |
| 874 | lin | |
| 902 | fatalerror("in | |
| 875 | 903 | else |
| 876 | linked_list_add(info, &task_node_list_ptr, node); | |
| 904 | linked_list_tail_add(info, &task_node_list_ptr, node); | |
| 877 | 905 | } |
| 878 | 906 | |
| 879 | 907 | if (block->type == DSO_TASK_END) |
| r5955 | r5956 | |
| 886 | 914 | state_save_register_device_item_array(device, node->block->node, node->output); |
| 887 | 915 | } |
| 888 | 916 | |
| 917 | if (!has_tasks) | |
| 918 | { | |
| 919 | /* make sure we have one simple task | |
| 920 | * No need to create a node since there are no dependencies. | |
| 921 | */ | |
| 922 | task = auto_alloc_clear(info->device->machine, discrete_task); | |
| 923 | task->numbuffered = 0; | |
| 924 | task->list = task_node_list; | |
| 925 | task->task_group = 0; | |
| 926 | task->source_list = NULL; | |
| 927 | linked_list_tail_add(info, &task_list_ptr, task); | |
| 928 | } | |
| 929 | ||
| 889 | 930 | /* if no outputs, give an error */ |
| 890 | 931 | if (linked_list_count(info->output_list) == 0) |
| 891 | 932 | fatalerror("init_nodes() - Couldn't find an output node"); |
| r5955 | r5956 | |
| 898 | 939 | * |
| 899 | 940 | *************************************/ |
| 900 | 941 | |
| 901 | static void find_input_nodes(discrete_info *info) | |
| 942 | static void find_input_nodes(const discrete_info *info) | |
| 902 | 943 | { |
| 944 | const linked_list_entry *entry; | |
| 903 | 945 | int inputnum; |
| 904 | linked_list_entry *entry; | |
| 905 | 946 | |
| 906 | 947 | /* loop over all nodes */ |
| 907 | 948 | for (entry = info->node_list; entry != NULL; entry = entry->next) |
| r5955 | r5956 | |
| 917 | 958 | /* if this input is node-based, find the node in the indexed list */ |
| 918 | 959 | if IS_VALUE_A_NODE(inputnode) |
| 919 | 960 | { |
| 920 | node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)]; | |
| 961 | const node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)]; | |
| 921 | 962 | if (!node_ref) |
| 922 | 963 | fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_BLOCKINDEX(node), NODE_INDEX(inputnode)); |
| 923 | 964 | |
| r5955 | r5956 | |
| 944 | 985 | } |
| 945 | 986 | for (inputnum = node->active_inputs; inputnum < DISCRETE_MAX_INPUTS; inputnum++) |
| 946 | 987 | { |
| 947 | / | |
| 988 | /* FIXME: Check that no nodes follow ! */ | |
| 948 | 989 | node->input[inputnum] = &(block->initial[inputnum]); |
| 949 | 990 | } |
| 950 | 991 | } |
| r5955 | r5956 | |
|---|---|---|
| 16 | 16 | * Coding started in November 2000 |
| 17 | 17 | * |
| 18 | 18 | * Additions/bugfix February 2003 - D.Renaud, F.Palazzolo, K.Wilkins |
| 19 | * Discrete parallel tasks 2009 - Couriersud | |
| 19 | 20 | * |
| 20 | 21 | *********************************************************************** |
| 21 | 22 | * |
| r5955 | r5956 | |
| 95 | 96 | * DISCRETE_INPUT_LOGIC(NODE_01) |
| 96 | 97 | * DISCRETE_SQUAREWFIX(NODE_11, 1, 0.5, 1, 50, 1.0/2, 0) // Output 0:1 |
| 97 | 98 | * DISCRETE_SINEWAVE(NODE_12, NODE_11, 2000, 10000, 0, 0) |
| 98 | * DISCRETE_LOGIC_INVERT(NODE_13, | |
| 99 | * DISCRETE_LOGIC_INVERT(NODE_13, | |
| 99 | 100 | * DISCRETE_SINEWAVE(NODE_14, NODE_13, 4000, 10000, 0, 0) |
| 100 | 101 | * DISCRETE_ADDER2(NODE_20, NODE_01, NODE_12, NODE_14) |
| 101 | 102 | * DISCRETE_OUTPUT(NODE_20, 1) |
| r5955 | r5956 | |
| 303 | 304 | * DISCRETE_555_CC(NODE,RESET,VIN,R,C,RBIAS,RGND,RDIS,OPTIONS) |
| 304 | 305 | * DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS) |
| 305 | 306 | * DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS) |
| 306 | * DISCRETE_566(NODE,VMOD,R,C,OPTIONS) | |
| 307 | * DISCRETE_566(NODE,VMOD,R,C,VPOS,VNEG,VCHARGE,OPTIONS) | |
| 307 | 308 | * DISCRETE_74LS624(NODE,VMOD,VRNG,C,OUTTYPE) |
| 308 | 309 | * |
| 309 | 310 | * DISCRETE_CUSTOM1(NODE,IN0,INFO) |
| r5955 | r5956 | |
| 811 | 812 | * discrete_op_amp_osc_info = {type, r1, r2, r3, r4, r5, r6, r7, r8, c, vP} |
| 812 | 813 | * |
| 813 | 814 | * Note: Set all unused components to 0. |
| 815 | * _OUT_SQW can also be replaced with | |
| 816 | * _OUT_ENERGY, _OUT_LOGIC_X, _OUT_COUNT_F_X, _OUT_COUNT_R_X | |
| 814 | 817 | * |
| 815 | 818 | * Types: |
| 816 | 819 | * |
| r5955 | r5956 | |
| 840 | 843 | * |
| 841 | 844 | * EXAMPLES: see Polaris, Amazing Maze |
| 842 | 845 | * |
| 846 | * -------------------------------------------------- | |
| 847 | * | |
| 848 | * DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON | |
| 849 | * Basic Norton Op Amp Oscillator circuit. | |
| 850 | * | |
| 851 | * .-------------------------------------------> DISC_OP_AMP_OSCILLATOR_OUT_CAP | |
| 852 | * | | |
| 853 | * | r1 | |
| 854 | * +------ZZZZ-----. | |
| 855 | * | | | |
| 856 | * | |\ | | |
| 857 | * | r2 | \ | | |
| 858 | * +---ZZZZ--|- \ | | |
| 859 | * | | >-+-------> DISC_OP_AMP_OSCILLATOR_OUT_SQW | |
| 860 | * --- c |+ / | | |
| 861 | * --- .---| / | | |
| 862 | * | | |/ | | |
| 863 | * gnd | | | |
| 864 | * | r3 | | |
| 865 | * +--ZZZZ---' | |
| 866 | * | | |
| 867 | * Z | |
| 868 | * Z r4 | |
| 869 | * Z | |
| 870 | * | | |
| 871 | * ^ | |
| 872 | * vP | |
| 873 | * | |
| 874 | * Note: All values are static. | |
| 875 | * | |
| 876 | * EXAMPLES: see Space Walk | |
| 877 | * | |
| 843 | 878 | *********************************************************************** |
| 844 | 879 | * |
| 845 | 880 | * DISCRETE_OP_AMP_VCOn - Various single power supply op-amp VCO circuits |
| r5955 | r5956 | |
| 856 | 891 | * discrete_op_amp_osc_info = {type, r1, r2, r3, r4, r5, r6, r7, r8, c, vP} |
| 857 | 892 | * |
| 858 | 893 | * Note: Set all unused components to 0. |
| 894 | * _OUT_SQW can also be replaced with | |
| 895 | * _OUT_ENERGY, _OUT_LOGIC_X, _OUT_COUNT_F_X, _OUT_COUNT_R_X | |
| 859 | 896 | * |
| 860 | 897 | * Types: |
| 861 | 898 | * |
| r5955 | r5956 | |
| 1193 | 1230 | * |
| 1194 | 1231 | * .------------. |
| 1195 | 1232 | * | | |
| 1196 | * | |
| 1233 | * INP0 -0------>| | | |
| 1197 | 1234 | * | | |
| 1198 | * IN | |
| 1235 | * MIN | |
| 1199 | 1236 | * | | |
| 1200 | * M | |
| 1237 | * MAX -2------>| | |
| 1201 | 1238 | * | | |
| 1202 | * MAX -3------>| | | |
| 1203 | * | | | |
| 1204 | * CLAMP -4------>| | | |
| 1205 | * | | | |
| 1206 | 1239 | * '------------' |
| 1207 | 1240 | * |
| 1208 | 1241 | * Declaration syntax |
| 1209 | 1242 | * |
| 1210 | 1243 | * DISCRETE_CLAMP(name of node, |
| 1211 | * enable, | |
| 1212 | 1244 | * input node, |
| 1213 | 1245 | * minimum node or static value, |
| 1214 | * maximum node or static value, | |
| 1215 | * clamp node or static value when disabled) | |
| 1246 | * maximum node or static value), | |
| 1216 | 1247 | * |
| 1217 | 1248 | * Example config line |
| 1218 | 1249 | * |
| 1219 | * DISCRETE_CLAMP(NODE_9,NODE_10, | |
| 1250 | * DISCRETE_CLAMP(NODE_9,NODE_10, | |
| 1220 | 1251 | * |
| 1221 | * Node10 when not zero will allow clamp to operate forcing the value | |
| 1222 | * on the node output, to be within the MIN/MAX boundard. When enable | |
| 1223 | * is set to zero the node will output the clamp value | |
| 1252 | * Force the value on the node output, to be within the MIN/MAX | |
| 1253 | * boundary. In this example the output is clamped to the range | |
| 1254 | * of 2.0 to 10.0 inclusive. | |
| 1224 | 1255 | * |
| 1256 | * EXAMPLES: Sprint 8 | |
| 1257 | * | |
| 1225 | 1258 | *********************************************************************** |
| 1226 | 1259 | * |
| 1227 | 1260 | * DISCRETE_DIVIDE - Node division function |
| r5955 | r5956 | |
| 2893 | 2926 | * options, - bit mapped options |
| 2894 | 2927 | * v_pos, - B+ voltage of 555 |
| 2895 | 2928 | * v_charge, - voltage (or node) to charge circuit (Defaults to v_pos) |
| 2896 | * v_out_high | |
| 2929 | * v_out_high | |
| 2897 | 2930 | * } |
| 2898 | 2931 | * |
| 2899 | 2932 | * The last 2 options of discrete_555_desc can use the following defaults: |
| r5955 | r5956 | |
| 2993 | 3026 | * DISC_555_TRIGGER_IS_VOLTAGE - Input is actual voltage. |
| 2994 | 3027 | * Voltage must drop below |
| 2995 | 3028 | * trigger to activate. |
| 3029 | * DISC_555_TRIGGER_IS_COUNT - 1 when trigger, allows passing of x_time. | |
| 3030 | * Mainly connected with other module using | |
| 3031 | * a xxx_COUNT_F_X type. | |
| 2996 | 3032 | * DISC_555_TRIGGER_DISCHARGES_CAP - some circuits connect an external |
| 2997 | 3033 | * device (transistor) to the cap to |
| 2998 | 3034 | * discharge it when the trigger is |
| r5955 | r5956 | |
| 3006 | 3042 | * Waveform Types: (ORed with trigger types) |
| 3007 | 3043 | * DISC_555_OUT_SQW - Output is Squarewave. 0 or v_out_high. (DEFAULT) |
| 3008 | 3044 | * DISC_555_OUT_CAP - Output is Timing Capacitor 'C' voltage. |
| 3045 | * DISC_555_OUT_ENERGY - see DISCRETE_555_MSTABLE. | |
| 3009 | 3046 | * |
| 3010 | * EXAMPLES: see Frogs | |
| 3047 | * EXAMPLES: see Frogs, Sprint 8 | |
| 3011 | 3048 | * |
| 3012 | 3049 | *********************************************************************** |
| 3013 | 3050 | * |
| r5955 | r5956 | |
| 3179 | 3216 | * vMod node or static value, |
| 3180 | 3217 | * R node or static value in ohms, |
| 3181 | 3218 | * C node or static value in Farads, |
| 3182 | * address of discrete_566_desc structure) | |
| 3219 | * v_pos static value | |
| 3220 | * v_neg static value | |
| 3221 | * v_charge node or static value | |
| 3222 | * options) | |
| 3183 | 3223 | * |
| 3184 | * discrete_566_desc = {options, v_pos, v_neg, v_charge} | |
| 3185 | * Note: v_charge can be static value, a node | |
| 3186 | * or use DEFAULT_566_CHARGE to connect to v_pos | |
| 3187 | * | |
| 3188 | 3224 | * Output Types: |
| 3189 | 3225 | * DISC_566_OUT_DC - Output is actual DC. (DEFAULT) |
| 3190 | 3226 | * DISC_566_OUT_AC - A cheat to make the waveform AC. |
| r5955 | r5956 | |
| 3193 | 3229 | * DISC_566_OUT_SQUARE - Pin 3 Square Wave Output (DEFAULT) |
| 3194 | 3230 | * DISC_566_OUT_TRIANGLE - Pin 4 Triangle Wave Output |
| 3195 | 3231 | * DISC_566_OUT_LOGIC - Internal Flip/Flop Output |
| 3232 | * DISC_566_COUNT_F - # of falling edges | |
| 3233 | * DISC_566_COUNT_R - # of rising edges | |
| 3234 | * DISC_566_COUNT_F_X - # of falling edges with x-time | |
| 3235 | * DISC_566_COUNT_R_X - # of rising edges with x-time | |
| 3196 | 3236 | * |
| 3197 | 3237 | * EXAMPLES: see Starship 1 |
| 3198 | 3238 | * |
| r5955 | r5956 | |
| 3407 | 3447 | #define DISCRETE_MAX_INPUTS 10 |
| 3408 | 3448 | #define DISCRETE_MAX_OUTPUTS 8 |
| 3409 | 3449 | #define DISCRETE_MAX_TASK_OUTPUTS 8 |
| 3450 | #define DISCRETE_MAX_TASK_GROUPS 8 | |
| 3410 | 3451 | |
| 3411 | 3452 | |
| 3412 | 3453 | /************************************* |
| r5955 | r5956 | |
| 3487 | 3528 | /* Mixer types */ |
| 3488 | 3529 | #define DISC_MIXER_IS_RESISTOR 0 |
| 3489 | 3530 | #define DISC_MIXER_IS_OP_AMP 1 |
| 3490 | #define DISC_MIXER_IS_OP_AMP_WITH_RI 2 / | |
| 3531 | #define DISC_MIXER_IS_OP_AMP_WITH_RI 2 /* Used only internally. Use DISC_MIXER_IS_OP_AMP */ | |
| 3491 | 3532 | |
| 3492 | 3533 | /* Triggered Op Amp Functions */ |
| 3493 | 3534 | enum |
| r5955 | r5956 | |
| 3505 | 3546 | |
| 3506 | 3547 | |
| 3507 | 3548 | /* Common Op Amp Flags and values */ |
| 3508 | #define DISC_OP_AMP_IS_NORTON 0x | |
| 3549 | #define DISC_OP_AMP_IS_NORTON 0x | |
| 3509 | 3550 | #define OP_AMP_NORTON_VBE 0.5 // This is the norton junction voltage. Used only internally. |
| 3510 | 3551 | #define OP_AMP_VP_RAIL_OFFSET 1.5 // This is how close an op-amp can get to the vP rail. Used only internally. |
| 3511 | 3552 | |
| r5955 | r5956 | |
| 3533 | 3574 | |
| 3534 | 3575 | |
| 3535 | 3576 | /* Op Amp Oscillator Flags */ |
| 3577 | #define DISC_OP_AMP_OSCILLATOR_TYPE_MASK (0xf0 | DISC_OP_AMP_IS_NORTON) // Used only internally. | |
| 3536 | 3578 | #define DISC_OP_AMP_OSCILLATOR_1 0x00 |
| 3537 | #define DISC_OP_AMP_OSCILLATOR_VCO_1 0x80 | |
| 3538 | #define DISC_OP_AMP_OSCILLATOR_VCO_2 0x90 | |
| 3539 | #define DISC_OP_AMP_OSCILLATOR_VCO_3 0xa0 | |
| 3540 | #define DISC_OP_AMP_OSCILLATOR_OUT_CAP 0x00 | |
| 3541 | #define DISC_OP_AMP_OSCILLATOR_OUT_SQW 0x02 | |
| 3579 | #define DISC_OP_AMP_OSCILLATOR_2 0x10 | |
| 3580 | #define DISC_OP_AMP_OSCILLATOR_VCO_1 0x20 | |
| 3581 | #define DISC_OP_AMP_OSCILLATOR_VCO_2 0x30 | |
| 3582 | #define DISC_OP_AMP_OSCILLATOR_VCO_3 0x40 | |
| 3542 | 3583 | |
| 3543 | #define DISC_OP_AMP_OSCILLATOR_TYPE_MASK (0xf0 | DISC_OP_AMP_IS_NORTON) // Used only internally. | |
| 3584 | #define DISC_OP_AMP_OSCILLATOR_OUT_MASK 0x07 | |
| 3585 | #define DISC_OP_AMP_OSCILLATOR_OUT_CAP 0x00 | |
| 3586 | #define DISC_OP_AMP_OSCILLATOR_OUT_SQW 0x01 | |
| 3587 | #define DISC_OP_AMP_OSCILLATOR_OUT_ENERGY 0x02 | |
| 3588 | #define DISC_OP_AMP_OSCILLATOR_OUT_LOGIC_X 0x03 | |
| 3589 | #define DISC_OP_AMP_OSCILLATOR_OUT_COUNT_F_X 0x04 | |
| 3590 | #define DISC_OP_AMP_OSCILLATOR_OUT_COUNT_R_X 0x05 | |
| 3544 | 3591 | |
| 3545 | 3592 | /* Schmitt Oscillator Options */ |
| 3546 | 3593 | #define DISC_SCHMITT_OSC_IN_IS_LOGIC 0x00 |
| r5955 | r5956 | |
| 3559 | 3606 | #define DISC_555_OUT_AC 0x10 |
| 3560 | 3607 | |
| 3561 | 3608 | #define DISC_555_TRIGGER_IS_LOGIC 0x00 |
| 3562 | #define DISC_555_TRIGGER_IS_VOLTAGE 0x40 | |
| 3609 | #define DISC_555_TRIGGER_IS_VOLTAGE 0x20 | |
| 3610 | #define DISC_555_TRIGGER_IS_COUNT 0x40 | |
| 3611 | #define DSD_555_TRIGGER_TYPE_MASK 0x60 | |
| 3563 | 3612 | #define DISC_555_TRIGGER_DISCHARGES_CAP 0x80 |
| 3564 | 3613 | |
| 3565 | 3614 | #define DISC_555_OUT_SQW 0x00 /* Squarewave */ |
| r5955 | r5956 | |
| 3585 | 3634 | #define DISC_566_OUT_SQUARE 0x00 /* Squarewave */ |
| 3586 | 3635 | #define DISC_566_OUT_TRIANGLE 0x10 /* Triangle waveform */ |
| 3587 | 3636 | #define DISC_566_OUT_LOGIC 0x20 /* 0/1 logic output */ |
| 3588 | ||
| 3589 | #define DISC_566_OUT_MASK 0x30 /* Bits that define output type. | |
| 3637 | #define DISC_566_OUT_COUNT_F 0x30 | |
| 3638 | #define DISC_566_OUT_COUNT_R 0x40 | |
| 3639 | #define DISC_566_OUT_COUNT_F_X 0x50 | |
| 3640 | #define DISC_566_OUT_COUNT_R_X 0x60 | |
| 3641 | #define DISC_566_OUT_MASK 0x70 /* Bits that define output type. | |
| 3590 | 3642 | * Used only internally in module. */ |
| 3591 | #define DEFAULT_566_CHARGE -1 | |
| 3592 | 3643 | |
| 3593 | 3644 | /* LS624 output flags */ |
| 3594 | 3645 | #define DISC_LS624_OUT_ENERGY 0x01 |
| r5955 | r5956 | |
| 3698 | 3749 | linked_list_entry *next; |
| 3699 | 3750 | }; |
| 3700 | 3751 | |
| 3701 | typedef struct _discrete_task_context discrete_task_context; | |
| 3702 | struct _discrete_task_context | |
| 3752 | typedef struct _discrete_task discrete_task; | |
| 3753 | struct _discrete_task | |
| 3703 | 3754 | { |
| 3704 | 3755 | const linked_list_entry *list; |
| 3705 | 3756 | |
| 3757 | int task_group; | |
| 3706 | 3758 | int numbuffered; |
| 3707 | 3759 | double *ptr[DISCRETE_MAX_TASK_OUTPUTS]; |
| 3708 | 3760 | double *node_buf[DISCRETE_MAX_TASK_OUTPUTS]; |
| 3709 | 3761 | node_description *nodes[DISCRETE_MAX_TASK_OUTPUTS]; |
| 3710 | double * | |
| 3762 | double * | |
| 3711 | 3763 | |
| 3764 | /* list of source nodes */ | |
| 3765 | linked_list_entry *source_list; /* discrete_source_node */ | |
| 3712 | 3766 | }; |
| 3713 | 3767 | |
| 3768 | typedef struct _discrete_source_node discrete_source_node; | |
| 3769 | struct _discrete_source_node | |
| 3770 | { | |
| 3771 | const discrete_task *task; | |
| 3772 | int output_node; | |
| 3773 | double buffer; | |
| 3774 | double *ptr; | |
| 3775 | }; | |
| 3776 | ||
| 3714 | 3777 | struct _discrete_info |
| 3715 | 3778 | { |
| 3716 | 3779 | const device_config *device; |
| r5955 | r5956 | |
| 3726 | 3789 | /* list of all nodes */ |
| 3727 | 3790 | linked_list_entry *node_list; /* node_description * */ |
| 3728 | 3791 | |
| 3729 | /* list of nodes which step */ | |
| 3730 | linked_list_entry *step_list; /* node_description * */ | |
| 3731 | ||
| 3732 | 3792 | /* list of discrete blocks after prescan (IMPORT, DELETE, REPLACE) */ |
| 3733 | 3793 | linked_list_entry *block_list; /* discrete_sound_block * */ |
| 3734 | 3794 | |
| r5955 | r5956 | |
| 3787 | 3847 | typedef struct _discrete_op_amp_osc_info discrete_op_amp_osc_info; |
| 3788 | 3848 | struct _discrete_op_amp_osc_info |
| 3789 | 3849 | { |
| 3790 | | |
| 3850 | UINT32 type; | |
| 3791 | 3851 | double r1; |
| 3792 | 3852 | double r2; |
| 3793 | 3853 | double r3; |
| r5955 | r5956 | |
| 3843 | 3903 | typedef struct _discrete_integrate_info discrete_integrate_info; |
| 3844 | 3904 | struct _discrete_integrate_info |
| 3845 | 3905 | { |
| 3846 | | |
| 3906 | UINT32 type; | |
| 3847 | 3907 | double r1; // r1a + r1b |
| 3848 | 3908 | double r2; // r2a + r2b |
| 3849 | 3909 | double r3; // r3a + r3b |
| r5955 | r5956 | |
| 3876 | 3936 | typedef struct _discrete_op_amp_info discrete_op_amp_info; |
| 3877 | 3937 | struct _discrete_op_amp_info |
| 3878 | 3938 | { |
| 3879 | | |
| 3939 | UINT32 type; | |
| 3880 | 3940 | double r1; |
| 3881 | 3941 | double r2; |
| 3882 | 3942 | double r3; |
| r5955 | r5956 | |
| 3890 | 3950 | typedef struct _discrete_op_amp_1sht_info discrete_op_amp_1sht_info; |
| 3891 | 3951 | struct _discrete_op_amp_1sht_info |
| 3892 | 3952 | { |
| 3893 | | |
| 3953 | UINT32 type; | |
| 3894 | 3954 | double r1; |
| 3895 | 3955 | double r2; |
| 3896 | 3956 | double r3; |
| r5955 | r5956 | |
| 3987 | 4047 | }; |
| 3988 | 4048 | |
| 3989 | 4049 | |
| 3990 | typedef struct _discrete_566_desc discrete_566_desc; | |
| 3991 | struct _discrete_566_desc | |
| 3992 | { | |
| 3993 | int options; // bit mapped options | |
| 3994 | double v_pos; // B+ voltage of 566 | |
| 3995 | double v_neg; // B- voltage of 566 | |
| 3996 | double v_charge; | |
| 3997 | }; | |
| 3998 | ||
| 3999 | ||
| 4000 | 4050 | typedef struct _discrete_adsr discrete_adsr; |
| 4001 | 4051 | struct _discrete_adsr |
| 4002 | 4052 | { |
| r5955 | r5956 | |
| 4318 | 4368 | #define DISCRETE_ADDER2(NODE,ENAB,INP0,INP1) { NODE, DST_ADDER , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_ADDER2" }, |
| 4319 | 4369 | #define DISCRETE_ADDER3(NODE,ENAB,INP0,INP1,INP2) { NODE, DST_ADDER , 4, { ENAB,INP0,INP1,INP2 }, { ENAB,INP0,INP1,INP2 }, NULL, "DISCRETE_ADDER3" }, |
| 4320 | 4370 | #define DISCRETE_ADDER4(NODE,ENAB,INP0,INP1,INP2,INP3) { NODE, DST_ADDER , 5, { ENAB,INP0,INP1,INP2,INP3 }, { ENAB,INP0,INP1,INP2,INP3 }, NULL, "DISCRETE_ADDER4" }, |
| 4321 | #define DISCRETE_CLAMP(NODE, | |
| 4371 | #define DISCRETE_CLAMP(NODE, | |
| 4322 | 4372 | #define DISCRETE_DIVIDE(NODE,ENAB,INP0,INP1) { NODE, DST_DIVIDE , 3, { ENAB,INP0,INP1 }, { ENAB,INP0,INP1 }, NULL, "DISCRETE_DIVIDE" }, |
| 4323 | 4373 | #define DISCRETE_GAIN(NODE,INP0,GAIN) { NODE, DST_GAIN , 3, { INP0,NODE_NC,NODE_NC }, { INP0,GAIN,0 }, NULL, "DISCRETE_GAIN" }, |
| 4324 | 4374 | #define DISCRETE_INVERT(NODE,INP0) { NODE, DST_GAIN , 3, { INP0,NODE_NC,NODE_NC }, { INP0,-1,0 }, NULL, "DISCRETE_INVERT" }, |
| r5955 | r5956 | |
| 4350 | 4400 | #define DISCRETE_MULTIPLEX8(NODE,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7) { NODE, DST_MULTIPLEX, 9, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, NULL, "DISCRETE_MULTIPLEX8" }, |
| 4351 | 4401 | #define DISCRETE_MULTIPLY(NODE,INP0,INP1) { NODE, DST_GAIN , 3, { INP0,INP1,NODE_NC }, { INP0,INP1,0 }, NULL, "DISCRETE_MULTIPLY" }, |
| 4352 | 4402 | #define DISCRETE_MULTADD(NODE,INP0,INP1,INP2) { NODE, DST_GAIN , 3, { INP0,INP1,INP2 }, { INP0,INP1,INP2 }, NULL, "DISCRETE_MULTADD" }, |
| 4353 | #define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { | |
| 4403 | #define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { 0 | |
| 4354 | 4404 | #define DISCRETE_ONESHOTR(NODE,RESET,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { RESET,TRIG,AMPL,WIDTH,NODE_NC }, { RESET,TRIG,AMPL,WIDTH,TYPE }, NULL, "One Shot Resetable" }, |
| 4355 | 4405 | #define DISCRETE_ONOFF(NODE,ENAB,INP0) { NODE, DST_GAIN , 3, { ENAB,INP0,NODE_NC }, { 0,1,0 }, NULL, "DISCRETE_ONOFF" }, |
| 4356 | 4406 | #define DISCRETE_RAMP(NODE,ENAB,RAMP,GRAD,START,END,CLAMP) { NODE, DST_RAMP , 6, { ENAB,RAMP,GRAD,START,END,CLAMP }, { ENAB,RAMP,GRAD,START,END,CLAMP }, NULL, "DISCRETE_RAMP" }, |
| r5955 | r5956 | |
| 4422 | 4472 | #define DISCRETE_555_CC(NODE,RESET,VIN,R,C,RBIAS,RGND,RDIS,OPTIONS) { NODE, DSD_555_CC , 7, { RESET,VIN,R,C,RBIAS,RGND,RDIS }, { RESET,VIN,R,C,RBIAS,RGND,RDIS }, OPTIONS, "DISCRETE_555_CC" }, |
| 4423 | 4473 | #define DISCRETE_555_VCO1(NODE,RESET,VIN,OPTIONS) { NODE, DSD_555_VCO1 , 3, { RESET,VIN,NODE_NC }, { RESET,VIN,-1 }, OPTIONS, "DISCRETE_555_VCO1" }, |
| 4424 | 4474 | #define DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS) { NODE, DSD_555_VCO1 , 3, { RESET,VIN,CTRLV }, { RESET,VIN,CTRLV }, OPTIONS, "DISCRETE_555_VCO1_CV" }, |
| 4425 | #define DISCRETE_566(NODE,VMOD,R,C,OPTIONS) | |
| 4475 | #define DISCRETE_566(NODE,VMOD,R,C,VPOS,VNEG,VCHARGE,OPTIONS) | |
| 4426 | 4476 | #define DISCRETE_74LS624(NODE,VMOD,VRNG,C,OUTTYPE) { NODE, DSD_LS624 , 4, { VMOD,NODE_NC,NODE_NC,NODE_NC }, { VMOD,VRNG,C,OUTTYPE }, NULL, "DISCRETE_74LS624" }, |
| 4427 | 4477 | |
| 4428 | 4478 | /* NOP */ |
| r5955 | r5956 | |
| 4444 | 4494 | |
| 4445 | 4495 | /* parallel tasks */ |
| 4446 | 4496 | |
| 4447 | #define DISCRETE_TASK_START() | |
| 4497 | #define DISCRETE_TASK_START(TASK_GROUP) | |
| 4448 | 4498 | #define DISCRETE_TASK_END() { NODE_SPECIAL, DSO_TASK_END , 1, { 0 }, { 0 }, NULL, "DISCRETE_TASK_END" }, |
| 4449 | 4499 | //#define DISCRETE_TASK_SYNC() { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" }, |
| 4450 | 4500 |
| r5955 | r5956 | |
|---|---|---|
| 58 | 58 | int output_is_ac; |
| 59 | 59 | double ac_shift; /* DC shift needed to make waveform ac */ |
| 60 | 60 | int flip_flop; /* 555 flip/flop output state */ |
| 61 | int has_rc_nodes; | |
| 62 | double exp_charge; | |
| 61 | 63 | double cap_voltage; /* voltage on cap */ |
| 62 | 64 | double threshold; |
| 63 | 65 | double trigger; |
| r5955 | r5956 | |
| 109 | 111 | unsigned int state[2]; /* keeps track of excess flip_flop changes during the current step */ |
| 110 | 112 | int flip_flop; /* 566 flip/flop output state */ |
| 111 | 113 | double cap_voltage; /* voltage on cap */ |
| 112 | double v_charge; /* static charge value */ | |
| 113 | double *v_charge_node; /* point to charge node */ | |
| 114 | 114 | double v_sqr_low; /* voltage for a squarewave at low */ |
| 115 | 115 | double v_sqr_high; /* voltage for a squarewave at high */ |
| 116 | 116 | double threshold_low; /* falling threshold */ |
| 117 | 117 | double threshold_high; /* rising threshold */ |
| 118 | 118 | double triangle_ac_offset; /* used to shift a triangle to AC */ |
| 119 | double v_osc_stable; | |
| 120 | double v_osc_stop; | |
| 119 | 121 | }; |
| 120 | 122 | |
| 121 | 123 | struct dsd_ls624_context |
| r5955 | r5956 | |
| 125 | 127 | int out_type; |
| 126 | 128 | double k1; /* precalculated cap part of formula */ |
| 127 | 129 | double k2; /* precalculated ring part of formula */ |
| 130 | double dt_vmod_at_0; | |
| 128 | 131 | }; |
| 129 | 132 | |
| 130 | 133 | |
| r5955 | r5956 | |
| 456 | 459 | #define DSD_555_MSTBL__R DISCRETE_INPUT(2) |
| 457 | 460 | #define DSD_555_MSTBL__C DISCRETE_INPUT(3) |
| 458 | 461 | |
| 462 | /* bit mask of the above RC inputs */ | |
| 463 | #define DSD_555_MSTBL_RC_MASK 0x0c | |
| 464 | ||
| 459 | 465 | static DISCRETE_STEP(dsd_555_mstbl) |
| 460 | 466 | { |
| 461 | 467 | const discrete_555_desc *info = (const discrete_555_desc *)node->custom; |
| r5955 | r5956 | |
| 463 | 469 | |
| 464 | 470 | double v_cap; /* Current voltage on capacitor, before dt */ |
| 465 | 471 | double v_cap_next = 0; /* Voltage on capacitor, after dt */ |
| 472 | double x_time = 0; /* time since change happened */ | |
| 473 | double dt, exponent; | |
| 474 | int trigger = 0; | |
| 475 | int trigger_type; | |
| 476 | int update_exponent = 0; | |
| 466 | 477 | |
| 467 | 478 | if(DSD_555_MSTBL__RESET) |
| 468 | 479 | { |
| r5955 | r5956 | |
| 470 | 481 | node->output[0] = 0; |
| 471 | 482 | context->flip_flop = 0; |
| 472 | 483 | context->cap_voltage = 0; |
| 484 | return; | |
| 473 | 485 | } |
| 474 | else | |
| 486 | ||
| 487 | trigger_type = info->options; | |
| 488 | dt = node->info->sample_time; | |
| 489 | ||
| 490 | switch (trigger_type & DSD_555_TRIGGER_TYPE_MASK) | |
| 475 | 491 | { |
| 476 | int trigger; | |
| 492 | case DISC_555_TRIGGER_IS_LOGIC: | |
| 493 | trigger = (int)!DSD_555_MSTBL__TRIGGER; | |
| 494 | break; | |
| 495 | case DISC_555_TRIGGER_IS_VOLTAGE: | |
| 496 | trigger = (int)(DSD_555_MSTBL__TRIGGER < context->trigger); | |
| 497 | break; | |
| 498 | case DISC_555_TRIGGER_IS_COUNT: | |
| 499 | trigger = (int)DSD_555_MSTBL__TRIGGER; | |
| 500 | if (trigger && !context->flip_flop) | |
| 501 | { | |
| 502 | x_time = DSD_555_MSTBL__TRIGGER - trigger; | |
| 503 | if (x_time != 0) | |
| 504 | { | |
| 505 | /* adjust sample to after trigger */ | |
| 506 | x_time = (1.0 - x_time); | |
| 507 | update_exponent = 1; | |
| 508 | dt = x_time * node->info->sample_time; | |
| 509 | } | |
| 510 | } | |
| 511 | break; | |
| 512 | } | |
| 477 | 513 | |
| 478 | if (context->trig_is_logic) | |
| 479 | trigger = !DSD_555_MSTBL__TRIGGER; | |
| 480 | else | |
| 481 | trigger = DSD_555_MSTBL__TRIGGER < context->trigger; | |
| 514 | if ((trigger_type & DISC_555_TRIGGER_DISCHARGES_CAP) && trigger) | |
| 515 | context->cap_voltage = 0; | |
| 482 | 516 | |
| 483 | if (context->trig_discharges_cap && trigger) | |
| 484 | context->cap_voltage = 0; | |
| 517 | /* Wait for trigger */ | |
| 518 | if (!context->flip_flop && trigger) | |
| 519 | context->flip_flop = 1; | |
| 485 | 520 | |
| 486 | if (!context->flip_flop) | |
| 521 | if (context->flip_flop) | |
| 522 | { | |
| 523 | v_cap = context->cap_voltage; | |
| 524 | ||
| 525 | /* Sometimes a switching network is used to setup the capacitance. | |
| 526 | * These may select 'no' capacitor, causing oscillation to stop. | |
| 527 | */ | |
| 528 | if (DSD_555_MSTBL__C == 0) | |
| 487 | 529 | { |
| 488 | /* Wait for trigger */ | |
| 489 | if (trigger) | |
| 490 | context->flip_flop = 1; | |
| 530 | context->flip_flop = 0; | |
| 531 | /* The voltage goes high because the cap circuit is open. */ | |
| 532 | v_cap_next = info->v_pos; | |
| 533 | v_cap = info->v_pos; | |
| 534 | context->cap_voltage = 0; | |
| 491 | 535 | } |
| 492 | 536 | else |
| 493 | 537 | { |
| 494 | v_cap = context->cap_voltage; | |
| 538 | /* Charging */ | |
| 539 | update_exponent |= context->has_rc_nodes; | |
| 540 | if (update_exponent) | |
| 541 | exponent = RC_CHARGE_EXP_DT(DSD_555_MSTBL__R * DSD_555_MSTBL__C, dt); | |
| 542 | else | |
| 543 | exponent = context->exp_charge; | |
| 544 | v_cap_next = v_cap + ((info->v_pos - v_cap) * exponent); | |
| 495 | 545 | |
| 496 | /* Sometimes a switching network is used to setup the capacitance. | |
| 497 | * These may select 'no' capacitor, causing oscillation to stop. | |
| 498 | */ | |
| 499 | if (DSD_555_MSTBL__C == 0) | |
| 546 | /* Has it charged past upper limit? */ | |
| 547 | /* If trigger is still enabled, then we keep charging, | |
| 548 | * regardless of threshold. */ | |
| 549 | if ((v_cap_next >= context->threshold) && !trigger) | |
| 500 | 550 | { |
| 551 | dt = DSD_555_MSTBL__R * DSD_555_MSTBL__C * log(1.0 / (1.0 - ((v_cap_next - context->threshold) / (context->v_charge - v_cap)))); | |
| 552 | x_time = dt / node->info->sample_time; | |
| 553 | v_cap_next = 0; | |
| 554 | v_cap = context->threshold; | |
| 501 | 555 | context->flip_flop = 0; |
| 502 | /* The voltage goes high because the cap circuit is open. */ | |
| 503 | v_cap_next = info->v_pos; | |
| 504 | v_cap = info->v_pos; | |
| 505 | context->cap_voltage = 0; | |
| 506 | 556 | } |
| 507 | else | |
| 508 | { | |
| 509 | /* Charging */ | |
| 510 | v_cap_next = v_cap + ((info->v_pos - v_cap) * RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C)); | |
| 557 | } | |
| 511 | 558 | |
| 512 | /* Has it charged past upper limit? */ | |
| 513 | /* If trigger is still enabled, then we keep charging, | |
| 514 | * regardless of threshold. */ | |
| 515 | if ((v_cap_next >= context->threshold) && !trigger) | |
| 516 | { | |
| 517 | v_cap_next = 0; | |
| 518 | v_cap = context->threshold; | |
| 519 | context->flip_flop = 0; | |
| 520 | } | |
| 521 | } | |
| 559 | context->cap_voltage = v_cap_next; | |
| 560 | } | |
| 522 | 561 | |
| 523 | context->cap_voltage = v_cap_next; | |
| 524 | ||
| 525 | switch (info->options & DISC_555_OUT_MASK) | |
| 526 | { | |
| 527 | case DISC_555_OUT_SQW: | |
| 528 | node->output[0] = context->flip_flop * context->v_out_high; | |
| 529 | /* Fake it to AC if needed */ | |
| 530 | if (context->output_is_ac) | |
| 531 | node->output[0] -= context->v_out_high / 2.0; | |
| 532 | break; | |
| 533 | case DISC_555_OUT_CAP: | |
| 534 | node->output[0] = v_cap_next; | |
| 535 | /* Fake it to AC if needed */ | |
| 536 | if (context->output_is_ac) | |
| 537 | node->output[0] -= context->threshold * 3.0 /4.0; | |
| 538 | break; | |
| 539 | } | |
| 540 | } | |
| 562 | switch (info->options & DISC_555_OUT_MASK) | |
| 563 | { | |
| 564 | case DISC_555_OUT_SQW: | |
| 565 | node->output[0] = context->flip_flop * context->v_out_high; | |
| 566 | /* Fake it to AC if needed */ | |
| 567 | if (context->output_is_ac) | |
| 568 | node->output[0] -= context->v_out_high / 2.0; | |
| 569 | break; | |
| 570 | case DISC_555_OUT_CAP: | |
| 571 | node->output[0] = v_cap_next; | |
| 572 | /* Fake it to AC if needed */ | |
| 573 | if (context->output_is_ac) | |
| 574 | node->output[0] -= context->threshold * 3.0 /4.0; | |
| 575 | break; | |
| 576 | case DISC_555_OUT_ENERGY: | |
| 577 | if (x_time == 0) x_time = 1.0; | |
| 578 | node->output[0] = context->v_out_high * (context->flip_flop ? x_time : (1.0 - x_time)); | |
| 579 | if (context->output_is_ac) | |
| 580 | node->output[0] -= context->v_out_high / 2.0; | |
| 581 | break; | |
| 541 | 582 | } |
| 542 | 583 | } |
| 543 | 584 | |
| r5955 | r5956 | |
| 571 | 612 | context->flip_flop = 0; |
| 572 | 613 | context->cap_voltage = 0; |
| 573 | 614 | |
| 615 | /* optimization if none of the values are nodes */ | |
| 616 | context->has_rc_nodes = 0; | |
| 617 | if (node->input_is_node & DSD_555_MSTBL_RC_MASK) | |
| 618 | context->has_rc_nodes = 1; | |
| 619 | else | |
| 620 | context->exp_charge = RC_CHARGE_EXP(DSD_555_MSTBL__R * DSD_555_MSTBL__C); | |
| 621 | ||
| 574 | 622 | node->output[0] = 0; |
| 575 | 623 | } |
| 576 | 624 | |
| r5955 | r5956 | |
| 1373 | 1421 | context->ac_shift = context->output_is_ac ? -context->v_out_high / 2.0 : 0; |
| 1374 | 1422 | } |
| 1375 | 1423 | |
| 1424 | ||
| 1376 | 1425 | /************************************************************************ |
| 1377 | 1426 | * |
| 1378 | 1427 | * DSD_566 - Usage of node_description values |
| 1379 | 1428 | * |
| 1380 | * input[0] - Modulation Voltage | |
| 1381 | * input[1] - R value | |
| 1382 | * input[2] - C value | |
| 1429 | * Mar 2004, D Renaud. updated Sept 2009 | |
| 1383 | 1430 | * |
| 1384 | * also passed discrete_566_desc structure | |
| 1431 | * The data sheets for this are no where near correct. | |
| 1432 | * This simulation is based on the internal schematic and testing of | |
| 1433 | * a real Signetics IC. | |
| 1385 | 1434 | * |
| 1386 | * Mar 2004, D Renaud. | |
| 1435 | * The 566 is a constant current based VCO. If you change R, that affects | |
| 1436 | * the charge/discharge rate. A constant current source will charge the | |
| 1437 | * cap linearly. Of course due to the transistors there will be some | |
| 1438 | * non-linear areas at the ends of the Vmod range. As the Vmod voltage | |
| 1439 | * drops from Vcharge, the frequency generated increases. | |
| 1440 | * | |
| 1441 | * The Triangle (pin 4) output is just a buffered version of the cap | |
| 1442 | * charge. It is about 1.35 higher then the cap voltage. | |
| 1443 | * The Square (pin 3) output starts low as the cap voltages rises. | |
| 1444 | * Once a threshold is reached, the cap starts to discharge, and the | |
| 1445 | * Square output goes high. The Square high output is about 1V less then | |
| 1446 | * B+. Unloaded it is .75V less. With a 4.7k pull-down resistor, it | |
| 1447 | * is 1.06V less. So I will simulate at 1V less. The Square low voltage | |
| 1448 | * is non-linear so I will use a table. The cap toggle thresholds vary | |
| 1449 | * depending on B+, so they will be simulated with a table. | |
| 1450 | * | |
| 1451 | * The data sheets show Vmod should be no less then 3/4*B+. In reality | |
| 1452 | * you can go to close to 1/2*B+ before you loose linearity. Below 1/2, | |
| 1453 | * oscillation stops. When Vmod is 0V to 0.1V less then B+, it also | |
| 1454 | * looses linearity, and stops oscillating when >= B+. This is because | |
| 1455 | * there is no voltage difference to create a current source. | |
| 1456 | * | |
| 1457 | * The current source is dependant on the voltage difference between B+ | |
| 1458 | * and Vmod. Due to transistor action, it is not 100%, but this formula | |
| 1459 | * gives a good approximation: | |
| 1460 | * I = ((B+ - Vmod - 0.1) * 0.95) / R | |
| 1461 | * You can test the current VS modulation function by using 10k for R | |
| 1462 | * and replace C with a 10k resistor. Then you can monitor the voltage | |
| 1463 | * on pin 7 to work out the current. I=V/R. It will start to oscillate | |
| 1464 | * when in the cap threshold range. | |
| 1465 | * | |
| 1466 | * When Vmod drops below the stable range, the current source no longer | |
| 1467 | * functions properly. Technically this is out of the range specified | |
| 1468 | * for the IC. Of course old games used this range anyways, so we need | |
| 1469 | * to know how the real IC behaves. When Vmod drops below the stable range, | |
| 1470 | * the charge current is stops dropping instead of increasing, while the | |
| 1471 | * discharge current still functions. This means the frequency generated | |
| 1472 | * starts to drop as the voltage lowers, instead of the normal increase | |
| 1473 | * in frequency. | |
| 1474 | * | |
| 1387 | 1475 | ************************************************************************/ |
| 1388 | #define DSD_566__VMOD DISCRETE_INPUT(0) | |
| 1389 | #define DSD_566__R DISCRETE_INPUT(1) | |
| 1390 | #define DSD_566__C DISCRETE_INPUT(2) | |
| 1476 | #define DSD_566__VMOD DISCRETE_INPUT(0) | |
| 1477 | #define DSD_566__R DISCRETE_INPUT(1) | |
| 1478 | #define DSD_566__C DISCRETE_INPUT(2) | |
| 1479 | #define DSD_566__VPOS DISCRETE_INPUT(3) | |
| 1480 | #define DSD_566__VNEG DISCRETE_INPUT(4) | |
| 1481 | #define DSD_566__VCHARGE DISCRETE_INPUT(5) | |
| 1482 | #define DSD_566__OPTIONS DISCRETE_INPUT(6) | |
| 1391 | 1483 | |
| 1484 | ||
| 1485 | static const struct | |
| 1486 | { | |
| 1487 | double c_high[6]; | |
| 1488 | double c_low[6]; | |
| 1489 | double sqr_low[6]; | |
| 1490 | double osc_stable[6]; | |
| 1491 | double osc_stop[6]; | |
| 1492 | } ne566 = | |
| 1493 | { | |
| 1494 | /* 10 10.5 11 11.5 12 13 14 15 B+ */ | |
| 1495 | {3.364, /*3.784,*/ 4.259, /*4.552,*/ 4.888, 5.384, 5.896, 6.416}, /* c_high */ | |
| 1496 | {1.940, /*2.100,*/ 2.276, /*2.404,*/ 2.580, 2.880, 3.180, 3.488}, /* c_low */ | |
| 1497 | {4.352, /*4.144,*/ 4.080, /*4.260,*/ 4.500, 4.960, 5.456, 5.940}, /* sqr_low */ | |
| 1498 | {4.885, /*5.316,*/ 5.772, /*6.075,*/ 6.335, 6.912, 7.492, 7.945}, /* osc_stable */ | |
| 1499 | {4.495, /*4.895,*/ 5.343, /*5.703,*/ 5.997, 6.507, 7.016, 7.518} /* osc_stop */ | |
| 1500 | }; | |
| 1501 | ||
| 1392 | 1502 | static DISCRETE_STEP(dsd_566) |
| 1393 | 1503 | { |
| 1394 | const discrete_566_desc *info = (const discrete_566_desc *)node->custom; | |
| 1395 | 1504 | struct dsd_566_context *context = (struct dsd_566_context *)node->context; |
| 1396 | 1505 | |
| 1397 | double i; /* Charging current created by vIn */ | |
| 1398 | double dt; /* change in time */ | |
| 1399 | double v_cap; /* Current voltage on capacitor, before dt */ | |
| 1400 | double v_cap_next = 0; /* Voltage on capacitor, after dt */ | |
| 1401 | double v_charge; | |
| 1506 | double i = 0; /* Charging current created by vIn */ | |
| 1507 | double i_rise; /* non-linear rise charge current */ | |
| 1508 | double dt; /* change in time */ | |
| 1509 | double x_time = 0; | |
| 1510 | double v_cap; /* Current voltage on capacitor, before dt */ | |
| 1511 | double v_cap_next = 0; /* Voltage on capacitor, after dt */ | |
| 1512 | int count_f = 0, count_r = 0; | |
| 1513 | int options = (int)DSD_566__OPTIONS; | |
| 1402 | 1514 | |
| 1403 | 1515 | dt = node->info->sample_time; /* Change in time */ |
| 1404 | 1516 | v_cap = context->cap_voltage; /* Set to voltage before change */ |
| 1405 | 1517 | |
| 1406 | /* get the v_charge and update each step if it is a node */ | |
| 1407 | if (context->v_charge_node != NULL) | |
| 1518 | ||
| 1519 | /* Calculate charging current if it is in range */ | |
| 1520 | if (DSD_566__VMOD > context->v_osc_stop) | |
| 1408 | 1521 | { |
| 1409 | v_charge = *context->v_charge_node; | |
| 1410 | v_charge -= info->v_neg; | |
| 1522 | double v_charge = DSD_566__VCHARGE - DSD_566__VMOD - 0.1; | |
| 1523 | if (v_charge > 0) | |
| 1524 | { | |
| 1525 | i = (v_charge * .95) / DSD_566__R; | |
| 1526 | if (DSD_566__VMOD < context->v_osc_stable) | |
| 1527 | { | |
| 1528 | /* no where near correct calculation of non linear range */ | |
| 1529 | i_rise = ((DSD_566__VCHARGE - context->v_osc_stable - 0.1) * .95) / DSD_566__R; | |
| 1530 | i_rise *= 1.0 - (context->v_osc_stable - DSD_566__VMOD) / (context->v_osc_stable - context->v_osc_stop); | |
| 1531 | } | |
| 1532 | else | |
| 1533 | i_rise = i; | |
| 1534 | } | |
| 1535 | else | |
| 1536 | return; | |
| 1411 | 1537 | } |
| 1412 | else | |
| 1413 | v_charge = context->v_charge; | |
| 1538 | else return; | |
| 1414 | 1539 | |
| 1415 | /* Calculate charging current */ | |
| 1416 | i = (v_charge - DSD_566__VMOD) / DSD_566__R; | |
| 1417 | ||
| 1418 | /* Keep looping until all toggling in time sample is used up. */ | |
| 1540 | /* Keep looping until all toggling in this time sample is used up. */ | |
| 1419 | 1541 | do |
| 1420 | 1542 | { |
| 1421 | 1543 | if (context->flip_flop) |
| r5955 | r5956 | |
| 1434 | 1556 | } |
| 1435 | 1557 | v_cap = context->threshold_low; |
| 1436 | 1558 | context->flip_flop = 0; |
| 1437 | /* | |
| 1438 | * If the sampling rate is too low and the desired frequency is too high | |
| 1439 | * then we will start getting too many outputs that can't catch up. We will | |
| 1440 | * limit this to 3. The output is already incorrect because of the low sampling, | |
| 1441 | * but at least this way it can recover. | |
| 1442 | */ | |
| 1443 | context->state[0] = (context->state[0] + 1) & 0x03; | |
| 1559 | count_f++; | |
| 1560 | x_time = dt; | |
| 1444 | 1561 | } |
| 1445 | 1562 | } |
| 1446 | 1563 | else |
| 1447 | 1564 | { |
| 1448 | 1565 | /* Charging */ |
| 1449 | 1566 | /* iC=C*dv/dt works out to dv=iC*dt/C */ |
| 1450 | v_cap_next = v_cap + (i * dt / DSD_566__C); | |
| 1567 | v_cap_next = v_cap + (i_rise * dt / DSD_566__C); | |
| 1451 | 1568 | dt = 0; |
| 1452 | 1569 | /* Yes, if the cap voltage has reached the max voltage it can, |
| 1453 | 1570 | * and the 566 threshold has not been reached, then oscillation stops. |
| r5955 | r5956 | |
| 1466 | 1583 | } |
| 1467 | 1584 | v_cap = context->threshold_high; |
| 1468 | 1585 | context->flip_flop = 1; |
| 1469 | context->state[1] = (context->state[1] + 1) & 0x03; | |
| 1586 | count_r++; | |
| 1587 | x_time = dt; | |
| 1470 | 1588 | } |
| 1471 | 1589 | } |
| 1472 | 1590 | } while(dt); |
| 1473 | 1591 | |
| 1474 | 1592 | context->cap_voltage = v_cap_next; |
| 1475 | 1593 | |
| 1476 | switch ( | |
| 1594 | switch ( | |
| 1477 | 1595 | { |
| 1478 | 1596 | case DISC_566_OUT_SQUARE: |
| 1479 | 1597 | case DISC_566_OUT_LOGIC: |
| 1480 | /* use up any output states */ | |
| 1481 | if (node->output[0] && context->state[0]) | |
| 1482 | { | |
| 1483 | node->output[0] = 0; | |
| 1484 | context->state[0]--; | |
| 1485 | } | |
| 1486 | else if (!node->output[0] && context->state[1]) | |
| 1487 | { | |
| 1488 | node->output[0] = 1; | |
| 1489 | context->state[1]--; | |
| 1490 | } | |
| 1491 | else | |
| 1492 | { | |
| 1493 | 1598 | node->output[0] = context->flip_flop; |
| 1494 | } | |
| 1495 | if ((info->options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC) | |
| 1599 | if ((options & DISC_566_OUT_MASK) != DISC_566_OUT_LOGIC) | |
| 1496 | 1600 | node->output[0] = context->flip_flop ? context->v_sqr_high : context->v_sqr_low; |
| 1497 | 1601 | break; |
| 1498 | 1602 | case DISC_566_OUT_TRIANGLE: |
| 1499 | 1603 | /* we can ignore any unused states when |
| 1500 | 1604 | * outputting the cap voltage */ |
| 1501 | node->output[0] = v_cap_next; | |
| 1502 | if (info->options & DISC_566_OUT_AC) | |
| 1605 | node->output[0] = v_cap_next + 1.35; | |
| 1606 | if (options & DISC_566_OUT_AC) | |
| 1503 | 1607 | node->output[0] -= context->triangle_ac_offset; |
| 1504 | 1608 | break; |
| 1609 | case DISC_566_OUT_COUNT_F_X: | |
| 1610 | node->output[0] = count_f ? count_f + x_time : count_f; | |
| 1611 | break; | |
| 1612 | case DISC_566_OUT_COUNT_R_X: | |
| 1613 | node->output[0] = count_r ? count_r + x_time : count_r; | |
| 1614 | break; | |
| 1615 | case DISC_566_OUT_COUNT_F: | |
| 1616 | node->output[0] = count_f; | |
| 1617 | break; | |
| 1618 | case DISC_566_OUT_COUNT_R: | |
| 1619 | node->output[0] = count_r; | |
| 1620 | break; | |
| 1505 | 1621 | } |
| 1506 | 1622 | } |
| 1507 | 1623 | |
| 1508 | 1624 | static DISCRETE_RESET(dsd_566) |
| 1509 | 1625 | { |
| 1510 | const discrete_566_desc *info = (const discrete_566_desc *)node->custom; | |
| 1511 | 1626 | struct dsd_566_context *context = (struct dsd_566_context *)node->context; |
| 1512 | node_description *v_charge_node; | |
| 1513 | 1627 | |
| 1514 | double v_diff, temp; | |
| 1628 | double temp; | |
| 1629 | int v_int; | |
| 1630 | double v_float; | |
| 1515 | 1631 | |
| 1516 | if (info->v_neg >= info->v_pos) | |
| 1517 | { | |
| 1518 | fatalerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node)); | |
| 1519 | } | |
| 1632 | if (DSD_566__VNEG >= DSD_566__VPOS) | |
| 1633 | fatalerror("[v_neg >= v_pos] in NODE_%d!\n", NODE_BLOCKINDEX(node)); | |
| 1520 | 1634 | |
| 1521 | /* setup v_charge or node */ | |
| 1522 | v_charge_node = discrete_find_node(node->info, info->v_charge); | |
| 1523 | if (v_charge_node) | |
| 1524 | context->v_charge_node = &(v_charge_node->output[NODE_CHILD_NODE_NUM(info->v_charge)]); | |
| 1525 | else | |
| 1526 | { | |
| 1527 | context->v_charge = (info->v_charge == DEFAULT_566_CHARGE) ? info->v_pos : info->v_charge; | |
| 1528 | context->v_charge -= info->v_neg; | |
| 1529 | context->v_charge_node = NULL; | |
| 1530 | } | |
| 1635 | v_float = DSD_566__VPOS - DSD_566__VNEG; | |
| 1636 | v_int = (int)v_float; | |
| 1637 | if ( v_float < 10 || v_float > 15 ) | |
| 1638 | fatalerror("v_neg and/or v_pos out of range in NODE_%d\n", NODE_BLOCKINDEX(node)); | |
| 1639 | if ( v_float != v_int ) | |
| 1640 | /* fatal for now. */ | |
| 1641 | fatalerror("Power should be integer in NODE_%d\n", NODE_BLOCKINDEX(node)); | |
| 1531 | 1642 | |
| 1532 | v_diff = info->v_pos - info->v_neg; | |
| 1533 | 1643 | context->flip_flop = 0; |
| 1534 | 1644 | context->cap_voltage = 0; |
| 1535 | context->state[0] = 0; | |
| 1536 | context->state[1] = 0; | |
| 1537 | 1645 | |
| 1538 | /* The data sheets are useless for this IC. I will have to get my hands on a chip | |
| 1539 | * to make real measurements. For now this should work fine for 12V. */ | |
| 1540 | context->threshold_high = v_diff / 2 + info->v_neg; | |
| 1541 | context->threshold_low = context->threshold_high - (0.2 * v_diff); | |
| 1542 | context->v_sqr_high = info->v_pos - 0.6; | |
| 1543 | context->v_sqr_low = context->threshold_high; | |
| 1646 | v_int -= 10; | |
| 1647 | context->threshold_high = ne566.c_high[v_int] + DSD_566__VNEG; | |
| 1648 | context->threshold_low = ne566.c_low[v_int] + DSD_566__VNEG; | |
| 1649 | context->v_sqr_high = DSD_566__VPOS - 1; | |
| 1650 | context->v_sqr_low = ne566.sqr_low[v_int] + DSD_566__VNEG; | |
| 1651 | context->v_osc_stable = ne566.osc_stable[v_int] + DSD_566__VNEG; | |
| 1652 | context->v_osc_stop = ne566.osc_stop[v_int] + DSD_566__VNEG; | |
| 1544 | 1653 | |
| 1545 | if (in | |
| 1654 | if ((in | |
| 1546 | 1655 | { |
| 1547 | 1656 | temp = (context->v_sqr_high - context->v_sqr_low) / 2; |
| 1548 | 1657 | context->v_sqr_high = temp; |
| 1549 | 1658 | context->v_sqr_low = -temp; |
| 1550 | context->triangle_ac_offset = context->threshold_high - (0.1 * v_ | |
| 1659 | context->triangle_ac_offset = context->threshold_high - (0.1 * v_ | |
| 1551 | 1660 | } |
| 1552 | 1661 | |
| 1553 | 1662 | /* Step the output */ |
| 1554 | 1663 | DISCRETE_STEP_CALL(dsd_566); |
| 1555 | 1664 | } |
| 1556 | 1665 | |
| 1666 | ||
| 1557 | 1667 | /************************************************************************ |
| 1558 | 1668 | * |
| 1559 | 1669 | * DSD_LS624 - Usage of node_description values |
| r5955 | r5956 | |
| 1586 | 1696 | #define LS624_F(_C, _VI, _VR) pow(10, -0.912029404 * log10(_C) + 0.243264328 * (_VI) \ |
| 1587 | 1697 | - 0.091695877 * (_VR) -0.014110946 * (_VI) * (_VR) - 3.207072925) |
| 1588 | 1698 | */ |
| 1589 | #define LS624_F(_VI) pow(10, context->k1 + 0.243264328 * (_VI) + context->k2 * (_VI)) | |
| 1590 | 1699 | |
| 1700 | /* pow(10, x) = exp(ln(10)*x) */ | |
| 1701 | #define pow10(x) exp(2.30258509299404568401*(x)) | |
| 1702 | ||
| 1703 | #define LS624_F(_VI) pow10(context->k1 + 0.243264328 * (_VI) + context->k2 * (_VI)) | |
| 1704 | ||
| 1591 | 1705 | static DISCRETE_STEP(dsd_ls624) |
| 1592 | 1706 | { |
| 1593 | 1707 | struct dsd_ls624_context *context = (struct dsd_ls624_context *)node->context; |
| r5955 | r5956 | |
| 1600 | 1714 | |
| 1601 | 1715 | sample_t = node->info->sample_time; /* Change in time */ |
| 1602 | 1716 | //dt = LS624_T(DSD_LS624__C, DSD_LS624__VRNG, DSD_LS624__VMOD) / 2.0; |
| 1603 | dt = 1.0f / (2.0f * LS624_F(DSD_LS624__VMOD)); | |
| 1717 | if (DSD_LS624__VMOD > 0.001) | |
| 1718 | dt = 0.5 / LS624_F(DSD_LS624__VMOD); | |
| 1719 | else | |
| 1720 | /* close enough to 0, so we can speed things up by no longer call pow() */ | |
| 1721 | dt = context->dt_vmod_at_0; | |
| 1604 | 1722 | t = context->remain; |
| 1605 | 1723 | en += (double) context->state * t; |
| 1606 | 1724 | while (t + dt <= sample_t) |
| r5955 | r5956 | |
| 1649 | 1767 | context->k1 = -0.912029404 * log10(DSD_LS624__C) -0.091695877 * (DSD_LS624__VRNG) - 3.207072925; |
| 1650 | 1768 | context->k2 = -0.014110946 * (DSD_LS624__VRNG); |
| 1651 | 1769 | |
| 1770 | context->dt_vmod_at_0 = 0.5 / LS624_F(0); | |
| 1771 | ||
| 1652 | 1772 | /* Step the output */ |
| 1653 | 1773 | DISCRETE_STEP_CALL(dsd_ls624); |
| 1654 | 1774 | } |
| r5955 | r5956 | |
|---|---|---|
| 100 | 100 | int type; |
| 101 | 101 | UINT8 flip_flop; /* flip/flop output state */ |
| 102 | 102 | UINT8 flip_flop_xor; /* flip_flop ^ flip_flop_xor, 0 = discharge, 1 = charge */ |
| 103 | UINT8 | |
| 103 | UINT8 o | |
| 104 | 104 | double v_out_high; |
| 105 | 105 | double threshold_low; /* falling threshold */ |
| 106 | 106 | double threshold_high; /* rising threshold */ |
| r5955 | r5956 | |
| 110 | 110 | double temp1; /* Multi purpose */ |
| 111 | 111 | double temp2; /* Multi purpose */ |
| 112 | 112 | double temp3; /* Multi purpose */ |
| 113 | double is_linear_charge; | |
| 114 | double charge_rc; | |
| 115 | double charge_exp; | |
| 113 | 116 | }; |
| 114 | 117 | |
| 115 | 118 | struct dss_sawtoothwave_context |
| r5955 | r5956 | |
| 745 | 748 | struct dss_op_amp_osc_context *context = (struct dss_op_amp_osc_context *)node->context; |
| 746 | 749 | |
| 747 | 750 | |
| 748 | double i; /* Charging current created by vIn */ | |
| 749 | double v = 0; /* all input voltages mixed */ | |
| 750 | double dt; /* change in time */ | |
| 751 | double vC; /* Current voltage on capacitor, before dt */ | |
| 752 | double vCnext = 0; /* Voltage on capacitor, after dt */ | |
| 753 | double iCharge[2] = {0}; | |
| 751 | double i; /* Charging current created by vIn */ | |
| 752 | double v = 0; /* all input voltages mixed */ | |
| 753 | double dt; /* change in time */ | |
| 754 | double v_cap; /* Current voltage on capacitor, before dt */ | |
| 755 | double v_cap_next = 0; /* Voltage on capacitor, after dt */ | |
| 756 | double charge[2] = {0}; | |
| 757 | double x_time = 0; /* time since change happened */ | |
| 758 | double exponent; | |
| 754 | 759 | UINT8 force_charge = 0; |
| 755 | 760 | UINT8 enable = DSS_OP_AMP_OSC__ENABLE; |
| 761 | UINT8 update_exponent = 0; | |
| 762 | int count_f = 0; | |
| 763 | int count_r = 0; | |
| 756 | 764 | |
| 757 | 765 | dt = node->info->sample_time; /* Change in time */ |
| 758 | v | |
| 766 | v_cap = context->v_cap; /* Set to voltage before change */ | |
| 759 | 767 | |
| 760 | /* work out the charge currents | |
| 768 | /* work out the charge currents/vol | |
| 761 | 769 | switch (context->type) |
| 762 | 770 | { |
| 763 | 771 | case DISC_OP_AMP_OSCILLATOR_VCO_1: |
| 764 | 772 | /* Work out the charge rates. */ |
| 765 | 773 | /* i is not a current. It is being used as a temp variable. */ |
| 766 | 774 | i = DSS_OP_AMP_OSC__VMOD1 * context->temp1; |
| 767 | iCharge[0] = (DSS_OP_AMP_OSC__VMOD1 - i) / info->r1; | |
| 768 | iCharge[1] = (i - (DSS_OP_AMP_OSC__VMOD1 * context->temp2)) / context->temp3; | |
| 775 | charge[0] = (DSS_OP_AMP_OSC__VMOD1 - i) / info->r1; | |
| 776 | charge[1] = (i - (DSS_OP_AMP_OSC__VMOD1 * context->temp2)) / context->temp3; | |
| 769 | 777 | break; |
| 770 | 778 | |
| 771 | 779 | case DISC_OP_AMP_OSCILLATOR_1 | DISC_OP_AMP_IS_NORTON: |
| r5955 | r5956 | |
| 773 | 781 | /* resistors can be nodes, so everything needs updating */ |
| 774 | 782 | double i1, i2; |
| 775 | 783 | /* Work out the charge rates. */ |
| 776 | iCharge[0] = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r1; | |
| 777 | iCharge[1] = (context->v_out_high - OP_AMP_NORTON_VBE) / *context->r2 - iCharge[0]; | |
| 784 | charge[0] = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r1; | |
| 785 | charge[1] = (context->v_out_high - OP_AMP_NORTON_VBE) / *context->r2 - charge[0]; | |
| 778 | 786 | /* Work out the Inverting Schmitt thresholds. */ |
| 779 | 787 | i1 = DSS_OP_AMP_OSC_NORTON_VP_IN / *context->r5; |
| 780 | 788 | i2 = (0.0 - OP_AMP_NORTON_VBE) / *context->r4; |
| r5955 | r5956 | |
| 803 | 811 | |
| 804 | 812 | /* Work out the charge rates. */ |
| 805 | 813 | v -= OP_AMP_NORTON_VBE; |
| 806 | iCharge[0] = v / info->r1; | |
| 807 | iCharge[1] = v / info->r2 - iCharge[0]; | |
| 814 | charge[0] = v / info->r1; | |
| 815 | charge[1] = v / info->r2 - charge[0]; | |
| 808 | 816 | |
| 809 | 817 | /* use the real enable circuit */ |
| 810 | 818 | force_charge = !enable; |
| r5955 | r5956 | |
| 814 | 822 | case DISC_OP_AMP_OSCILLATOR_VCO_2 | DISC_OP_AMP_IS_NORTON: |
| 815 | 823 | /* Work out the charge rates. */ |
| 816 | 824 | i = DSS_OP_AMP_OSC__VMOD1 / info->r1; |
| 817 | iCharge[0] = i - context->temp1; | |
| 818 | iCharge[1] = context->temp2 - i; | |
| 825 | charge[0] = i - context->temp1; | |
| 826 | charge[1] = context->temp2 - i; | |
| 819 | 827 | /* if the negative pin current is less then the positive pin current, */ |
| 820 | 828 | /* then the osc is disabled and the cap keeps charging */ |
| 821 | if ( | |
| 829 | if (c | |
| 822 | 830 | { |
| 823 | 831 | force_charge = 1; |
| 824 | | |
| 832 | c | |
| 825 | 833 | } |
| 826 | 834 | break; |
| 827 | 835 | |
| 828 | 836 | case DISC_OP_AMP_OSCILLATOR_VCO_3 | DISC_OP_AMP_IS_NORTON: |
| 829 | 837 | /* we need to mix any bias and all modulation voltages together. */ |
| 830 | | |
| 838 | c | |
| 831 | 839 | v = DSS_OP_AMP_OSC__VMOD1 - OP_AMP_NORTON_VBE; |
| 832 | | |
| 840 | c | |
| 833 | 841 | if (info->r6 != 0) |
| 834 | 842 | { |
| 835 | 843 | v = DSS_OP_AMP_OSC__VMOD2 - OP_AMP_NORTON_VBE; |
| 836 | | |
| 844 | c | |
| 837 | 845 | } |
| 838 | | |
| 846 | c | |
| 839 | 847 | break; |
| 840 | 848 | } |
| 841 | 849 | |
| 842 | if (enable) | |
| 850 | if (!enable) | |
| 843 | 851 | { |
| 844 | int toggled = 0; | |
| 845 | /* Keep looping until all toggling in time sample is used up. */ | |
| 846 | do | |
| 852 | /* we will just output 0 for oscillators that have no real enable. */ | |
| 853 | node->output[0] = 0; | |
| 854 | return; | |
| 855 | } | |
| 856 | ||
| 857 | /* Keep looping until all toggling in time sample is used up. */ | |
| 858 | do | |
| 859 | { | |
| 860 | if (context->is_linear_charge) | |
| 847 | 861 | { |
| 848 | 862 | if ((context->flip_flop ^ context->flip_flop_xor) || force_charge) |
| 849 | 863 | { |
| 850 | 864 | /* Charging */ |
| 851 | 865 | /* iC=C*dv/dt works out to dv=iC*dt/C */ |
| 852 | v | |
| 866 | v_cap_next = v_cap + (c | |
| 853 | 867 | dt = 0; |
| 854 | 868 | |
| 855 | 869 | /* has it charged past upper limit? */ |
| 856 | if (v | |
| 870 | if (v_cap_next > context->threshold_high) | |
| 857 | 871 | { |
| 858 | 872 | context->flip_flop = context->flip_flop_xor; |
| 859 | toggled++; | |
| 873 | if (context->flip_flop) | |
| 874 | count_r++; | |
| 875 | else | |
| 876 | count_f++; | |
| 860 | 877 | if (force_charge) |
| 861 | 878 | { |
| 862 | 879 | /* we need to keep charging the cap to the max thereby disabling the circuit */ |
| 863 | if (vCnext > context->v_out_high) | |
| 864 | vCnext = context->v_out_high; | |
| 880 | if (v_cap_next > context->v_out_high) | |
| 881 | v_cap_next = context->v_out_high; | |
| 865 | 882 | } |
| 866 | 883 | else |
| 867 | 884 | { |
| 868 | 885 | /* calculate the overshoot time */ |
| 869 | dt = info->c * (vCnext - context->threshold_high) / iCharge[1]; | |
| 870 | vC = context->threshold_high; | |
| 886 | dt = info->c * (v_cap_next - context->threshold_high) / charge[1]; | |
| 887 | x_time = dt; | |
| 888 | v_cap = context->threshold_high; | |
| 871 | 889 | } |
| 872 | 890 | } |
| 873 | 891 | } |
| 874 | 892 | else |
| 875 | 893 | { |
| 876 | 894 | /* Discharging */ |
| 877 | v | |
| 895 | v_cap_next = v_cap - (c | |
| 878 | 896 | dt = 0; |
| 879 | 897 | |
| 880 | 898 | /* has it discharged past lower limit? */ |
| 881 | if (v | |
| 899 | if (v_cap_next < context->threshold_low) | |
| 882 | 900 | { |
| 883 | 901 | context->flip_flop = !context->flip_flop_xor; |
| 884 | toggled++; | |
| 902 | if (context->flip_flop) | |
| 903 | count_r++; | |
| 904 | else | |
| 905 | count_f++; | |
| 885 | 906 | /* calculate the overshoot time */ |
| 886 | dt = info->c * (context->threshold_low - vCnext) / iCharge[0]; | |
| 887 | vC = context->threshold_low; | |
| 907 | dt = info->c * (context->threshold_low - v_cap_next) / charge[0]; | |
| 908 | x_time = dt; | |
| 909 | v_cap = context->threshold_low; | |
| 888 | 910 | } |
| 889 | 911 | } |
| 890 | } while(dt); | |
| 912 | } | |
| 913 | else /* non-linear charge */ | |
| 914 | { | |
| 915 | if (update_exponent) | |
| 916 | exponent = RC_CHARGE_EXP_DT(context->charge_rc, dt); | |
| 917 | else | |
| 918 | exponent = context->charge_exp; | |
| 891 | 919 | |
| 892 | context->v_cap = vCnext; | |
| 920 | if (context->flip_flop) | |
| 921 | { | |
| 922 | /* Charging */ | |
| 923 | v_cap_next = v_cap + ((context->v_out_high - v_cap) * exponent); | |
| 924 | dt = 0; | |
| 893 | 925 | |
| 894 | if (context->is_squarewave) | |
| 895 | { | |
| 896 | if (toggled == 2) | |
| 897 | /* Some oscillators have rapid rise or fall times causing 1 part of the */ | |
| 898 | /* squarewave to happen in the sample time causing it to be missed. */ | |
| 899 | /* If we toggle 2 states we force the missed output for 1 sample. */ | |
| 900 | /* If more then 2 states happen, there is no hope, the sample rate is just too low. */ | |
| 901 | node->output[0] = context->v_out_high * (context->flip_flop ? 0 : 1); | |
| 926 | /* Has it charged past upper limit? */ | |
| 927 | if (v_cap_next > context->threshold_high) | |
| 928 | { | |
| 929 | dt = context->charge_rc * log(1.0 / (1.0 - ((v_cap_next - context->threshold_high) / (context->v_out_high - v_cap)))); | |
| 930 | x_time = dt; | |
| 931 | v_cap_next = 0; | |
| 932 | v_cap = context->threshold_high; | |
| 933 | context->flip_flop = 0; | |
| 934 | count_f++; | |
| 935 | update_exponent = 1; | |
| 936 | } | |
| 937 | } | |
| 902 | 938 | else |
| 903 | node->output[0] = context->v_out_high * context->flip_flop; | |
| 939 | { | |
| 940 | /* Discharging */ | |
| 941 | v_cap_next = v_cap - (v_cap * exponent); | |
| 942 | dt = 0; | |
| 943 | ||
| 944 | /* has it discharged past lower limit? */ | |
| 945 | if (v_cap_next < context->threshold_low) | |
| 946 | { | |
| 947 | dt = context->charge_rc * log(1.0 / (1.0 - ((context->threshold_low - v_cap_next) / v_cap))); | |
| 948 | x_time = dt; | |
| 949 | v_cap = context->threshold_low; | |
| 950 | context->flip_flop = 1; | |
| 951 | count_r++; | |
| 952 | update_exponent = 1; | |
| 953 | } | |
| 954 | } | |
| 904 | 955 | } |
| 905 | else | |
| 906 | node->output[0] = context->v_cap; | |
| 907 | } | |
| 908 | else | |
| 956 | context->v_cap = v_cap_next; | |
| 957 | } while(dt); | |
| 958 | ||
| 959 | x_time = dt / node->info->sample_time; | |
| 960 | ||
| 961 | switch (context->output_type) | |
| 909 | 962 | { |
| 910 | /* we will just output 0 for oscillators that have no real enable. */ | |
| 911 | node->output[0] = 0; | |
| 963 | case DISC_OP_AMP_OSCILLATOR_OUT_CAP: | |
| 964 | node->output[0] = v_cap_next; | |
| 965 | break; | |
| 966 | case DISC_OP_AMP_OSCILLATOR_OUT_ENERGY: | |
| 967 | if (x_time == 0) x_time = 1.0; | |
| 968 | node->output[0] = context->v_out_high * (context->flip_flop ? x_time : (1.0 - x_time)); | |
| 969 | break; | |
| 970 | case DISC_OP_AMP_OSCILLATOR_OUT_SQW: | |
| 971 | node->output[0] = context->flip_flop * context->v_out_high ; | |
| 972 | break; | |
| 973 | case DISC_OP_AMP_OSCILLATOR_OUT_COUNT_F_X: | |
| 974 | node->output[0] = count_f ? count_f + x_time : count_f; | |
| 975 | break; | |
| 976 | case DISC_OP_AMP_OSCILLATOR_OUT_COUNT_R_X: | |
| 977 | node->output[0] = count_r ? count_r + x_time : count_r; | |
| 978 | break; | |
| 979 | case DISC_OP_AMP_OSCILLATOR_OUT_LOGIC_X: | |
| 980 | node->output[0] = context->flip_flop + x_time; | |
| 981 | break; | |
| 912 | 982 | } |
| 913 | 983 | } |
| 914 | 984 | |
| r5955 | r5956 | |
| 940 | 1010 | r_context_ptr++; |
| 941 | 1011 | } |
| 942 | 1012 | |
| 943 | context->is_squarewave = info->type & DISC_OP_AMP_OSCILLATOR_OUT_SQW; | |
| 944 | context->type = info->type & DISC_OP_AMP_OSCILLATOR_TYPE_MASK; | |
| 1013 | context->is_linear_charge = 1; | |
| 1014 | context->output_type = info->type & DISC_OP_AMP_OSCILLATOR_OUT_MASK; | |
| 1015 | context->type = info->type & DISC_OP_AMP_OSCILLATOR_TYPE_MASK; | |
| 945 | 1016 | |
| 946 | 1017 | switch (context->type) |
| 947 | 1018 | { |
| r5955 | r5956 | |
| 963 | 1034 | context->temp3 = 1.0 / (1.0 / info->r1 + 1.0 / info->r6); /* input resistance when r6 switched in */ |
| 964 | 1035 | break; |
| 965 | 1036 | |
| 1037 | case DISC_OP_AMP_OSCILLATOR_2 | DISC_OP_AMP_IS_NORTON: | |
| 1038 | context->is_linear_charge = 0; | |
| 1039 | context->charge_rc = info->r1 * info->c; | |
| 1040 | context->charge_exp = RC_CHARGE_EXP(context->charge_rc); | |
| 1041 | context->threshold_low = (info->vP - OP_AMP_NORTON_VBE) / info->r4; | |
| 1042 | context->threshold_high = context->threshold_low + (info->vP - OP_AMP_VP_RAIL_OFFSET - OP_AMP_VP_RAIL_OFFSET) / info->r3;; | |
| 1043 | context->threshold_low = context->threshold_low * info->r2 + OP_AMP_NORTON_VBE; | |
| 1044 | context->threshold_high = context->threshold_high * info->r2 + OP_AMP_NORTON_VBE; | |
| 1045 | /* fall through */ | |
| 1046 | ||
| 966 | 1047 | case DISC_OP_AMP_OSCILLATOR_1 | DISC_OP_AMP_IS_NORTON: |
| 967 | 1048 | /* Charges while FlipFlop High */ |
| 968 | 1049 | context->flip_flop_xor = 0; |
| r5955 | r5956 | |
|---|---|---|
| 1299 | 1299 | |
| 1300 | 1300 | ***********************************************************************************************/ |
| 1301 | 1301 | |
| 1302 | TIMER_CALLBACK( io_ready_cb ) | |
| 1302 | static TIMER_CALLBACK( io_ready_cb ) | |
| 1303 | 1303 | { |
| 1304 | 1304 | tms5220_state *tms = (tms5220_state *) ptr; |
| 1305 | 1305 | if (param) |
| r5955 | r5956 | |
|---|---|---|
| 255 | 255 | |
| 256 | 256 | /* disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver, |
| 257 | 257 | or if we are debugging */ |
| 258 | if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == & | |
| 258 | if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &GAME | |
| 259 | 259 | show_gameinfo = show_warnings = show_disclaimer = FALSE; |
| 260 | 260 | |
| 261 | 261 | /* initialize the on-screen display system */ |
| r5955 | r5956 | |
| 266 | 266 | for (state = 0; state < maxstate && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select(); state++) |
| 267 | 267 | { |
| 268 | 268 | /* default to standard colors */ |
| 269 | messagebox_backcolor = UI_ | |
| 269 | messagebox_backcolor = UI_BACKGROUND_COLOR; | |
| 270 | 270 | |
| 271 | 271 | /* pick the next state */ |
| 272 | 272 | switch (state) |
| r5955 | r5956 | |
| 281 | 281 | { |
| 282 | 282 | ui_set_handler(handler_messagebox_ok, 0); |
| 283 | 283 | if (machine->gamedrv->flags & (GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_REQUIRES_ARTWORK | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NO_SOUND)) |
| 284 | messagebox_backcolor = UI_YELLOWCOLOR; | |
| 284 | messagebox_backcolor = UI_YELLOW_COLOR; | |
| 285 | 285 | if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) |
| 286 | messagebox_backcolor = UI_REDCOLOR; | |
| 286 | messagebox_backcolor = UI_RED_COLOR; | |
| 287 | 287 | } |
| 288 | 288 | break; |
| 289 | 289 | |
| r5955 | r5956 | |
| 330 | 330 | |
| 331 | 331 | /* copy in the new text */ |
| 332 | 332 | astring_cpyc(messagebox_text, text); |
| 333 | messagebox_backcolor = UI_ | |
| 333 | messagebox_backcolor = UI_BACKGROUND_COLOR; | |
| 334 | 334 | |
| 335 | 335 | /* don't update more than 4 times/second */ |
| 336 | 336 | if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) |
| r5955 | r5956 | |
| 470 | 470 | |
| 471 | 471 | void ui_draw_outlined_box(float x0, float y0, float x1, float y1, rgb_t backcolor) |
| 472 | 472 | { |
| 473 | float hw = UI_LINE_WIDTH * 0.5f; | |
| 474 | 473 | render_ui_add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 475 | render_ui_add_line(x0 + hw, y0 + hw, x1 - hw, y0 + hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 476 | render_ui_add_line(x1 - hw, y0 + hw, x1 - hw, y1 - hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 477 | render_ui_add_line(x1 - hw, y1 - hw, x0 + hw, y1 - hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 478 | render_ui_add_line(x0 + hw, y1 - hw, x0 + hw, y0 + hw, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 474 | render_ui_add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 475 | render_ui_add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 476 | render_ui_add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 477 | render_ui_add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); | |
| 479 | 478 | } |
| 480 | 479 | |
| 481 | 480 | |
| r5955 | r5956 | |
| 485 | 484 | |
| 486 | 485 | void ui_draw_text(const char *buf, float x, float y) |
| 487 | 486 | { |
| 488 | ui_draw_text_full(buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_O | |
| 487 | ui_draw_text_full(buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL | |
| 489 | 488 | } |
| 490 | 489 | |
| 491 | 490 | |
| r5955 | r5956 | |
| 730 | 729 | target_x + target_width + UI_BOX_LR_BORDER, |
| 731 | 730 | target_y + target_height + UI_BOX_TB_BORDER, backcolor); |
| 732 | 731 | ui_draw_text_full(text, target_x, target_y, target_width, |
| 733 | justify, WRAP_WORD, DRAW_NORMAL, | |
| 732 | justify, WRAP_WORD, DRAW_NORMAL, U | |
| 734 | 733 | } |
| 735 | 734 | |
| 736 | 735 | |
| r5955 | r5956 | |
| 746 | 745 | /* extract the text */ |
| 747 | 746 | va_start(arg,text); |
| 748 | 747 | astring_vprintf(messagebox_text, text, arg); |
| 749 | messagebox_backcolor = UI_ | |
| 748 | messagebox_backcolor = UI_BACKGROUND_COLOR; | |
| 750 | 749 | va_end(arg); |
| 751 | 750 | |
| 752 | 751 | /* set a timer */ |
| r5955 | r5956 | |
|---|---|---|
| 134 | 134 | { PROFILER_USER2, "User 2" }, |
| 135 | 135 | { PROFILER_USER3, "User 3" }, |
| 136 | 136 | { PROFILER_USER4, "User 4" }, |
| 137 | { PROFILER_USER5, "User 5" }, | |
| 138 | { PROFILER_USER6, "User 6" }, | |
| 139 | { PROFILER_USER7, "User 7" }, | |
| 140 | { PROFILER_USER8, "User 8" }, | |
| 137 | 141 | { PROFILER_PROFILER, "Profiler" }, |
| 138 | 142 | { PROFILER_IDLE, "Idle" } |
| 139 | 143 | }; |
| r5955 | r5956 | |
|---|---|---|
| 38 | 38 | /* handy colors */ |
| 39 | 39 | #define ARGB_WHITE MAKE_ARGB(0xff,0xff,0xff,0xff) |
| 40 | 40 | #define ARGB_BLACK MAKE_ARGB(0xff,0x00,0x00,0x00) |
| 41 | #define UI_FILLCOLOR MAKE_ARGB(0xe0,0x10,0x10,0x30) | |
| 42 | #define UI_YELLOWCOLOR MAKE_ARGB(0xe0,0x60,0x60,0x10) | |
| 43 | #define UI_REDCOLOR MAKE_ARGB(0xf0,0x60,0x10,0x10) | |
| 41 | #define UI_BORDER_COLOR MAKE_ARGB(0xff,0xff,0xff,0xff) | |
| 42 | #define UI_BACKGROUND_COLOR MAKE_ARGB(0xe0,0x10,0x10,0x30) | |
| 43 | #define UI_GFXVIEWER_BG_COLOR MAKE_ARGB(0xe0,0x10,0x10,0x30) | |
| 44 | #define UI_GREEN_COLOR MAKE_ARGB(0xe0,0x10,0x60,0x10) | |
| 45 | #define UI_YELLOW_COLOR MAKE_ARGB(0xe0,0x60,0x60,0x10) | |
| 46 | #define UI_RED_COLOR MAKE_ARGB(0xf0,0x60,0x10,0x10) | |
| 47 | #define UI_UNAVAILABLE_COLOR MAKE_ARGB(0xff,0x40,0x40,0x40) | |
| 48 | #define UI_TEXT_COLOR MAKE_ARGB(0xff,0xff,0xff,0xff) | |
| 49 | #define UI_TEXT_BG_COLOR MAKE_ARGB(0xe0,0x00,0x00,0x00) | |
| 50 | #define UI_SUBITEM_COLOR MAKE_ARGB(0xff,0xff,0xff,0xff) | |
| 51 | #define UI_CLONE_COLOR MAKE_ARGB(0xff,0x80,0x80,0x80) | |
| 52 | #define UI_SELECTED_COLOR MAKE_ARGB(0xff,0xff,0xff,0x00) | |
| 53 | #define UI_SELECTED_BG_COLOR MAKE_ARGB(0xe0,0x80,0x80,0x00) | |
| 54 | #define UI_MOUSEOVER_COLOR MAKE_ARGB(0xff,0xff,0xff,0x80) | |
| 55 | #define UI_MOUSEOVER_BG_COLOR MAKE_ARGB(0x70,0x40,0x40,0x00) | |
| 56 | #define UI_MOUSEDOWN_COLOR MAKE_ARGB(0xff,0xff,0xff,0x80) | |
| 57 | #define UI_MOUSEDOWN_BG_COLOR MAKE_ARGB(0xb0,0x60,0x60,0x00) | |
| 58 | #define UI_DIPSW_COLOR MAKE_ARGB(0xff,0xff,0xff,0x00) | |
| 59 | #define UI_SLIDER_COLOR MAKE_ARGB(0xff,0xff,0xff,0xff) | |
| 44 | 60 | |
| 45 | 61 | /* cancel return value for a UI handler */ |
| 46 | 62 | #define UI_HANDLER_CANCEL ((UINT32)~0) |
| r5955 | r5956 | |
| 98 | 114 | MACROS |
| 99 | 115 | ***************************************************************************/ |
| 100 | 116 | |
| 101 | #define ui_draw_message_window(text) ui_draw_text_box(text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_ | |
| 117 | #define ui_draw_message_window(text) ui_draw_text_box(text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR) | |
| 102 | 118 | |
| 103 | 119 | |
| 104 | 120 |
| r5955 | r5956 | |
|---|---|---|
| 34 | 34 | /* profiling */ |
| 35 | 35 | enum |
| 36 | 36 | { |
| 37 | PROFILER_END = -1, | |
| 38 | 37 | PROFILER_CPU_FIRST = 0, |
| 39 | 38 | PROFILER_CPU_MAX = PROFILER_CPU_FIRST + 32, |
| 40 | 39 | PROFILER_MEMREAD, |
| r5955 | r5956 | |
| 59 | 58 | PROFILER_USER2, |
| 60 | 59 | PROFILER_USER3, |
| 61 | 60 | PROFILER_USER4, |
| 61 | PROFILER_USER5, | |
| 62 | PROFILER_USER6, | |
| 63 | PROFILER_USER7, | |
| 64 | PROFILER_USER8, | |
| 62 | 65 | |
| 63 | 66 | PROFILER_PROFILER, |
| 64 | 67 | PROFILER_IDLE, |
| r5955 | r5956 | |
|---|---|---|
| 1357 | 1357 | if (item != NULL && item->token != NULL) |
| 1358 | 1358 | devcode = astring_c(item->token); |
| 1359 | 1359 | else |
| 1360 | { | |
| 1360 | 1361 | devcode = code_to_string(itemid_token_table, INPUT_CODE_ITEMID(code)); |
| 1361 | assert(devcode != NULL); | |
| 1362 | if (devcode == NULL) | |
| 1363 | devcode = "UNKNOWN"; | |
| 1364 | } | |
| 1362 | 1365 | |
| 1363 | 1366 | /* determine the modifier part */ |
| 1364 | 1367 | modifier = code_to_string(modifier_token_table, INPUT_CODE_MODIFIER(code)); |
| r5955 | r5956 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | #include "devintrf.h" |
| 23 | 23 | |
| 24 | #define DRIVER_INIT(name) void driver_init_##name(running_machine *machine) | |
| 25 | #define DRIVER_INIT_CALL(name) driver_init_##name(machine) | |
| 24 | #define DRIVER_INIT_NAME(name) driver_init_##name | |
| 25 | #define DRIVER_INIT(name) void DRIVER_INIT_NAME(name)(running_machine *machine) | |
| 26 | #define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)(machine) | |
| 26 | 27 | |
| 27 | #define NVRAM_HANDLER(name) void nvram_handler_##name(running_machine *machine, mame_file *file, int read_or_write) | |
| 28 | #define NVRAM_HANDLER_CALL(name) nvram_handler_##name(machine, file, read_or_write) | |
| 28 | #define NVRAM_HANDLER_NAME(name) nvram_handler_##name | |
| 29 | #define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int read_or_write) | |
| 30 | #define NVRAM_HANDLER_CALL(name) NVRAM_HANDLER_NAME(name)(machine, file, read_or_write) | |
| 29 | 31 | |
| 30 | #define MEMCARD_HANDLER(name) void memcard_handler_##name(running_machine *machine, mame_file *file, int action) | |
| 31 | #define MEMCARD_HANDLER_CALL(name) memcard_handler_##name(machine, file, action) | |
| 32 | #define MEMCARD_HANDLER_NAME(name) memcard_handler_##name | |
| 33 | #define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int action) | |
| 34 | #define MEMCARD_HANDLER_CALL(name) MEMCARD_HANDLER_NAME(name)(machine, file, action) | |
| 32 | 35 | |
| 33 | #define MACHINE_START(name) void machine_start_##name(running_machine *machine) | |
| 34 | #define MACHINE_START_CALL(name) machine_start_##name(machine) | |
| 36 | #define MACHINE_START_NAME(name) machine_start_##name | |
| 37 | #define MACHINE_START(name) void MACHINE_START_NAME(name)(running_machine *machine) | |
| 38 | #define MACHINE_START_CALL(name) MACHINE_START_NAME(name)(machine) | |
| 35 | 39 | |
| 36 | #define MACHINE_RESET(name) void machine_reset_##name(running_machine *machine) | |
| 37 | #define MACHINE_RESET_CALL(name) machine_reset_##name(machine) | |
| 40 | #define MACHINE_RESET_NAME(name) machine_reset_##name | |
| 41 | #define MACHINE_RESET(name) void MACHINE_RESET_NAME(name)(running_machine *machine) | |
| 42 | #define MACHINE_RESET_CALL(name) MACHINE_RESET_NAME(name)(machine) | |
| 38 | 43 | |
| 39 | #define SOUND_START(name) void sound_start_##name(running_machine *machine) | |
| 40 | #define SOUND_START_CALL(name) sound_start_##name(machine) | |
| 44 | #define SOUND_START_NAME(name) sound_start_##name | |
| 45 | #define SOUND_START(name) void SOUND_START_NAME(name)(running_machine *machine) | |
| 46 | #define SOUND_START_CALL(name) SOUND_START_NAME(name)(machine) | |
| 41 | 47 | |
| 42 | #define SOUND_RESET(name) void sound_reset_##name(running_machine *machine) | |
| 43 | #define SOUND_RESET_CALL(name) sound_reset_##name(machine) | |
| 48 | #define SOUND_RESET_NAME(name) sound_reset_##name | |
| 49 | #define SOUND_RESET(name) void SOUND_RESET_NAME(name)(running_machine *machine) | |
| 50 | #define SOUND_RESET_CALL(name) SOUND_RESET_NAME(name)(machine) | |
| 44 | 51 | |
| 45 | #define VIDEO_START(name) void video_start_##name(running_machine *machine) | |
| 46 | #define VIDEO_START_CALL(name) video_start_##name(machine) | |
| 52 | #define VIDEO_START_NAME(name) video_start_##name | |
| 53 | #define VIDEO_START(name) void VIDEO_START_NAME(name)(running_machine *machine) | |
| 54 | #define VIDEO_START_CALL(name) VIDEO_START_NAME(name)(machine) | |
| 47 | 55 | |
| 48 | #define VIDEO_RESET(name) void video_reset_##name(running_machine *machine) | |
| 49 | #define VIDEO_RESET_CALL(name) video_reset_##name(machine) | |
| 56 | #define VIDEO_RESET_NAME(name) video_reset_##name | |
| 57 | #define VIDEO_RESET(name) void VIDEO_RESET_NAME(name)(running_machine *machine) | |
| 58 | #define VIDEO_RESET_CALL(name) VIDEO_RESET_NAME(name)(machine) | |
| 50 | 59 | |
| 51 | #define PALETTE_INIT(name) void palette_init_##name(running_machine *machine, const UINT8 *color_prom) | |
| 52 | #define PALETTE_INIT_CALL(name) palette_init_##name(machine, color_prom) | |
| 60 | #define PALETTE_INIT_NAME(name) palette_init_##name | |
| 61 | #define PALETTE_INIT(name) void PALETTE_INIT_NAME(name)(running_machine *machine, const UINT8 *color_prom) | |
| 62 | #define PALETTE_INIT_CALL(name) PALETTE_INIT_NAME(name)(machine, color_prom) | |
| 53 | 63 | |
| 54 | #define VIDEO_EOF(name) void video_eof_##name(running_machine *machine) | |
| 55 | #define VIDEO_EOF_CALL(name) video_eof_##name(machine) | |
| 64 | #define VIDEO_EOF_NAME(name) video_eof_##name | |
| 65 | #define VIDEO_EOF(name) void VIDEO_EOF_NAME(name)(running_machine *machine) | |
| 66 | #define VIDEO_EOF_CALL(name) VIDEO_EOF_NAME(name)(machine) | |
| 56 | 67 | |
| 57 | #define VIDEO_UPDATE(name) UINT32 video_update_##name(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect) | |
| 58 | #define VIDEO_UPDATE_CALL(name) video_update_##name(screen, bitmap, cliprect) | |
| 68 | #define VIDEO_UPDATE_NAME(name) video_update_##name | |
| 69 | #define VIDEO_UPDATE(name) UINT32 VIDEO_UPDATE_NAME(name)(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect) | |
| 70 | #define VIDEO_UPDATE_CALL(name) VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect) | |
| 59 | 71 | |
| 60 | 72 | |
| 61 | 73 | /* NULL versions */ |
| 62 | #define nvram_handler_NULL NULL | |
| 63 | #define memcard_handler_NULL NULL | |
| 64 | #define machine_start_NULL NULL | |
| 65 | #define machine_reset_NULL NULL | |
| 66 | #define sound_start_NULL NULL | |
| 67 | #define sound_reset_NULL NULL | |
| 68 | #define video_start_NULL NULL | |
| 69 | #define video_reset_NULL NULL | |
| 70 | #define palette_init_NULL NULL | |
| 71 | #define video_eof_NULL NULL | |
| 72 | #define video_update_NULL NULL | |
| 74 | #define driver_init_0 NULL | |
| 75 | #define nvram_handler_0 NULL | |
| 76 | #define memcard_handler_0 NULL | |
| 77 | #define machine_start_0 NULL | |
| 78 | #define machine_reset_0 NULL | |
| 79 | #define sound_start_0 NULL | |
| 80 | #define sound_reset_0 NULL | |
| 81 | #define video_start_0 NULL | |
| 82 | #define video_reset_0 NULL | |
| 83 | #define palette_init_0 NULL | |
| 84 | #define video_eof_0 NULL | |
| 85 | #define video_update_0 NULL | |
| 73 | 86 | |
| 74 | 87 | |
| 75 | 88 | typedef void (*driver_init_func)(running_machine *machine); |
| r5955 | r5956 | |
| 185 | 198 | MACROS FOR BUILDING GAME DRIVERS |
| 186 | 199 | ***************************************************************************/ |
| 187 | 200 | |
| 201 | #define GAME_NAME(name) driver_##name | |
| 202 | #define GAME_EXTERN(name) extern const game_driver GAME_NAME(name) | |
| 203 | ||
| 188 | 204 | #define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ |
| 189 | 205 | GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0)) |
| 190 | 206 | |
| 191 | 207 | #define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ |
| 192 | extern const game_driver driver_##NAME; \ | |
| 193 | const game_driver driver_##NAME = \ | |
| 208 | const game_driver GAME_NAME(NAME) = \ | |
| 194 | 209 | { \ |
| 195 | 210 | __FILE__, \ |
| 196 | 211 | #PARENT, \ |
| r5955 | r5956 | |
| 198 | 213 | FULLNAME, \ |
| 199 | 214 | #YEAR, \ |
| 200 | 215 | COMPANY, \ |
| 201 | machine_config_##MACHINE, \ | |
| 202 | ipt_##INPUT, \ | |
| 203 | driver_init_##INIT, \ | |
| 204 | rom_##NAME, \ | |
| 216 | MACHINE_DRIVER_NAME(MACHINE), \ | |
| 217 | INPUT_PORTS_NAME(INPUT), \ | |
| 218 | DRIVER_INIT_NAME(INIT), \ | |
| 219 | ROM_NAME(NAME), \ | |
| 205 | 220 | (MONITOR)|(FLAGS), \ |
| 206 | 221 | &LAYOUT[0] \ |
| 207 | 222 | }; |
| 208 | 223 | |
| 209 | /* this allows to leave the INIT field empty in the GAME() macro call */ | |
| 210 | #define driver_init_0 0 | |
| 211 | #define ipt_0 0 | |
| 212 | 224 | |
| 213 | 225 | |
| 214 | ||
| 215 | 226 | /*************************************************************************** |
| 216 | 227 | GLOBAL VARIABLES |
| 217 | 228 | ***************************************************************************/ |
| 218 | 229 | |
| 219 | 230 | extern const game_driver * const drivers[]; |
| 220 | 231 | |
| 221 | ||
| 232 | GAME | |
| 222 | 233 | |
| 223 | 234 | |
| 224 | 235 |
| r5955 | r5956 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /* these macros are used for declaring gfx_decode_entry_entry info arrays. */ |
| 85 | #define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry gfxdecodeinfo_##name[] | |
| 86 | #define GFXDECODE_START( name ) const gfx_decode_entry gfxdecodeinfo_##name[] = { | |
| 85 | #define GFXDECODE_NAME( name ) gfxdecodeinfo_##name | |
| 86 | #define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[] | |
| 87 | #define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = { | |
| 87 | 88 | #define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0, 0 }, |
| 88 | 89 | #define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale }, |
| 89 | 90 | #define GFXDECODE_END { 0 } }; |
| r5955 | r5956 | |
|---|---|---|
| 191 | 191 | |
| 192 | 192 | /* use this to declare external references to a machine driver */ |
| 193 | 193 | #define MACHINE_DRIVER_EXTERN(_name) \ |
| 194 | extern const machine_config_token | |
| 194 | extern const machine_config_token MACHINE_DRIVER_NAME(_name)[] | |
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | /* importing data from other machine drivers */ |
| 198 | 198 | #define MDRV_IMPORT_FROM(_name) \ |
| 199 | 199 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \ |
| 200 | TOKEN_PTR(tokenptr, | |
| 200 | TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)), | |
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | /* core parameters */ |
| r5955 | r5956 | |
| 223 | 223 | /* core functions */ |
| 224 | 224 | #define MDRV_MACHINE_START(_func) \ |
| 225 | 225 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \ |
| 226 | TOKEN_PTR(machine_start, | |
| 226 | TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)), | |
| 227 | 227 | |
| 228 | 228 | #define MDRV_MACHINE_RESET(_func) \ |
| 229 | 229 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_RESET, 8), \ |
| 230 | TOKEN_PTR(machine_reset, | |
| 230 | TOKEN_PTR(machine_reset, MACHINE_RESET_NAME(_func)), | |
| 231 | 231 | |
| 232 | 232 | #define MDRV_NVRAM_HANDLER(_func) \ |
| 233 | 233 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_NVRAM_HANDLER, 8), \ |
| 234 | TOKEN_PTR(nvram_handler, | |
| 234 | TOKEN_PTR(nvram_handler, NVRAM_HANDLER_NAME(_func)), | |
| 235 | 235 | |
| 236 | 236 | #define MDRV_MEMCARD_HANDLER(_func) \ |
| 237 | 237 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MEMCARD_HANDLER, 8), \ |
| 238 | TOKEN_PTR(memcard_handler, | |
| 238 | TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)), | |
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | /* core video parameters */ |
| r5955 | r5956 | |
| 244 | 244 | |
| 245 | 245 | #define MDRV_GFXDECODE(_gfx) \ |
| 246 | 246 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_GFXDECODE, 8), \ |
| 247 | TOKEN_PTR(gfxdecode, | |
| 247 | TOKEN_PTR(gfxdecode, GFXDECODE | |
| 248 | 248 | |
| 249 | 249 | #define MDRV_PALETTE_LENGTH(_length) \ |
| 250 | 250 | TOKEN_UINT32_PACK2(MCONFIG_TOKEN_PALETTE_LENGTH, 8, _length, 24), |
| r5955 | r5956 | |
| 257 | 257 | /* core video functions */ |
| 258 | 258 | #define MDRV_PALETTE_INIT(_func) \ |
| 259 | 259 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \ |
| 260 | TOKEN_PTR(palette_init, | |
| 260 | TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)), | |
| 261 | 261 | |
| 262 | 262 | #define MDRV_VIDEO_START(_func) \ |
| 263 | 263 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_START, 8), \ |
| 264 | TOKEN_PTR(video_start, | |
| 264 | TOKEN_PTR(video_start, VIDEO_START_NAME(_func)), | |
| 265 | 265 | |
| 266 | 266 | #define MDRV_VIDEO_RESET(_func) \ |
| 267 | 267 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_RESET, 8), \ |
| 268 | TOKEN_PTR(video_reset, | |
| 268 | TOKEN_PTR(video_reset, VIDEO_RESET_NAME(_func)), | |
| 269 | 269 | |
| 270 | 270 | #define MDRV_VIDEO_EOF(_func) \ |
| 271 | 271 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_EOF, 8), \ |
| 272 | TOKEN_PTR(video_eof, | |
| 272 | TOKEN_PTR(video_eof, VIDEO_EOF_NAME(_func)), | |
| 273 | 273 | |
| 274 | 274 | #define MDRV_VIDEO_UPDATE(_func) \ |
| 275 | 275 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_UPDATE, 8), \ |
| 276 | TOKEN_PTR(video_update, | |
| 276 | TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)), | |
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | /* core sound functions */ |
| 280 | 280 | #define MDRV_SOUND_START(_func) \ |
| 281 | 281 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \ |
| 282 | TOKEN_PTR(sound_start, | |
| 282 | TOKEN_PTR(sound_start, SOUND_START_NAME(_func)), | |
| 283 | 283 | |
| 284 | 284 | #define MDRV_SOUND_RESET(_func) \ |
| 285 | 285 | TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \ |
| 286 | TOKEN_PTR(sound_start, | |
| 286 | TOKEN_PTR(sound_start, SOUND_RESET_NAME(_func)), | |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | /* add/remove devices */ |
| r5955 | r5956 | |
|---|---|---|
| 377 | 377 | (int) length); |
| 378 | 378 | |
| 379 | 379 | /* draw the cassette */ |
| 380 | ui_draw_text_box(buf, JUSTIFY_LEFT, x, y, UI_ | |
| 380 | ui_draw_text_box(buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 |
| r5955 | r5956 | |
|---|---|---|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /* draw a box */ |
| 173 | ui_draw_outlined_box(x1, y1, x2, y2, UI_ | |
| 173 | ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR); | |
| 174 | 174 | |
| 175 | 175 | /* take off the borders */ |
| 176 | 176 | x1 += UI_BOX_LR_BORDER; |
| r5955 | r5956 | |
|---|---|---|
| 430 | 430 | MDRV_CPU_PROGRAM_MAP( telestrat_mem) |
| 431 | 431 | |
| 432 | 432 | MDRV_MACHINE_START( telestrat ) |
| 433 | MDRV_MACHINE_RESET( NULL ) | |
| 434 | 433 | |
| 435 | 434 | /* acia */ |
| 436 | 435 | MDRV_ACIA6551_ADD("acia") |
| r5955 | r5956 | |
|---|---|---|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | static ADDRESS_MAP_START( a310_mem, ADDRESS_SPACE_PROGRAM, 32 ) |
| 88 | AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(memc_logical_r, memc_logical_w) | |
| 89 | AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */ | |
| 90 | AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(ioc_r, ioc_w) | |
| 91 | AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(vidc_r, vidc_w) | |
| 92 | AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(memc_r, memc_w) | |
| 93 | AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(memc_page_w) | |
| 88 | AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w) | |
| 89 | AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */ | |
| 90 | AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w) | |
| 91 | AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w) | |
| 92 | AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w) | |
| 93 | AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w) | |
| 94 | 94 | ADDRESS_MAP_END |
| 95 | 95 | |
| 96 | 96 |
| r5955 | r5956 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | Source Changes: |
| 66 | 66 | ---------------- |
| 67 | - The core is based on MAME 0.134u | |
| 67 | - The core is based on MAME 0.134u2. This incorporates all features of the | |
| 68 | 68 | update to this core. [MAME team] |
| 69 | 69 | |
| 70 | 70 | - Moved implementation to device. [Miodrag Milanovic] |
| Previous | 15994 Revisions | Next |