public static void sound_reset() { switch (Machine.sBoard) { case "CPS-1": YM2151.ym2151_reset_chip(); OKI6295.okim6295_reset(); break; case "CPS-1(QSound)": case "CPS2": break; case "Neo Geo": FM.ym2610_reset_chip(); break; case "Namco System 1": YM2151.ym2151_reset_chip(); break; case "IGS011": OKI6295.okim6295_reset(); break; case "PGM": ICS2115.ics2115_reset(); break; } }
private static void lhb2_igs003_w(int offset, ushort data) { igs003_reg[offset] = data; if (offset == 0) { return; } switch (igs003_reg[0]) { case 0x00: igs_input_sel = data; //if (ACCESSING_BITS_0_7) { Generic.coin_counter_w(0, data & 0x20); } break; case 0x02: //if (ACCESSING_BITS_0_7) { lhb2_pen_hi = (byte)(data & 0x07); OKI6295.okim6295_set_bank_base((data & 0x08) != 0 ? 0x40000 : 0); } break; } }
public static void LoadStateBinaryC(BinaryReader reader) { int i, i1, n1, n2; dswa = reader.ReadByte(); dswb = reader.ReadByte(); dswc = reader.ReadByte(); basebanksnd = reader.ReadInt32(); for (i = 0; i < 0x20; i++) { cps_a_regs[i] = reader.ReadUInt16(); } for (i = 0; i < 0x20; i++) { cps_b_regs[i] = reader.ReadUInt16(); } for (i = 0; i < 0xc00; i++) { Palette.entry_color[i] = reader.ReadUInt32(); } Memory.mainram = reader.ReadBytes(0x10000); gfxram = reader.ReadBytes(0x30000); MC68000.m1.LoadStateBinary(reader); Memory.audioram = reader.ReadBytes(0x800); Z80A.z1.LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); Timer.global_basetime.seconds = reader.ReadInt32(); Timer.global_basetime.attoseconds = reader.ReadInt64(); Video.screenstate.frame_number = reader.ReadInt64(); Sound.last_update_second = reader.ReadInt32(); for (i = 0; i < 2; i++) { Cpuexec.cpu[i].suspend = reader.ReadByte(); Cpuexec.cpu[i].nextsuspend = reader.ReadByte(); Cpuexec.cpu[i].eatcycles = reader.ReadByte(); Cpuexec.cpu[i].nexteatcycles = reader.ReadByte(); Cpuexec.cpu[i].localtime.seconds = reader.ReadInt32(); Cpuexec.cpu[i].localtime.attoseconds = reader.ReadInt64(); } Timer.LoadStateBinary(reader); Memory.audioram = reader.ReadBytes(0x800); YM2151.LoadStateBinary(reader); OKI6295.LoadStateBinary(reader); for (i = 0; i < 2; i++) { Sound.latched_value[i] = reader.ReadUInt16(); } for (i = 0; i < 2; i++) { Sound.utempdata[i] = reader.ReadUInt16(); } Sound.ym2151stream.output_sampindex = reader.ReadInt32(); Sound.ym2151stream.output_base_sampindex = reader.ReadInt32(); Sound.okistream.output_sampindex = reader.ReadInt32(); Sound.okistream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); }
public static void SaveStateBinaryC(BinaryWriter writer) { int i; writer.Write(dswa); writer.Write(dswb); writer.Write(dswc); writer.Write(basebanksnd); for (i = 0; i < 0x20; i++) { writer.Write(cps_a_regs[i]); } for (i = 0; i < 0x20; i++) { writer.Write(cps_b_regs[i]); } for (i = 0; i < 0xc00; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(Memory.mainram, 0, 0x10000); writer.Write(gfxram, 0, 0x30000); MC68000.m1.SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x800); Z80A.z1.SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); writer.Write(Video.screenstate.frame_number); writer.Write(Sound.last_update_second); for (i = 0; i < 2; i++) { writer.Write(Cpuexec.cpu[i].suspend); writer.Write(Cpuexec.cpu[i].nextsuspend); writer.Write(Cpuexec.cpu[i].eatcycles); writer.Write(Cpuexec.cpu[i].nexteatcycles); writer.Write(Cpuexec.cpu[i].localtime.seconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds); } Timer.SaveStateBinary(writer); writer.Write(Memory.audioram, 0, 0x800); YM2151.SaveStateBinary(writer); OKI6295.SaveStateBinary(writer); for (i = 0; i < 2; i++) { writer.Write(Sound.latched_value[i]); } for (i = 0; i < 2; i++) { writer.Write(Sound.utempdata[i]); } writer.Write(Sound.ym2151stream.output_sampindex); writer.Write(Sound.ym2151stream.output_base_sampindex); writer.Write(Sound.okistream.output_sampindex); writer.Write(Sound.okistream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }
private static void wlcc_igs003_w(int offset, ushort data) { igs003_reg[offset] = data; if (offset == 0) { return; } switch (igs003_reg[0]) { case 0x02: //if (ACCESSING_BITS_0_7) { Generic.coin_counter_w(0, data & 0x01); OKI6295.okim6295_set_bank_base((data & 0x10) != 0 ? 0x40000 : 0); } break; } }
public static short MReadWord_lhb(int address) { address &= 0xffffff; short result = 0; if (address >= 0x000000 && address + 1 <= 0x07ffff) { result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; result = (short)(Generic.generic_nvram[offset] * 0x100 + Generic.generic_nvram[offset + 1]); } else if (address >= 0x200000 && address + 1 <= 0x200fff) { int offset = (address - 0x200000) / 2; result = (short)priority_ram[offset]; } else if (address >= 0x300000 && address + 1 <= 0x3fffff) { int offset = (address - 0x300000) / 2; result = (short)igs011_layers_r(offset); } else if (address >= 0x600000 && address + 1 <= 0x600001) { result = (short)OKI6295.okim6295_status_0_lsb_r(); } else if (address >= 0x700000 && address + 1 <= 0x700001) { result = sbytec; } else if (address >= 0x700002 && address + 1 <= 0x700005) { int offset = (address - 0x700002) / 2; result = (short)lhb_inputs_r(offset); } else if (address >= 0x888000 && address + 1 <= 0x888001) { result = (short)((byte)igs_5_dips_r()); } return(result); }
public static short MReadWord(int address) { address &= 0xffffff; short result = 0; if (address >= 0 && address + 1 <= 0x7ffff) { result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; result = (short)(Generic.generic_nvram[offset] * 0x100 + Generic.generic_nvram[offset + 1]); } else if (address >= 0x200000 && address + 1 <= 0x200fff) { int offset = (address - 0x200000) / 2; result = (short)priority_ram[offset]; } else if (address >= 0x400000 && address + 1 <= 0x401fff) { int offset = (address - 0x400000) / 2; result = (short)paletteram16[offset]; } else if (address >= 0x500000 && address + 1 <= 0x500001) { result = (short)((byte)sbytec); } else if (address >= 0x600000 && address + 1 <= 0x600001) { result = (short)OKI6295.okim6295_status_0_lsb_r(); } else if (address >= 0x800002 && address + 1 <= 0x800003) { result = (short)drgnwrld_igs003_r(); } else if (address >= 0xa88000 && address + 1 <= 0xa88001) { result = (short)igs_3_dips_r(); } return(result); }
private static void lhb_okibank_w(ushort data) { OKI6295.okim6295_set_bank_base((data & 0x200) != 0 ? 0x40000 : 0); }
private static void lhb_okibank_w(byte data) { //ACCESSING_BITS_8_15 OKI6295.okim6295_set_bank_base((data & 0x2) != 0 ? 0x40000 : 0); }
public static void MWriteWord_lhb(int address, short value) { address &= 0xffffff; if (address >= 0x010000 && address + 1 <= 0x010001) { lhb_okibank_w((ushort)value); } else if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; Generic.generic_nvram[offset] = (byte)(value >> 8); Generic.generic_nvram[offset + 1] = (byte)value; } else if (address >= 0x200000 && address + 1 <= 0x200fff) { int offset = (address - 0x200000) / 2; priority_ram[offset] = (ushort)value; } else if (address >= 0x300000 && address + 1 <= 0x3fffff) { int offset = (address - 0x300000) / 2; igs011_layers_w(offset, (ushort)value); } else if (address >= 0x400000 && address + 1 <= 0x401fff) { int offset = (address - 0x400000) / 2; igs011_palette(offset, (ushort)value); } else if (address >= 0x600000 && address + 1 <= 0x600001) { OKI6295.okim6295_data_0_lsb_w((byte)value); } else if (address >= 0x700002 && address + 1 <= 0x700003) { lhb_inputs_w((ushort)value); } else if (address >= 0x820000 && address + 1 <= 0x820001) { igs011_priority_w((ushort)value); } else if (address >= 0x838000 && address + 1 <= 0x838001) { lhb_irq_enable_w((ushort)value); } else if (address >= 0x840000 && address + 1 <= 0x840001) { igs_dips_w((ushort)value); } else if (address >= 0x858000 && address + 1 <= 0x858001) { igs011_blit_x_w((ushort)value); } else if (address >= 0x858800 && address + 1 <= 0x858801) { igs011_blit_y_w((ushort)value); } else if (address >= 0x859000 && address + 1 <= 0x859001) { igs011_blit_w_w((ushort)value); } else if (address >= 0x859800 && address + 1 <= 0x859801) { igs011_blit_h_w((ushort)value); } else if (address >= 0x85a000 && address + 1 <= 0x85a001) { igs011_blit_gfx_lo_w((ushort)value); } else if (address >= 0x85a800 && address + 1 <= 0x85a801) { igs011_blit_gfx_hi_w((ushort)value); } else if (address >= 0x85b000 && address + 1 <= 0x85b001) { igs011_blit_flags_w((ushort)value); } else if (address >= 0x85b800 && address + 1 <= 0x85b801) { igs011_blit_pen_w((ushort)value); } else if (address >= 0x85c000 && address + 1 <= 0x85c001) { igs011_blit_depth_w((ushort)value); } }
public static void SaveStateBinary(BinaryWriter writer) { int i, j; for (i = 0; i < 0x800; i++) { writer.Write(Palette.entry_color[i]); } writer.Write(Generic.generic_nvram, 0, 0x4000); for (i = 0; i < 0x800; i++) { writer.Write(priority_ram[i]); } for (i = 0; i < 0x1000; i++) { writer.Write(paletteram16[i]); } writer.Write(prot1); writer.Write(prot2); writer.Write(prot1_swap); writer.Write(prot1_addr); for (i = 0; i < 2; i++) { writer.Write(igs003_reg[i]); } for (i = 0; i < 2; i++) { writer.Write(vbowl_trackball[i]); } writer.Write(priority); writer.Write(igs_dips_sel); writer.Write(igs_input_sel); writer.Write(lhb_irq_enable); writer.Write(igs012_prot); writer.Write(igs012_prot_swap); writer.Write(igs012_prot_mode); for (i = 0; i < 8; i++) { for (j = 0; j < 0x20000; j++) { writer.Write(layer[i][j]); } } writer.Write(lhb2_pen_hi); writer.Write(blitter.x); writer.Write(blitter.y); writer.Write(blitter.w); writer.Write(blitter.h); writer.Write(blitter.gfx_lo); writer.Write(blitter.gfx_hi); writer.Write(blitter.depth); writer.Write(blitter.pen); writer.Write(blitter.flags); MC68000.m1.SaveStateBinary(writer); Cpuint.SaveStateBinary(writer); writer.Write(Timer.global_basetime.seconds); writer.Write(Timer.global_basetime.attoseconds); writer.Write(Video.screenstate.frame_number); writer.Write(Sound.last_update_second); writer.Write(Cpuexec.cpu[0].localtime.seconds); writer.Write(Cpuexec.cpu[0].localtime.attoseconds); Timer.SaveStateBinary(writer); OKI6295.SaveStateBinary(writer); for (i = 0; i < 9; i++) { writer.Write(FMOpl.OPL.P_CH[i].block_fnum); writer.Write(FMOpl.OPL.P_CH[i].kcode); for (j = 0; j < 2; j++) { writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ar); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].dr); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].rr); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].KSR); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ksl); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].ksr); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].mul); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].Cnt); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].FB); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].op1_out[0]); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].op1_out[1]); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].CON); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].eg_type); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].state); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].TL); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].volume); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].sl); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].key); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].AMmask); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].vib); writer.Write(FMOpl.OPL.P_CH[i].SLOT[j].wavetable); } } writer.Write(FMOpl.OPL.eg_cnt); writer.Write(FMOpl.OPL.eg_timer); writer.Write(FMOpl.OPL.rhythm); writer.Write(FMOpl.OPL.lfo_am_depth); writer.Write(FMOpl.OPL.lfo_pm_depth_range); writer.Write(FMOpl.OPL.lfo_am_cnt); writer.Write(FMOpl.OPL.lfo_pm_cnt); writer.Write(FMOpl.OPL.noise_rng); writer.Write(FMOpl.OPL.noise_p); writer.Write(FMOpl.OPL.wavesel); for (i = 0; i < 2; i++) { writer.Write(FMOpl.OPL.T[i]); } for (i = 0; i < 2; i++) { writer.Write(FMOpl.OPL.st[i]); } writer.Write(FMOpl.OPL.address); writer.Write(FMOpl.OPL.status); writer.Write(FMOpl.OPL.statusmask); writer.Write(FMOpl.OPL.mode); writer.Write(Sound.okistream.output_sampindex); writer.Write(Sound.okistream.output_base_sampindex); writer.Write(Sound.ym3812stream.output_sampindex); writer.Write(Sound.ym3812stream.output_base_sampindex); writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex); }
public static sbyte MReadByte_lhb(int address) { address &= 0xffffff; sbyte result = 0; if (address >= 0x000000 && address <= 0x07ffff) { result = (sbyte)Memory.mainrom[address]; } else if (address >= 0x100000 && address <= 0x103fff) { int offset = address - 0x100000; result = (sbyte)Generic.generic_nvram[offset]; } else if (address >= 0x200000 && address <= 0x200fff) { int offset = (address - 0x200000) / 2; if ((address & 1) == 0) { result = (sbyte)(priority_ram[offset] >> 8); } else if ((address & 1) == 1) { result = (sbyte)priority_ram[offset]; } } else if (address >= 0x300000 && address <= 0x3fffff) { int offset = address - 0x300000; if ((offset & 1) == 0) { result = (sbyte)igs011_layers_r1(offset / 2); } else if ((offset & 1) == 1) { result = (sbyte)igs011_layers_r2(offset / 2); } } else if (address >= 0x600000 && address <= 0x600001) { //if (address == 0x600001) { result = (sbyte)OKI6295.okim6295_status_0_lsb_r(); } } else if (address >= 0x700000 && address <= 0x700001) { if (address == 0x700001) { result = sbytec; } } else if (address >= 0x700002 && address <= 0x700005) { int offset = (address - 0x700002) / 2; if ((offset & 1) == 0) { int i1 = 1; } else if ((offset & 1) == 1) { result = (sbyte)lhb_inputs_r(offset); } } else if (address >= 0x888000 && address <= 0x888001) { result = (sbyte)igs_5_dips_r(); } return(result); }
public static void sound_init() { iRecord = 0; leftmix = new int[0x3c0]; rightmix = new int[0x3c0]; finalmixb = new byte[0xf00]; sound_muted = 0; buf2.Play(0, BufferPlayFlags.Looping); last_update_second = 0; //WavWrite.CreateSoundFile(@"\VS2008\compare1\compare1\bin\Debug\2.wav"); Atime update_frequency = new Atime(0, Attotime.ATTOSECONDS_PER_SECOND / 50); switch (Machine.sBoard) { case "CPS-1": latched_value = new ushort[2]; utempdata = new ushort[2]; sound_update = sound_updateC; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); YM2151.ym2151_init(3579545); OKI6295.okim6295_start(); ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one); okistream = new sound_stream(1000000 / 132, 0, 1, OKI6295.okim6295_update); mixerstream = new sound_stream(48000, 3, 0, null); break; case "CPS-1(QSound)": case "CPS2": sound_update = sound_updateQ; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); QSound.qsound_start(); qsoundstream = new sound_stream(4000000 / 166, 0, 2, QSound.qsound_update); mixerstream = new sound_stream(48000, 2, 0, null); break; case "Neo Geo": latched_value = new ushort[2]; utempdata = new ushort[2]; sound_update = sound_updateN; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); YM2610.ym2610_start(); ay8910stream = new sound_stream(250000, 0, 1, AY8910.ay8910_update); ym2610stream = new sound_stream(111111, 0, 2, FM.ym2610_update_one); mixerstream = new sound_stream(48000, 3, 0, null); break; case "Namco System 1": sound_update = sound_updateNa; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); YM2151.ym2151_init(3579580); Namco.namco_start(); DAC.dac_start(); ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one); namcostream = new sound_stream(192000, 0, 2, Namco.namco_update_stereo); dacstream = new sound_stream(192000, 0, 1, DAC.DAC_update); mixerstream = new sound_stream(48000, 5, 0, null); break; case "IGS011": sound_update = sound_updateIGS011; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); OKI6295.okim6295_start(); YM3812.ym3812_start(3579545); okistream = new sound_stream(1047600 / 132, 0, 1, OKI6295.okim6295_update); ym3812stream = new sound_stream(49715, 0, 1, FMOpl.ym3812_update_one); mixerstream = new sound_stream(48000, 2, 0, null); break; case "PGM": latched_value = new ushort[3]; utempdata = new ushort[3]; sound_update = sound_updatePGM; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); ICS2115.ics2115_start(); ics2115stream = new sound_stream(33075, 0, 2, ICS2115.ics2115_update); mixerstream = new sound_stream(48000, 2, 0, null); break; case "M72": latched_value = new ushort[1]; utempdata = new ushort[1]; sound_update = sound_updateM72; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); YM2151.ym2151_init(3579545); DAC.dac_start(); ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one); dacstream = new sound_stream(192000, 0, 1, DAC.DAC_update); mixerstream = new sound_stream(48000, 3, 0, null); break; case "M92": latched_value = new ushort[1]; utempdata = new ushort[1]; sound_update = sound_updateM92; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); YM2151.ym2151_init(3579545); Iremga20.iremga20_start(); ym2151stream = new sound_stream(55930, 0, 2, YM2151.ym2151_update_one); iremga20stream = new sound_stream(894886, 0, 2, Iremga20.iremga20_update); mixerstream = new sound_stream(48000, 4, 0, null); break; } Timer.timer_adjust_periodic(sound_update_timer, update_frequency, update_frequency); }
public static void LoadStateBinary(BinaryReader reader) { int i,j; for (i = 0; i < 0x800; i++) { Palette.entry_color[i] = reader.ReadUInt32(); } Generic.generic_nvram = reader.ReadBytes(0x4000); for (i = 0; i < 0x800; i++) { priority_ram[i] = reader.ReadUInt16(); } for (i = 0; i < 0x1000; i++) { paletteram16[i] = reader.ReadUInt16(); } prot1 = reader.ReadByte(); prot2 = reader.ReadByte(); prot1_swap = reader.ReadByte(); prot1_addr = reader.ReadUInt32(); for (i = 0; i < 2; i++) { igs003_reg[i] = reader.ReadUInt16(); } for (i = 0; i < 2; i++) { vbowl_trackball[i] = reader.ReadUInt16(); } priority = reader.ReadUInt16(); igs_dips_sel = reader.ReadUInt16(); igs_input_sel = reader.ReadUInt16(); lhb_irq_enable = reader.ReadUInt16(); igs012_prot = reader.ReadByte(); igs012_prot_swap = reader.ReadByte(); igs012_prot_mode = reader.ReadBoolean(); for (i = 0; i < 8; i++) { for (j = 0; j < 0x20000; j++) { layer[i][j] = reader.ReadByte(); } } lhb2_pen_hi = reader.ReadByte(); blitter.x = reader.ReadUInt16(); blitter.y = reader.ReadUInt16(); blitter.w = reader.ReadUInt16(); blitter.h = reader.ReadUInt16(); blitter.gfx_lo = reader.ReadUInt16(); blitter.gfx_hi = reader.ReadUInt16(); blitter.depth = reader.ReadUInt16(); blitter.pen = reader.ReadUInt16(); blitter.flags = reader.ReadUInt16(); MC68000.m1.LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); Timer.global_basetime.seconds = reader.ReadInt32(); Timer.global_basetime.attoseconds = reader.ReadInt64(); Video.screenstate.frame_number = reader.ReadInt64(); Sound.last_update_second = reader.ReadInt32(); Cpuexec.cpu[0].localtime.seconds = reader.ReadInt32(); Cpuexec.cpu[0].localtime.attoseconds = reader.ReadInt64(); Timer.LoadStateBinary(reader); OKI6295.LoadStateBinary(reader); for (i = 0; i < 9; i++) { FMOpl.OPL.P_CH[i].block_fnum = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].kcode = reader.ReadByte(); for (j = 0; j < 2; j++) { FMOpl.OPL.P_CH[i].SLOT[j].ar = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].dr = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].rr = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].KSR = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].ksl = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].ksr = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].mul = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].Cnt = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].FB = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].op1_out[0] = reader.ReadInt32(); FMOpl.OPL.P_CH[i].SLOT[j].op1_out[1] = reader.ReadInt32(); FMOpl.OPL.P_CH[i].SLOT[j].CON = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].eg_type = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].state = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].TL = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].volume = reader.ReadInt32(); FMOpl.OPL.P_CH[i].SLOT[j].sl = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].key = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].AMmask = reader.ReadUInt32(); FMOpl.OPL.P_CH[i].SLOT[j].vib = reader.ReadByte(); FMOpl.OPL.P_CH[i].SLOT[j].wavetable = reader.ReadUInt16(); } } FMOpl.OPL.eg_cnt = reader.ReadUInt32(); FMOpl.OPL.eg_timer = reader.ReadUInt32(); FMOpl.OPL.rhythm = reader.ReadByte(); FMOpl.OPL.lfo_am_depth = reader.ReadByte(); FMOpl.OPL.lfo_pm_depth_range = reader.ReadByte(); FMOpl.OPL.lfo_am_cnt = reader.ReadUInt32(); FMOpl.OPL.lfo_pm_cnt = reader.ReadUInt32(); FMOpl.OPL.noise_rng = reader.ReadUInt32(); FMOpl.OPL.noise_p = reader.ReadUInt32(); FMOpl.OPL.wavesel = reader.ReadByte(); for (i = 0; i < 2; i++) { FMOpl.OPL.T[i] = reader.ReadUInt32(); } for (i = 0; i < 2; i++) { FMOpl.OPL.st[i] = reader.ReadByte(); } FMOpl.OPL.address = reader.ReadByte(); FMOpl.OPL.status = reader.ReadByte(); FMOpl.OPL.statusmask = reader.ReadByte(); FMOpl.OPL.mode = reader.ReadByte(); Sound.okistream.output_sampindex = reader.ReadInt32(); Sound.okistream.output_base_sampindex = reader.ReadInt32(); Sound.ym3812stream.output_sampindex = reader.ReadInt32(); Sound.ym3812stream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); }
public static sbyte MReadByte(int address) { address &= 0xffffff; sbyte result = 0; if (address >= 0 && address <= 0x7ffff) { result = (sbyte)Memory.mainrom[address]; } else if (address >= 0x100000 && address <= 0x103fff) { int offset = address - 0x100000; result = (sbyte)Generic.generic_nvram[offset]; } else if (address >= 0x200000 && address <= 0x200fff) { int offset = (address - 0x200000) / 2; if ((address & 1) == 0) { result = (sbyte)(priority_ram[offset] >> 8); } else if ((address & 1) == 1) { result = (sbyte)priority_ram[offset]; } } else if (address >= 0x400000 && address <= 0x401fff) { int offset = (address - 0x400000) / 2; if ((address & 1) == 0) { result = (sbyte)(paletteram16[offset] >> 8); } else if ((address & 1) == 1) { result = (sbyte)paletteram16[offset]; } } else if (address >= 0x500000 && address <= 0x500001) { if (address == 0x500001) { result = sbytec; } } else if (address >= 0x600000 && address <= 0x600001) { //if (address == 0x600001) { result = (sbyte)OKI6295.okim6295_status_0_lsb_r(); } } else if (address >= 0x800002 && address <= 0x800003) { /*if (address == 0x800002) * { * int i1 = 1; * } * else*/if (address == 0x800003) { result = (sbyte)drgnwrld_igs003_r(); } } else if (address >= 0xa88000 && address <= 0xa88001) { result = (sbyte)igs_3_dips_r(); } return(result); }
public static void MWriteWord(int address, short value) { address &= 0xffffff; if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; Generic.generic_nvram[offset] = (byte)(value >> 8); Generic.generic_nvram[offset + 1] = (byte)value; } else if (address >= 0x200000 && address + 1 <= 0x200fff) { int offset = (address - 0x200000) / 2; priority_ram[offset] = (ushort)value; } else if (address >= 0x400000 && address + 1 <= 0x401fff) { int offset = (address - 0x400000) / 2; igs011_palette(offset, (ushort)value); } else if (address >= 0x600000 && address + 1 <= 0x600001) { OKI6295.okim6295_data_0_lsb_w((byte)value); } else if (address >= 0x700000 && address + 1 <= 0x700001) { igs_YM3812_control_port_0_w((byte)value); } else if (address >= 0x700002 && address + 1 <= 0x700003) { igs_YM3812_write_port_0_w((byte)value); } else if (address >= 0x800000 && address + 1 <= 0x800003) { int offset = (address - 0x800000) / 2; drgnwrld_igs003_w(offset, (ushort)value); } else if (address >= 0xa20000 && address + 1 <= 0xa20001) { igs011_priority_w((ushort)value); } else if (address >= 0xa40000 && address + 1 <= 0xa40001) { igs_dips_w((ushort)value); } else if (address >= 0xa58000 && address + 1 <= 0xa58001) { igs011_blit_x_w((ushort)value); } else if (address >= 0xa58800 && address + 1 <= 0xa58801) { igs011_blit_y_w((ushort)value); } else if (address >= 0xa59000 && address + 1 <= 0xa59001) { igs011_blit_w_w((ushort)value); } else if (address >= 0xa59800 && address + 1 <= 0xa59801) { igs011_blit_h_w((ushort)value); } else if (address >= 0xa5a000 && address + 1 <= 0xa5a001) { igs011_blit_gfx_lo_w((ushort)value); } else if (address >= 0xa5a800 && address + 1 <= 0xa5a801) { igs011_blit_gfx_hi_w((ushort)value); } else if (address >= 0xa5b000 && address + 1 <= 0xa5b001) { igs011_blit_flags_w((ushort)value); } else if (address >= 0xa5b800 && address + 1 <= 0xa5b801) { igs011_blit_pen_w((ushort)value); } else if (address >= 0xa5c000 && address + 1 <= 0xa5c001) { igs011_blit_depth_w((ushort)value); } }
public static void MWriteByte_lhb(int address, sbyte value) { address &= 0xffffff; if (address >= 0x010000 && address <= 0x010001) { if ((address & 1) == 0) { lhb_okibank_w((byte)value); } } else if (address >= 0x100000 && address <= 0x103fff) { int offset = address - 0x100000; Generic.generic_nvram[offset] = (byte)value; } else if (address >= 0x200000 && address <= 0x200fff) { int offset = (address - 0x200000) / 2; if ((address & 1) == 0) { priority_ram[offset] = (ushort)((value << 8) | (priority_ram[offset] & 0xff)); } else if ((address & 1) == 1) { priority_ram[offset] = (ushort)((priority_ram[offset] & 0xff00) | (byte)value); } } else if (address >= 0x300000 && address <= 0x3fffff) { int offset = address - 0x300000; igs011_layers_w(offset, (byte)value); } else if (address >= 0x400000 && address <= 0x401fff) { int offset = address - 0x400000; igs011_palette(offset, (byte)value); } else if (address >= 0x600000 && address <= 0x600001) { if (address == 0x600001) { OKI6295.okim6295_data_0_lsb_w((byte)value); } } else if (address >= 0x700002 && address <= 0x700003) { int offset = address - 0x700002; lhb_inputs_w(offset, (byte)value); } else if (address >= 0x820000 && address <= 0x820001) { int offset = address - 0x820000; igs011_priority_w(offset, (byte)value); } else if (address >= 0x838000 && address <= 0x838001) { int offset = address - 0x838000; lhb_irq_enable_w(offset, (byte)value); } else if (address >= 0x840000 && address <= 0x840001) { int offset = address - 0x840000; igs_dips_w(offset, (byte)value); } else if (address >= 0x858000 && address <= 0x858001) { int offset = address - 0x858000; igs011_blit_x_w(offset, (byte)value); } else if (address >= 0x858800 && address <= 0x858801) { int offset = address - 0x858800; igs011_blit_y_w(offset, (byte)value); } else if (address >= 0x859000 && address <= 0x859001) { int offset = address - 0x859000; igs011_blit_w_w(offset, (byte)value); } else if (address >= 0x859800 && address <= 0x859801) { int offset = address - 0x859800; igs011_blit_h_w(offset, (byte)value); } else if (address >= 0x85a000 && address <= 0x85a001) { int offset = address - 0x85a000; igs011_blit_gfx_lo_w(offset, (byte)value); } else if (address >= 0x85a800 && address <= 0x85a801) { int offset = address - 0x85a800; igs011_blit_gfx_hi_w(offset, (byte)value); } else if (address >= 0x85b000 && address <= 0x85b001) { int i1 = 1; //igs011_blit_flags_w((byte)value); } else if (address >= 0x85b800 && address <= 0x85b801) { int offset = address - 0x85b800; igs011_blit_pen_w(offset, (byte)value); } else if (address >= 0x85c000 && address <= 0x85c001) { int offset = address - 0x85c000; igs011_blit_depth_w(offset, (byte)value); } }