summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/luaengine.cpp
diff options
context:
space:
mode:
author dankan1890 <mewuidev2@gmail.com>2016-02-13 02:42:38 +0100
committer dankan1890 <mewuidev2@gmail.com>2016-02-13 02:42:38 +0100
commitae6a55f07554860fb4050ef21df16af7579cd12e (patch)
treed8927916d99b6d0407b479e528324fe566f5d579 /src/emu/luaengine.cpp
parent548da52a7d721a3a4d9b845ec503d82a0cbc50bc (diff)
Grouped display of DAT file information in a single view. (WIP) nw
Diffstat (limited to 'src/emu/luaengine.cpp')
0 files changed, 0 insertions, 0 deletions
'>99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
/***********************************************************************
 PGM IGS027A (55857F* type) ARM protection emulation
  *guess, the part number might not be directly tied to behavior, see note below

 these are emulation of the 'kov2' type ARM device
 used by

 Knights of Valor 2 (kov2)
 Knights of Valor 2 Nine Dragons (kov2p) *
 DoDonPachi 2 - Bee Storm (ddp2)
 Martial Masters (martmast)
 Dragon World 2001 (dw2001)
 Dragon World Pretty Chance (dwpc) (verified to be the same internal rom as dw2001)

 * using a hacked kov2 internal ROM
 ----

  These games use a larger region of shared RAM than the 55857E
  type and have a communication based on interrupts

 ----

 All of these games have an external ARM rom.

 The external ARM roms are encrypted, the internal ARM rom uploads
 the decryption tables.

 Game Region is supplied by internal ARM rom.

 ***********************************************************************/

#include "emu.h"
#include "includes/pgm.h"


static READ32_HANDLER( arm7_latch_arm_r )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	state->m_prot->set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE ); // guess

	if (PGMARM7LOGERROR)
		logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_kov2_latchdata_68k_w, mem_mask, space.device().safe_pc());
	return state->m_kov2_latchdata_68k_w;
}

static WRITE32_HANDLER( arm7_latch_arm_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	if (PGMARM7LOGERROR)
		logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, space.device().safe_pc());

	COMBINE_DATA(&state->m_kov2_latchdata_arm_w);
}

static READ32_HANDLER( arm7_shareram_r )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	if (PGMARM7LOGERROR)
		logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, space.device().safe_pc());
	return state->m_arm7_shareram[offset];
}

static WRITE32_HANDLER( arm7_shareram_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	if (PGMARM7LOGERROR)
		logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, space.device().safe_pc());
	COMBINE_DATA(&state->m_arm7_shareram[offset]);
}

static READ16_HANDLER( arm7_latch_68k_r )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	if (PGMARM7LOGERROR)
		logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_kov2_latchdata_arm_w & 0x0000ffff, mem_mask, space.device().safe_pc());
	return state->m_kov2_latchdata_arm_w;
}

static WRITE16_HANDLER( arm7_latch_68k_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();

	if (PGMARM7LOGERROR)
		logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, space.device().safe_pc());
	COMBINE_DATA(&state->m_kov2_latchdata_68k_w);

	state->m_prot->set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE ); // guess
}

static READ16_HANDLER( arm7_ram_r )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());

	if (PGMARM7LOGERROR)
		logerror("M68K: ARM7 Shared RAM Read: %04x = %04x (%08x) (%06x)\n", BYTE_XOR_LE(offset), share16[BYTE_XOR_LE(offset)], mem_mask, space.device().safe_pc());
	return share16[BYTE_XOR_LE(offset)];
}

static WRITE16_HANDLER( arm7_ram_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());

	if (PGMARM7LOGERROR)
		logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, space.device().safe_pc());
	COMBINE_DATA(&share16[BYTE_XOR_LE(offset)]);
}

/* 55857F? */
/* Knights of Valor 2, Martial Masters, DoDonpachi 2 */
/*  no execute only space? */
static ADDRESS_MAP_START( kov2_mem, AS_PROGRAM, 16, pgm_arm_type2_state )
	AM_IMPORT_FROM(pgm_mem)
	AM_RANGE(0x100000, 0x5fffff) AM_ROMBANK("bank1") /* Game ROM */
	AM_RANGE(0xd00000, 0xd0ffff) AM_READWRITE_LEGACY(arm7_ram_r, arm7_ram_w) /* ARM7 Shared RAM */
	AM_RANGE(0xd10000, 0xd10001) AM_READWRITE_LEGACY(arm7_latch_68k_r, arm7_latch_68k_w) /* ARM7 Latch */
ADDRESS_MAP_END


static ADDRESS_MAP_START( 55857F_arm7_map, AS_PROGRAM, 32, pgm_arm_type2_state )
	AM_RANGE(0x00000000, 0x00003fff) AM_ROM
	AM_RANGE(0x08000000, 0x083fffff) AM_ROM AM_REGION("user1", 0)
	AM_RANGE(0x10000000, 0x100003ff) AM_RAM
	AM_RANGE(0x18000000, 0x1800ffff) AM_RAM AM_SHARE("arm_ram")
	AM_RANGE(0x38000000, 0x38000003) AM_READWRITE_LEGACY(arm7_latch_arm_r, arm7_latch_arm_w) /* 68k Latch */
	AM_RANGE(0x48000000, 0x4800ffff) AM_READWRITE_LEGACY(arm7_shareram_r, arm7_shareram_w) AM_SHARE("arm7_shareram")
	AM_RANGE(0x50000000, 0x500003ff) AM_RAM
ADDRESS_MAP_END

MACHINE_START_MEMBER(pgm_arm_type2_state,pgm_arm_type2)
{
	MACHINE_START_CALL_MEMBER(pgm);

	m_prot = machine().device<cpu_device>("prot");

	/* register type specific Save State stuff here */

}

/******* ARM 55857F *******/

MACHINE_CONFIG_START( pgm_arm_type2, pgm_arm_type2_state )
	MCFG_FRAGMENT_ADD(pgmbase)

	MCFG_MACHINE_START_OVERRIDE(pgm_arm_type2_state, pgm_arm_type2 )

	MCFG_CPU_MODIFY("maincpu")
	MCFG_CPU_PROGRAM_MAP(kov2_mem)

	/* protection CPU */
	MCFG_CPU_ADD("prot", ARM7, 20000000)	// 55857F
	MCFG_CPU_PROGRAM_MAP(55857F_arm7_map)
MACHINE_CONFIG_END




static void kov2_latch_init( running_machine &machine )
{
	pgm_arm_type2_state *state = machine.driver_data<pgm_arm_type2_state>();

	state->m_kov2_latchdata_68k_w = 0;
	state->m_kov2_latchdata_arm_w = 0;

	state->save_item(NAME(state->m_kov2_latchdata_68k_w));
	state->save_item(NAME(state->m_kov2_latchdata_arm_w));
}

static WRITE32_HANDLER( kov2_arm_region_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	int pc = space.device().safe_pc();
	int regionhack = state->ioport("RegionHack")->read();
	if (pc==0x190 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0);
	COMBINE_DATA(&state->m_arm7_shareram[0x138/4]);
}

DRIVER_INIT_MEMBER(pgm_arm_type2_state,kov2)
{
	pgm_basic_init(machine());
	pgm_kov2_decrypt(machine());
	kov2_latch_init(machine());

	// we only have a HK internal ROM dumped for now, allow us to override that for debugging purposes.
	machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
}


DRIVER_INIT_MEMBER(pgm_arm_type2_state,kov2p)
{
	// this hacks the identification of the kov2 rom to return the string required for kov2p
	// this isn't guaranteed to work properly (and definitely wouldn't on real hardware due to the internal
	// ROM uploading the encryption table)  The internal ROM should be dumped properly.
	pgm_basic_init(machine());
	pgm_kov2p_decrypt(machine());
	kov2_latch_init(machine());

	UINT8 *mem8 = (UINT8 *)machine().root_device().memregion("user1")->base();
	mem8[0xDE] = 0xC0;
	mem8[0xDF] = 0x46;
	mem8[0x4ED8] = 0xA8;// B0
	mem8[0x4EDC] = 0x9C;// A4
	mem8[0x4EE0] = 0x5C;// 64
	mem8[0x4EE4] = 0x94;// 9C
	mem8[0x4EE8] = 0xE8;// F0
	mem8[0x4EEC] = 0x6C;// 74
	mem8[0x4EF0] = 0xD4;// DC
	mem8[0x4EF4] = 0x50;// 58
	mem8[0x4EF8] = 0x80;// 88
	mem8[0x4EFC] = 0x9C;// A4
	mem8[0x4F00] = 0x28;// 30
	mem8[0x4F04] = 0x30;// 38
	mem8[0x4F08] = 0x34;// 3C
	mem8[0x4F0C] = 0x1C;// 24
	mem8[0x1FFFFC] = 0x33;
	mem8[0x1FFFFD] = 0x99;

	// we only have a HK internal ROM dumped for now, allow us to override that for debugging purposes.
	machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
}

static WRITE32_HANDLER( martmast_arm_region_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	int pc = space.device().safe_pc();
	int regionhack = state->ioport("RegionHack")->read();
	if (pc==0x170 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0);
	COMBINE_DATA(&state->m_arm7_shareram[0x138/4]);
}


DRIVER_INIT_MEMBER(pgm_arm_type2_state,martmast)
{
	pgm_basic_init(machine());
	pgm_mm_decrypt(machine());
	kov2_latch_init(machine());

	// we only have a USA / CHINA internal ROMs dumped for now, allow us to override that for debugging purposes.
	machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(martmast_arm_region_w));
}


static WRITE32_HANDLER( ddp2_arm_region_w )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	int pc = space.device().safe_pc();
	int regionhack = state->ioport("RegionHack")->read();
	if (pc==0x0174 && regionhack != 0xff) data = (data & 0x0000ffff) | (regionhack << 16);
	COMBINE_DATA(&state->m_arm7_shareram[0x0]);
}

static READ32_HANDLER( ddp2_speedup_r )
{
	pgm_arm_type2_state *state = space.machine().driver_data<pgm_arm_type2_state>();
	int pc = space.device().safe_pc();
	UINT32 data = state->m_arm_ram[0x300c/4];

	if (pc==0x080109b4)
	{
		/* if we've hit the loop where this is read and both values are 0 then the only way out is an interrupt */
		int r4 = (space.device().state().state_int(ARM7_R4));
		r4 += 0xe;

		if (r4==0x18002f9e)
		{
			UINT32 data2 =  state->m_arm_ram[0x2F9C/4]&0xffff0000;
			if ((data==0x00000000) && (data2==0x00000000)) space.device().execute().spin_until_interrupt();
		}
	}

	return data;
}

static READ16_HANDLER( ddp2_main_speedup_r )
{
	pgm_state *state = space.machine().driver_data<pgm_state>();
	UINT16 data = state->m_mainram[0x0ee54/2];
	int pc = space.device().safe_pc();

	if (pc == 0x149dce) space.device().execute().spin_until_interrupt();
	if (pc == 0x149cfe) space.device().execute().spin_until_interrupt();

	return data;

}

DRIVER_INIT_MEMBER(pgm_arm_type2_state,ddp2)
{
	pgm_basic_init(machine());
	pgm_ddp2_decrypt(machine());
	kov2_latch_init(machine());

	// we only have a Japan internal ROM dumped for now, allow us to override that for debugging purposes.
	machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000000, 0x48000003, FUNC(ddp2_arm_region_w));

	machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1800300c, 0x1800300f, FUNC(ddp2_speedup_r));
	machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x80ee54, 0x80ee55, FUNC(ddp2_main_speedup_r));
}


DRIVER_INIT_MEMBER(pgm_arm_type2_state,dw2001)
{
	pgm_basic_init(machine());
	kov2_latch_init(machine());
	pgm_mm_decrypt(machine()); // encryption is the same as martial masters
}

DRIVER_INIT_MEMBER(pgm_arm_type2_state,dwpc)
{
	pgm_basic_init(machine());
	kov2_latch_init(machine());
	pgm_mm_decrypt(machine()); // encryption is the same as martial masters
}

INPUT_PORTS_START( ddp2 )
	PORT_INCLUDE ( pgm )

	PORT_START("RegionHack")	/* Region - actually supplied by protection device */
	PORT_CONFNAME( 0x00ff, 0x00ff, DEF_STR( Region ) )
	PORT_CONFSETTING(      0x0000, DEF_STR( China ) )
	PORT_CONFSETTING(      0x0001, DEF_STR( Taiwan ) )
	PORT_CONFSETTING(      0x0002, "Japan (Cave license)" )
	PORT_CONFSETTING(      0x0003, DEF_STR( Korea ) )
	PORT_CONFSETTING(      0x0004, DEF_STR( Hong_Kong ) )
	PORT_CONFSETTING(      0x0005, DEF_STR( World ) )
	PORT_CONFSETTING(      0x00ff, "Untouched" ) // don't hack the region
INPUT_PORTS_END

INPUT_PORTS_START( kov2 )
	PORT_INCLUDE ( pgm )

	PORT_START("RegionHack")	/* Region - actually supplied by protection device */
	PORT_CONFNAME( 0x00ff, 0x00ff, DEF_STR( Region ) )
	PORT_CONFSETTING(      0x0000, DEF_STR( China ) )
	PORT_CONFSETTING(      0x0001, DEF_STR( Taiwan ) )
	PORT_CONFSETTING(      0x0002, "Japan (Cave license)" )
	PORT_CONFSETTING(      0x0003, DEF_STR( Korea ) )
	PORT_CONFSETTING(      0x0004, DEF_STR( Hong_Kong ) )
	PORT_CONFSETTING(      0x0005, DEF_STR( World ) )
	PORT_CONFSETTING(      0x00ff, "Untouched" ) // don't hack the region
INPUT_PORTS_END

INPUT_PORTS_START( martmast )
	PORT_INCLUDE ( pgm )

	PORT_START("RegionHack")	/* Region - actually supplied by protection device */
	PORT_CONFNAME( 0x00ff, 0x00ff, DEF_STR( Region ) )
	PORT_CONFSETTING(      0x0000, DEF_STR( China ) )
	PORT_CONFSETTING(      0x0001, DEF_STR( Taiwan ) )
	PORT_CONFSETTING(      0x0002, DEF_STR( Japan ) )
	PORT_CONFSETTING(      0x0003, DEF_STR( Korea ) )
	PORT_CONFSETTING(      0x0004, DEF_STR( Hong_Kong ) )
	PORT_CONFSETTING(      0x0005, DEF_STR( World ) )
	PORT_CONFSETTING(      0x0006, DEF_STR( USA ) )
	PORT_CONFSETTING(      0x00ff, "Untouched" ) // don't hack the region
INPUT_PORTS_END


INPUT_PORTS_START( dw2001 )
	PORT_INCLUDE ( pgm )

	PORT_MODIFY("Region")	/* Region - supplied by protection device */
	PORT_CONFNAME( 0x000f, 0x0005, DEF_STR( Region ) )
	PORT_CONFSETTING(      0x0000, DEF_STR( China ) )
	PORT_CONFSETTING(      0x0001, DEF_STR( Taiwan ) )
	PORT_CONFSETTING(      0x0002, "Japan (Alta license)" )
	PORT_CONFSETTING(      0x0003, DEF_STR( Korea ) )
	PORT_CONFSETTING(      0x0004, DEF_STR( Hong_Kong ) )
	PORT_CONFSETTING(      0x0005, DEF_STR( World ) )
INPUT_PORTS_END
= 0; } // printf("m82_gfx_ctrl_w %04x\n", data); } WRITE16_MEMBER(m72_state::m82_tm_ctrl_w) { COMBINE_DATA(&m_m82_tmcontrol); // printf("tmcontrol %04x\n", m_m82_tmcontrol); } /*************************************************************************** Display refresh ***************************************************************************/ void m72_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { UINT16 *spriteram = m_buffered_spriteram.get(); int offs; offs = 0; while (offs < m_spriteram.bytes()/2) { int code,color,sx,sy,flipx,flipy,w,h,x,y; code = spriteram[offs+1]; color = spriteram[offs+2] & 0x0f; sx = -256+(spriteram[offs+3] & 0x3ff); sy = 384-(spriteram[offs+0] & 0x1ff); flipx = spriteram[offs+2] & 0x0800; flipy = spriteram[offs+2] & 0x0400; w = 1 << ((spriteram[offs+2] & 0xc000) >> 14); h = 1 << ((spriteram[offs+2] & 0x3000) >> 12); sy -= 16 * h; if (flip_screen()) { sx = 512 - 16*w - sx; sy = 284 - 16*h - sy; flipx = !flipx; flipy = !flipy; } for (x = 0;x < w;x++) { for (y = 0;y < h;y++) { int c = code; if (flipx) c += 8*(w-1-x); else c += 8*x; if (flipy) c += h-1-y; else c += y; m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, c, color, flipx,flipy, sx + 16*x,sy + 16*y,0); } } offs += w*4; } } void m72_state::majtitle_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { UINT16 *spriteram16_2 = m_spriteram2; int offs; for (offs = 0;offs < m_spriteram.bytes();offs += 4) { int code,color,sx,sy,flipx,flipy,w,h,x,y; code = spriteram16_2[offs+1]; color = spriteram16_2[offs+2] & 0x0f; sx = -256+(spriteram16_2[offs+3] & 0x3ff); sy = 384-(spriteram16_2[offs+0] & 0x1ff); flipx = spriteram16_2[offs+2] & 0x0800; flipy = spriteram16_2[offs+2] & 0x0400; w = 1;// << ((spriteram16_2[offs+2] & 0xc000) >> 14); h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12); sy -= 16 * h; if (flip_screen()) { sx = 512 - 16*w - sx; sy = 256 - 16*h - sy; flipx = !flipx; flipy = !flipy; } for (x = 0;x < w;x++) { for (y = 0;y < h;y++) { int c = code; if (flipx) c += 8*(w-1-x); else c += 8*x; if (flipy) c += h-1-y; else c += y; m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, c, color, flipx,flipy, sx + 16*x,sy + 16*y,0); } } } } UINT32 m72_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if (m_video_off) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; } m_fg_tilemap->set_scrollx(0,m_scrollx1); m_fg_tilemap->set_scrolly(0,m_scrolly1); m_bg_tilemap->set_scrollx(0,m_scrollx2); m_bg_tilemap->set_scrolly(0,m_scrolly2); m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); draw_sprites(bitmap,cliprect); m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); return 0; } UINT32 m72_state::screen_update_m81(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // on M81 the FG data always comes from the Ax roms // the source of the BG data however depends on Jumper J3 int J3 = m_m81_b_b_j3->read(); if (J3 == 0) m_bg_source = 1; else m_bg_source = 2; return screen_update(screen, bitmap, cliprect); } UINT32 m72_state::screen_update_m82(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int i; tilemap_t* tm; if (m_m82_tmcontrol & 0x40) tm = m_bg_tilemap_large; else tm = m_bg_tilemap; if (m_video_off) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; } m_fg_tilemap->set_scrollx(0,m_scrollx1); m_fg_tilemap->set_scrolly(0,m_scrolly1); if (m_m82_rowscroll) { tm->set_scroll_rows(512); for (i = 0;i < 512;i++) tm->set_scrollx((i+m_scrolly2)&0x1ff, 256 + m_m82_rowscrollram[i]); } else { tm->set_scroll_rows(1); tm->set_scrollx(0,256 + m_scrollx2); } tm->set_scrolly(0,m_scrolly2); tm->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); majtitle_draw_sprites(bitmap,cliprect); draw_sprites(bitmap,cliprect); tm->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); return 0; }