static READ8_HANDLER( kopunch_in_r ) { /* port 31 + low 3 bits of port 32 contain the punch strength */ if (offset == 0) return mame_rand(machine); else return (mame_rand(machine) & 0x07) | input_port_read_indexed(machine, 1); }
static READ8_HANDLER( blitter_r ) { if(offset == 6) return mame_rand(space->machine); return 0; }
static READ8_HANDLER( r3 ) { int pc = activecpu_get_pc(); if(pc != 0x81cb && pc != 0x90fa && pc != 0x911b && pc != 0x90d3 && pc != 0x90c4) printf("r3 @ %X\n",activecpu_get_pc()); return mame_rand(Machine) & ~1; //with 1 jumps back (infinite loop): a status ready for something? }
static READ8_HANDLER( r1 ) { int pc = activecpu_get_pc(); if(pc != 0x81cb) printf("r1 @ %X\n",activecpu_get_pc()); return mame_rand(Machine); }
AM_RANGE(0x0000, 0x0fff) AM_ROM ADDRESS_MAP_END static READ8_HANDLER(rng_r) { return mame_rand(space->machine); }
static READ32_HANDLER(test2_r) { // if (offset==0) // return input_port_read(space->machine, "IN0"); //0xffffffff; // logerror("%08x: Test2_r %d\n",cpu_get_pc(space->cpu),offset); return mame_rand(space->machine); //0xffffffff; }
// AM_RANGE(0xf000, 0xffff) AM_RAM AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END static READ8_HANDLER( suprgolf_random ) { return mame_rand(Machine); }
/* Read/Write Handlers */ static READ8_HANDLER( devram_r ) { airbustr_state *state = (airbustr_state *)space->machine->driver_data; // There's an MCU here, possibly switch (offset) { /* Reading efe0 probably resets a watchdog mechanism that would reset the main cpu. We avoid this and patch the rom instead (main cpu has to be reset once at startup) */ case 0xfe0: return watchdog_reset_r(space, 0); /* Reading a word at eff2 probably yelds the product of the words written to eff0 and eff2 */ case 0xff2: case 0xff3: { int x = (state->devram[0xff0] + state->devram[0xff1] * 256) * (state->devram[0xff2] + state->devram[0xff3] * 256); if (offset == 0xff2) return (x & 0x00ff) >> 0; else return (x & 0xff00) >> 8; } break; /* Reading eff4, F0 times must yield at most 80-1 consecutive equal values */ case 0xff4: return mame_rand(space->machine); default: return state->devram[offset]; }
INPUT_PORTS_END // stops the game hanging.. static CUSTOM_INPUT( nb1413m3_hackbusyflag_r ) { return mame_rand(field->port->machine) & 3; }
ADDRESS_MAP_END #ifdef UNUSED_FUNCTION READ8_HANDLER( fortecar_read62 ) { return mame_rand(Machine); }
ROM_END static READ16_HANDLER( sunsetbl_r ) { return mame_rand(space->machine); }
AM_RANGE(0xf000, 0xffff) AM_RAM ADDRESS_MAP_END static READ8_HANDLER( unk_87_r ) { /* n7751_status_r ? bit 7 = ack/status from device connected to port 8a? */ return mame_rand(space->machine); }
AM_RANGE(0x0000, 0xffff) AM_ROM ADDRESS_MAP_END static READ8_HANDLER(myread) { return mame_rand(); }
static READ8_HANDLER( kingball_IN1_r ) { /* bit 5 is the NOISE line from the sound circuit. The code just verifies that it's working, doesn't actually use return value, so we can just use rand() */ return (readinputport(1) & ~0x20) | (mame_rand(Machine) & 0x20); }
static READ8_HANDLER( ddrible_vlm5030_busy_r ) { return mame_rand(Machine); /* patch */ /* FIXME: remove ? */ #if 0 if (VLM5030_BSY()) return 1; else return 0; #endif }
static READ16_HANDLER(unk_r) { // c9 = status ? //40 10 04=start ? // 40,41,44 = ? // 4a = flags? if(offset==0xc9/2 )//|| offset==0x40 || offset==0x41 || offset==0x44) return mame_rand(space->machine); return unkram[offset]; }
static void drawCrt( running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect ) { dwarfd_state *state = (dwarfd_state *)machine->driver_data; int x, y; for (y = 0; y < maxy; y++) { int count = y * 256; int bank2 = 4; if (y < TOPLINE || y > BOTTOMLINE) { bank2 = 0; } for (x = 0; x < maxx; x++) { int tile = 0; int b = 0; //end marker while (b == 0) { if (count < 0x8000) tile = state->videobuf[count++]; else return; if (tile & 0x80) { if ((tile & 0xfc) == 0xf0) { switch (tile & 3) { case 0: case 1: break; case 2: case 3: return; } } if ((tile & 0xc0) == 0x80) { state->bank = (tile >> 2) & 3; } if ((tile & 0xc0) == 0xc0) { b = 1; tile = mame_rand(machine) & 0x7f;//(tile >> 2) & 0xf; } } else b = 1; } drawgfx_transpen(bitmap, cliprect, machine->gfx[0], tile + (state->bank + bank2) * 128, 0, 0, 0, x*8,y*8,0); }
ADDRESS_MAP_END static READ8_HANDLER(fake_6_r) { // if it returns 0 the cpu doesn't read from port $4 ? int ret = 0; ret ^= 1; return ret; return 1; return 0; return mame_rand(Machine); }
static void ddealer_protection(void) { if(prot==0) { shared_ram[0xe000/2]=0x4ef9; shared_ram[0xe002/2]=0x0000; shared_ram[0xe004/2]=0x0604; } shared_ram[0xe008/2]=0x0001; shared_ram[0xe00a/2]=0x0001; shared_ram[0xe00c/2]=0x0001; shared_ram[0xe00e/2]=0x0001; shared_ram[0xe010/2]=mame_rand(Machine) & 0xffff; shared_ram[0xe012/2]=mame_rand(Machine) & 0xffff; shared_ram[0xe014/2]=mame_rand(Machine) & 0xffff; shared_ram[0xe016/2]=mame_rand(Machine) & 0xffff; }
static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed) { running_device *samples = machine->device("samples"); /* Explosion - rising edge */ if (SOUNDVAL_RISING_EDGE(0x01)) sample_start(samples, 0, (mame_rand(machine) & 1) ? 0 : 6, 0); /* Fire sound - rising edge */ if (SOUNDVAL_RISING_EDGE(0x02)) sample_start(samples, 1, (mame_rand(machine) & 1) ? 1 : 7, 0); /* Player 1 thrust - 0=on, 1=off */ if (SOUNDVAL_FALLING_EDGE(0x04)) sample_start(samples, 3, 3, 1); if (SOUNDVAL_RISING_EDGE(0x04)) sample_stop(samples, 3); /* Player 2 thrust - 0=on, 1-off */ if (SOUNDVAL_FALLING_EDGE(0x08)) sample_start(samples, 4, 4, 1); if (SOUNDVAL_RISING_EDGE(0x08)) sample_stop(samples, 4); /* Mute - 0=off, 1=on */ if (SOUNDVAL_FALLING_EDGE(0x10)) sample_start(samples, 2, 2, 1); /* play idle sound */ if (SOUNDVAL_RISING_EDGE(0x10)) { int i; /* turn off all but the idle sound */ for (i = 0; i < 5; i++) if (i != 2) sample_stop(samples, i); /* Pop when board is shut off */ sample_start(samples, 2, 5, 0); } }
static READ32_HANDLER( eeprom_r ) { /* bit 3 = eeprom bit bit 6 = vblank flag Are these used only in landbrka ? bit 8 = ??? bit 9 = ??? */ return (readinputport(0) & ~0x308) | (EEPROM_read_bit() << 3) | (mame_rand() & 0x300); }
static READ16_HANDLER( rprot_r ) { logerror("rprot_r : offset = %02x\n",cpu_get_pc(space->cpu)); /* This is the only mask I found that allow a normal play. Using other values, the game hangs waiting for response, or simply throw a deliberated losing number. If someone more skilled in 68K code can help to trace it, searching for an accurated response, I'll appreciate. */ return mame_rand(space->machine) & 0x1f; }
static READ16_HANDLER(prot_r) { switch(prot_data) { case 0x0000: return 0x0d00; case 0xff00: return 0x8d00; case 0x8000: return 0x0f0f; } logerror("unk prot r %x %x\n",prot_data, cpu_get_previouspc(space->cpu)); return mame_rand(space->machine); }
static READ32_HANDLER( eolith_custom_r ) { /* bit 3 = eeprom bit bit 6 = vblank flag Are these used only in landbrka ? bit 8 = ??? bit 9 = ??? */ eolith_speedup_read(); return (input_port_read_indexed(machine, 0) & ~0x308) | (EEPROM_read_bit() << 3) | (mame_rand(Machine) & 0x300); }
void cojag_sound_init(running_machine *machine) { int i; /* fill the wave ROM -- these are pretty cheesy guesses */ for (i = 0; i < 0x80; i++) { /* F1D000 = triangle wave */ jaguar_wave_rom[0x000 + i] = ((i <= 0x40) ? i : 0x80 - i) * 32767 / 0x40; /* F1D200 = full sine wave */ jaguar_wave_rom[0x080 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80)); /* F1D400 = amplitude modulated sine wave? */ jaguar_wave_rom[0x100 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80)); /* F1D600 = sine wave and second order harmonic */ jaguar_wave_rom[0x180 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80)); /* F1D800 = chirp (sine wave of increasing frequency) */ jaguar_wave_rom[0x200 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80)); /* F1DA00 = traingle wave with noise */ jaguar_wave_rom[0x280 + i] = jaguar_wave_rom[0x000 + i] * (mame_rand(machine) % 32768) / 32768; /* F1DC00 = spike */ jaguar_wave_rom[0x300 + i] = (i == 0x40) ? 32767 : 0; /* F1DE00 = white noise */ jaguar_wave_rom[0x380 + i] = mame_rand(machine) % 32768; } #if ENABLE_SPEEDUP_HACKS memory_install_write32_handler(cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM), 0xf1a100, 0xf1a103, 0, 0, dsp_flags_w); #endif }
static READ16_HANDLER( topspeed_motor_r ) { switch (offset) { case 0x0: return (mame_rand(Machine) &0xff); /* motor status ?? */ case 0x101: return 0x55; /* motor cpu status ? */ default: logerror("CPU #0 PC %06x: warning - read from motor cpu %03x\n",activecpu_get_pc(),offset); return 0; } }
static READ16_HANDLER( bmc_protection_r ) { switch(cpu_get_previouspc(space->cpu)) { case 0xca68: switch(cpu_get_reg(space->cpu, M68K_D2)) { case 0: return 0x37<<8; case 0x1013: return 0; default: return 0x46<<8; } break; } logerror("Protection read @ %X\n",cpu_get_previouspc(space->cpu)); return mame_rand(space->machine); }
static READ8_HANDLER( rambank2_r ) { if (port_00 == 0x00) { return discoboy_ram_part3[offset]; } else if (port_00 == 0x01) { return discoboy_ram_part4[offset]; } else { printf( "unk rb2_r\n"); } return mame_rand(Machine); }
static READ8_HANDLER( pettanp_protection_r ) { int res; switch (activecpu_get_pc()) { case 0x6066: res = 0xa5; break; case 0x60dc: res = 0x20; break; /* bits 0-3 unknown */ case 0x615d: res = 0x30; break; /* bits 0-3 unknown */ case 0x61b9: res = 0x60|(mame_rand(Machine)&0x0f); break; /* bits 0-3 unknown */ case 0x6219: res = 0x77; break; case 0x626c: res = 0xb4; break; default: res = 0xff; break; } logerror("%04x: protection_r -> %02x\n",activecpu_get_pc(),res); return res; }
static READ8_HANDLER( banbam_protection_r ) { int res; switch (activecpu_get_pc()) { case 0x6094: res = 0xa5; break; case 0x6118: res = 0x20; break; /* bits 0-3 unknown */ case 0x6199: res = 0x30; break; /* bits 0-3 unknown */ case 0x61f5: res = 0x60|(mame_rand(Machine)&0x0f); break; /* bits 0-3 unknown */ case 0x6255: res = 0x77; break; case 0x62a8: res = 0xb4; break; default: res = 0xff; break; } logerror("%04x: protection_r -> %02x\n",activecpu_get_pc(),res); return res; }