public static byte TILEMAP_FLIPY = TILE_FLIPY; /* draw the tilemap vertically flipped */ public static void tilemap_init() { int i, j; switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": CPS.tilemap_init(); break; case "Namco System 1": Namcos1.tilemap_init(); break; case "PGM": PGM.tilemap_init(); break; case "M72": M72.tilemap_init(); break; case "M92": M92.tilemap_init(); break; } screen_width = 0x200; screen_height = 0x200; priority_bitmap = new byte[0x200, 0x200]; bb01 = new byte[1, 0x200]; bbFF = new byte[0x80, 0x40]; empty_tile = new byte[0x400]; for (i = 0; i < 0x200; i++) { bb01[0, i] = 0x01; } for (i = 0; i < 0x80; i++) { for (j = 0; j < 0x40; j++) { bbFF[i, j] = 0xff; } } for (i = 0; i < 0x400; i++) { empty_tile[i] = 0x0f; } videovisarea.min_x = 0; videovisarea.max_x = 0x1ff; videovisarea.min_y = 0; videovisarea.max_y = 0x1ff; }
public static void machine_start() { switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": Palette.palette_init(); Tilemap.tilemap_init(); Eeprom.eeprom_init(); CPS.video_start_cps(); machine_reset_callback = CPS.machine_reset_cps; break; case "Neo Geo": Neogeo.nvram_handler_load_neogeo(); Neogeo.machine_start_neogeo(); Neogeo.video_start_neogeo(); machine_reset_callback = Neogeo.machine_reset_neogeo; break; case "Namco System 1": Palette.palette_init(); Tilemap.tilemap_init(); Namcos1.driver_init(); Namcos1.video_start_namcos1(); machine_reset_callback = Namcos1.machine_reset_namcos1; break; case "IGS011": Palette.palette_init(); IGS011.video_start_igs011(); machine_reset_callback = IGS011.machine_reset_igs011; break; case "PGM": Palette.palette_init(); Tilemap.tilemap_init(); PGM.device_init(); PGM.video_start_pgm(); machine_reset_callback = PGM.machine_reset_pgm; break; } }
public static void recalc_irq() { int i; bool irq = false; if ((irq_enabled & irq_pending) != 0) { irq = true; } for (i = 0; irq == false && i < 32; i++) { if ((voice2[i].state & V_DONE) != 0) { irq = true; } } if (irq != irq_on) { irq_on = irq; PGM.sound_irq(irq ? (int)LineState.ASSERT_LINE : (int)LineState.CLEAR_LINE); } }
public static sbyte MReadByte(int address) { address &= 0xffffff; sbyte result = 0; if (address >= 0 && address <= 0x1ffff) { result = (sbyte)(mainbiosrom[address]); } else if (address >= 0x100000 && address <= 0x3fffff) { if (address < 0x100000 + Memory.mainrom.Length) { result = (sbyte)(Memory.mainrom[address - 0x100000]); } else { result = 0; } } else if (address >= 0x800000 && address <= 0x81ffff) { result = (sbyte)Memory.mainram[address - 0x800000]; } else if (address >= 0x900000 && address <= 0x903fff) { result = (sbyte)pgm_bg_videoram[address - 0x900000]; } else if (address >= 0x904000 && address <= 0x905fff) { result = (sbyte)pgm_tx_videoram[address - 0x904000]; } else if (address >= 0x907000 && address <= 0x9077ff) { result = (sbyte)pgm_rowscrollram[address - 0x907000]; } else if (address >= 0xa00000 && address <= 0xa011ff) { int offset = (address - 0xa00000) / 2; if ((address % 2) == 0) { result = (sbyte)(Generic.paletteram16[offset] >> 8); } else if ((address % 2) == 1) { result = (sbyte)(Generic.paletteram16[offset]); } } else if (address >= 0xb00000 && address <= 0xb0ffff) { result = (sbyte)pgm_videoregs[address - 0xb00000]; } else if (address >= 0xc00002 && address <= 0xc00003) { result = (sbyte)Sound.latched_value[0]; } else if (address >= 0xc00004 && address <= 0xc00005) { result = (sbyte)Sound.latched_value[1]; } else if (address >= 0xc00006 && address <= 0xc00007) { result = (sbyte)PGM.pgm_calendar_r(); } else if (address >= 0xc0000c && address <= 0xc0000d) { result = (sbyte)Sound.latched_value[2]; } else if (address >= 0xc08000 && address <= 0xc08001) { result = (sbyte)short0; } else if (address >= 0xc08002 && address <= 0xc08003) { result = (sbyte)short1; } else if (address >= 0xc08004 && address <= 0xc08005) { result = (sbyte)short2; } else if (address >= 0xc08006 && address <= 0xc08007) { result = (sbyte)short3; } else if (address >= 0xc10000 && address <= 0xc1ffff) { result = (sbyte)z80_ram_r(address - 0xc10000); } return(result); }
public static short MReadWord(int address) { address &= 0xffffff; short result = 0; if (address >= 0 && address + 1 <= 0x1ffff) { result = (short)(mainbiosrom[address] * 0x100 + mainbiosrom[address + 1]); } else if (address >= 0x100000 && address + 1 <= 0x3fffff) { if (address + 1 < 0x100000 + Memory.mainrom.Length) { result = (short)(Memory.mainrom[address - 0x100000] * 0x100 + Memory.mainrom[address - 0x100000 + 1]); } else { result = 0; } } else if (address >= 0x800000 && address + 1 <= 0x81ffff) { result = (short)(Memory.mainram[address - 0x800000] * 0x100 + Memory.mainram[address - 0x800000 + 1]); } else if (address >= 0x900000 && address + 1 <= 0x903fff) { result = (short)(pgm_bg_videoram[address - 0x900000] * 0x100 + pgm_bg_videoram[address - 0x900000 + 1]); } else if (address >= 0x904000 && address + 1 <= 0x905fff) { result = (short)(pgm_tx_videoram[address - 0x904000] * 0x100 + pgm_tx_videoram[address - 0x904000 + 1]); } else if (address >= 0x907000 && address + 1 <= 0x9077ff) { result = (short)(pgm_rowscrollram[address - 0x907000] * 0x100 + pgm_rowscrollram[address - 0x907000 + 1]); } else if (address >= 0xa00000 && address + 1 <= 0xa011ff) { int offset = (address - 0xa0000) / 2; result = (short)Generic.paletteram16[offset]; } else if (address >= 0xb00000 && address + 1 <= 0xb0ffff) { result = (short)(pgm_videoregs[address - 0xb00000] * 0x100 + pgm_videoregs[address - 0xb00000 + 1]); } else if (address >= 0xc00002 && address + 1 <= 0xc00003) { result = (short)Sound.latched_value[0]; } else if (address >= 0xc00004 && address + 1 <= 0xc00005) { result = (short)Sound.latched_value[1]; } else if (address >= 0xc00006 && address + 1 <= 0xc00007) { result = (short)PGM.pgm_calendar_r(); } else if (address >= 0xc0000c && address + 1 <= 0xc0000d) { result = (short)Sound.latched_value[2]; } else if (address >= 0xc08000 && address + 1 <= 0xc08001) { result = short0; } else if (address >= 0xc08002 && address + 1 <= 0xc08003) { result = short1; } else if (address >= 0xc08004 && address + 1 <= 0xc08005) { result = short2; } else if (address >= 0xc08006 && address + 1 <= 0xc08007) { result = short3; } else if (address >= 0xc10000 && address + 1 <= 0xc1ffff) { result = (short)(z80_ram_r(address - 0xc10000) * 0x100 + z80_ram_r(address - 0xc10000 + 1)); } return(result); }