This commit is contained in:
Barry Harris 2018-11-15 09:42:11 +00:00
commit 21bb0131a7
4 changed files with 800 additions and 809 deletions

View File

@ -866,12 +866,12 @@ static INT32 alt2_kludge(UINT32 /*offset*/)
{ {
static const SekRegister SekRegs1[8] = { SEK_REG_A0, SEK_REG_A1, SEK_REG_A2, SEK_REG_A3, SEK_REG_A4, SEK_REG_A5, SEK_REG_A6, SEK_REG_A7 }; static const SekRegister SekRegs1[8] = { SEK_REG_A0, SEK_REG_A1, SEK_REG_A2, SEK_REG_A3, SEK_REG_A4, SEK_REG_A5, SEK_REG_A6, SEK_REG_A7 };
/* first verify that the prefetched PC matches the first alternate */ UINT32 pc = SekDbgGetRegister(SEK_REG_PPC);
if (MATCHES_MASK_VALUE((INT32)(SekGetPC(-1) >> 1), slapstic.alt1)) /* first verify that the prefetched PC matches the first alternate */
if (MATCHES_MASK_VALUE((INT32)((pc+2) >> 1), slapstic.alt1))
{ {
/* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */ /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */
UINT16 opcode = SekFetchWord((SekGetPC(-1) - 4) & 0xffffff); // IQ_132 check this! UINT16 opcode = SekReadWord(pc);
// UINT16 opcode = space->direct().read_decrypted_word(cpu_get_previouspc(&space->device()) & 0xffffff);
if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148) if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148)
{ {
/* fetch the value of the register for the second operand, and see */ /* fetch the value of the register for the second operand, and see */

View File

@ -204,7 +204,7 @@ static struct BurnDIPInfo bestbestDIPList[]=
{ {
{0x1a, 0xff, 0xff, 0xff, NULL }, {0x1a, 0xff, 0xff, 0xff, NULL },
{0x1b, 0xff, 0xff, 0xff, NULL }, {0x1b, 0xff, 0xff, 0xff, NULL },
{0x1a, 0xfe, 0, 8, "Coinage" }, {0x1a, 0xfe, 0, 8, "Coinage" },
{0x1a, 0x01, 0x07, 0x00, "5C 1C" }, {0x1a, 0x01, 0x07, 0x00, "5C 1C" },
{0x1a, 0x01, 0x07, 0x01, "4C 1C" }, {0x1a, 0x01, 0x07, 0x01, "4C 1C" },
@ -430,7 +430,7 @@ static void suna_palette_write(INT32 offset)
//------------------ //------------------
// 68k // 68k
UINT16 __fastcall bestbest_read_word(UINT32 address) static UINT16 __fastcall bestbest_read_word(UINT32 address)
{ {
switch (address & ~1) switch (address & ~1)
{ {
@ -447,7 +447,7 @@ UINT16 __fastcall bestbest_read_word(UINT32 address)
return 0; return 0;
} }
UINT8 __fastcall bestbest_read_byte(UINT32 address) static UINT8 __fastcall bestbest_read_byte(UINT32 address)
{ {
switch (address) switch (address)
{ {
@ -470,7 +470,7 @@ UINT8 __fastcall bestbest_read_byte(UINT32 address)
return 0; return 0;
} }
void __fastcall bestbest_write_word(UINT32 address, UINT16 data) static void __fastcall bestbest_write_word(UINT32 address, UINT16 data)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
*((UINT16*)(DrvPalRAM + (address & 0x0fff))) = BURN_ENDIAN_SWAP_INT16(data); *((UINT16*)(DrvPalRAM + (address & 0x0fff))) = BURN_ENDIAN_SWAP_INT16(data);
@ -492,7 +492,7 @@ void __fastcall bestbest_write_word(UINT32 address, UINT16 data)
return; return;
} }
void __fastcall bestbest_write_byte(UINT32 address, UINT8 data) static void __fastcall bestbest_write_byte(UINT32 address, UINT8 data)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
DrvPalRAM[address & 0xfff] = data; DrvPalRAM[address & 0xfff] = data;
@ -528,7 +528,7 @@ void __fastcall bestbest_write_byte(UINT32 address, UINT8 data)
//------------------ //------------------
// Z80 #0 // Z80 #0
void __fastcall bestbest_sound0_write(UINT16 address, UINT8 data) static void __fastcall bestbest_sound0_write(UINT16 address, UINT8 data)
{ {
switch (address) switch (address)
{ {
@ -550,7 +550,7 @@ void __fastcall bestbest_sound0_write(UINT16 address, UINT8 data)
return; return;
} }
UINT8 __fastcall bestbest_sound0_read(UINT16 address) static UINT8 __fastcall bestbest_sound0_read(UINT16 address)
{ {
switch (address) switch (address)
{ {
@ -564,21 +564,21 @@ UINT8 __fastcall bestbest_sound0_read(UINT16 address)
//------------------ //------------------
// Z80 #1 // Z80 #1
void __fastcall bestbest_sound1_out(UINT16 port, UINT8 data) static void __fastcall bestbest_sound1_out(UINT16 port, UINT8 data)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } case 0x00: { DACSignedWrite(0, (data & 0xf) * 0x11); return; }
case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } case 0x01: { DACSignedWrite(1, (data & 0xf) * 0x11); return; }
case 0x02: { DACWrite(2, (data & 0xf) * 0x11); return; } case 0x02: { DACSignedWrite(2, (data & 0xf) * 0x11); return; }
case 0x03: { DACWrite(3, (data & 0xf) * 0x11); return; } case 0x03: { DACSignedWrite(3, (data & 0xf) * 0x11); return; }
} }
return; return;
} }
UINT8 __fastcall bestbest_sound1_in(UINT16 port) static UINT8 __fastcall bestbest_sound1_in(UINT16 port)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
@ -597,7 +597,7 @@ UINT8 __fastcall bestbest_sound1_in(UINT16 port)
//------------------ //------------------
// 68k // 68k
UINT16 __fastcall sunaq_read_word(UINT32 address) static UINT16 __fastcall sunaq_read_word(UINT32 address)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
if (address & 0x200) { if (address & 0x200) {
@ -626,7 +626,7 @@ UINT16 __fastcall sunaq_read_word(UINT32 address)
return 0; return 0;
} }
UINT8 __fastcall sunaq_read_byte(UINT32 address) static UINT8 __fastcall sunaq_read_byte(UINT32 address)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
if (address & 0x200) { if (address & 0x200) {
@ -649,7 +649,7 @@ UINT8 __fastcall sunaq_read_byte(UINT32 address)
case 0x500004: case 0x500004:
case 0x500005: case 0x500005:
return DrvInputs[2] >> ((~address & 1) << 3); return DrvInputs[2] >> ((~address & 1) << 3);
case 0x500006: case 0x500006:
case 0x500007: case 0x500007:
@ -659,7 +659,7 @@ UINT8 __fastcall sunaq_read_byte(UINT32 address)
return 0; return 0;
} }
void __fastcall sunaq_write_word(UINT32 address, UINT16 data) static void __fastcall sunaq_write_word(UINT32 address, UINT16 data)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
if (address & 0x200) { if (address & 0x200) {
@ -690,7 +690,7 @@ void __fastcall sunaq_write_word(UINT32 address, UINT16 data)
return; return;
} }
void __fastcall sunaq_write_byte(UINT32 address, UINT8 data) static void __fastcall sunaq_write_byte(UINT32 address, UINT8 data)
{ {
if ((address & 0xfff000) == 0x540000) { if ((address & 0xfff000) == 0x540000) {
if (address & 0x200) { if (address & 0x200) {
@ -728,7 +728,7 @@ void __fastcall sunaq_write_byte(UINT32 address, UINT8 data)
//------------------ //------------------
// Z80 #0 // Z80 #0
void __fastcall sunaq_sound0_write(UINT16 address, UINT8 data) static void __fastcall sunaq_sound0_write(UINT16 address, UINT8 data)
{ {
switch (address) switch (address)
{ {
@ -793,7 +793,7 @@ static void uballoon_prot_write(UINT16 offset, UINT8 data)
} }
} }
UINT16 __fastcall uballoon_read_word(UINT32 address) static UINT16 __fastcall uballoon_read_word(UINT32 address)
{ {
if ((address & 0xfff000) == 0x200000) { if ((address & 0xfff000) == 0x200000) {
if (address & 0x200) { if (address & 0x200) {
@ -822,7 +822,7 @@ UINT16 __fastcall uballoon_read_word(UINT32 address)
return 0; return 0;
} }
UINT8 __fastcall uballoon_read_byte(UINT32 address) static UINT8 __fastcall uballoon_read_byte(UINT32 address)
{ {
if ((address & 0xff0000) == 0xa00000) { if ((address & 0xff0000) == 0xa00000) {
return uballoon_prot_read(address); return uballoon_prot_read(address);
@ -859,7 +859,7 @@ UINT8 __fastcall uballoon_read_byte(UINT32 address)
return 0; return 0;
} }
void __fastcall uballoon_write_word(UINT32 address, UINT16 data) static void __fastcall uballoon_write_word(UINT32 address, UINT16 data)
{ {
if ((address & 0xfff000) == 0x200000) { if ((address & 0xfff000) == 0x200000) {
if (address & 0x200) { if (address & 0x200) {
@ -886,7 +886,7 @@ void __fastcall uballoon_write_word(UINT32 address, UINT16 data)
return; return;
} }
void __fastcall uballoon_write_byte(UINT32 address, UINT8 data) static void __fastcall uballoon_write_byte(UINT32 address, UINT8 data)
{ {
if ((address & 0xfff000) == 0x200000) { if ((address & 0xfff000) == 0x200000) {
if (address & 0x200) { if (address & 0x200) {
@ -928,17 +928,16 @@ static void uballoon_bankswitch(INT32 data)
z80bankdata[0] = data; z80bankdata[0] = data;
INT32 bank = ((data & 1) << 16) | 0x400; INT32 bank = ((data & 1) << 16) | 0x400;
ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + bank); ZetMapMemory(DrvZ80ROM1 + bank, 0x0400, 0xffff, MAP_ROM);
ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + bank);
} }
void __fastcall uballoon_sound1_out(UINT16 port, UINT8 data) static void __fastcall uballoon_sound1_out(UINT16 port, UINT8 data)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } case 0x00: { DACSignedWrite(0, (data & 0xf) * 0x11); return; }
case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } case 0x01: { DACSignedWrite(1, (data & 0xf) * 0x11); return; }
case 0x03: case 0x03:
uballoon_bankswitch(data); uballoon_bankswitch(data);
@ -948,7 +947,7 @@ void __fastcall uballoon_sound1_out(UINT16 port, UINT8 data)
return; return;
} }
UINT8 __fastcall uballoon_sound1_in(UINT16 port) static UINT8 __fastcall uballoon_sound1_in(UINT16 port)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
@ -967,7 +966,7 @@ UINT8 __fastcall uballoon_sound1_in(UINT16 port)
//------------------ //------------------
// 68k // 68k
UINT16 __fastcall bssoccer_read_word(UINT32 address) static UINT16 __fastcall bssoccer_read_word(UINT32 address)
{ {
if ((address & 0xfff000) == 0x400000) { if ((address & 0xfff000) == 0x400000) {
if (address & 0x200) { if (address & 0x200) {
@ -1003,7 +1002,7 @@ UINT16 __fastcall bssoccer_read_word(UINT32 address)
return 0; return 0;
} }
UINT8 __fastcall bssoccer_read_byte(UINT32 address) static UINT8 __fastcall bssoccer_read_byte(UINT32 address)
{ {
if ((address & 0xfff000) == 0x400000) { if ((address & 0xfff000) == 0x400000) {
if (address & 0x200) { if (address & 0x200) {
@ -1044,7 +1043,7 @@ UINT8 __fastcall bssoccer_read_byte(UINT32 address)
return 0; return 0;
} }
void __fastcall bssoccer_write_word(UINT32 address, UINT16 data) static void __fastcall bssoccer_write_word(UINT32 address, UINT16 data)
{ {
if ((address & 0xfff000) == 0x400000) { if ((address & 0xfff000) == 0x400000) {
if (address & 0x200) { if (address & 0x200) {
@ -1071,7 +1070,7 @@ void __fastcall bssoccer_write_word(UINT32 address, UINT16 data)
return; return;
} }
void __fastcall bssoccer_write_byte(UINT32 address, UINT8 data) static void __fastcall bssoccer_write_byte(UINT32 address, UINT8 data)
{ {
if ((address & 0xfff000) == 0x400000) { if ((address & 0xfff000) == 0x400000) {
if (address & 0x200) { if (address & 0x200) {
@ -1109,11 +1108,10 @@ static void bssoccer_bankswitch_w(UINT8 *z80data, INT32 p, INT32 data)
INT32 bank = ((data & 7) << 16) | 0x1000; INT32 bank = ((data & 7) << 16) | 0x1000;
ZetMapArea(0x1000, 0xffff, 0, z80data + bank); ZetMapMemory(z80data + bank, 0x1000, 0xffff, MAP_ROM);
ZetMapArea(0x1000, 0xffff, 2, z80data + bank);
} }
void __fastcall bssoccer_sound0_write(UINT16 address, UINT8 data) static void __fastcall bssoccer_sound0_write(UINT16 address, UINT8 data)
{ {
switch (address) switch (address)
{ {
@ -1137,7 +1135,7 @@ void __fastcall bssoccer_sound0_write(UINT16 address, UINT8 data)
return; return;
} }
UINT8 __fastcall bssoccer_sound0_read(UINT16 address) static UINT8 __fastcall bssoccer_sound0_read(UINT16 address)
{ {
switch (address) switch (address)
{ {
@ -1154,12 +1152,12 @@ UINT8 __fastcall bssoccer_sound0_read(UINT16 address)
//------------------ //------------------
// Z80 #1 // Z80 #1
void __fastcall bssoccer_sound1_out(UINT16 port, UINT8 data) static void __fastcall bssoccer_sound1_out(UINT16 port, UINT8 data)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
case 0x00: { DACWrite(0, (data & 0xf) * 0x11); return; } case 0x00: { DACSignedWrite(0, (data & 0xf) * 0x11); return; }
case 0x01: { DACWrite(1, (data & 0xf) * 0x11); return; } case 0x01: { DACSignedWrite(1, (data & 0xf) * 0x11); return; }
case 0x03: case 0x03:
bssoccer_bankswitch_w(DrvZ80ROM1, 0, data); bssoccer_bankswitch_w(DrvZ80ROM1, 0, data);
@ -1169,7 +1167,7 @@ void __fastcall bssoccer_sound1_out(UINT16 port, UINT8 data)
return; return;
} }
UINT8 __fastcall bssoccer_sound1_in(UINT16 port) static UINT8 __fastcall bssoccer_sound1_in(UINT16 port)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
@ -1183,12 +1181,12 @@ UINT8 __fastcall bssoccer_sound1_in(UINT16 port)
//------------------ //------------------
// Z80 #2 // Z80 #2
void __fastcall bssoccer_sound2_out(UINT16 port, UINT8 data) static void __fastcall bssoccer_sound2_out(UINT16 port, UINT8 data)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
case 0x00: { DACWrite(2, (data & 0xf) * 0x11); return; } case 0x00: { DACSignedWrite(2, (data & 0xf) * 0x11); return; }
case 0x01: { DACWrite(3, (data & 0xf) * 0x11); return; } case 0x01: { DACSignedWrite(3, (data & 0xf) * 0x11); return; }
return; return;
case 0x03: case 0x03:
@ -1199,7 +1197,7 @@ void __fastcall bssoccer_sound2_out(UINT16 port, UINT8 data)
return; return;
} }
UINT8 __fastcall bssoccer_sound2_in(UINT16 port) static UINT8 __fastcall bssoccer_sound2_in(UINT16 port)
{ {
switch (port & 0xff) switch (port & 0xff)
{ {
@ -1229,7 +1227,7 @@ static INT32 DrvDoReset()
ZetReset(); ZetReset();
ZetClose(); ZetClose();
} }
if (game_select == 3) { if (game_select == 3) {
ZetOpen(2); ZetOpen(2);
ZetReset(); ZetReset();
@ -1259,7 +1257,7 @@ static INT32 DrvDoReset()
uballoon_bankswitch(z80bankdata[0]); uballoon_bankswitch(z80bankdata[0]);
ZetClose(); ZetClose();
} }
if (game_select == 1) { if (game_select == 1) {
ZetOpen(1); ZetOpen(1);
bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]); bssoccer_bankswitch_w(DrvZ80ROM1, 0, z80bankdata[0]);
@ -1401,7 +1399,7 @@ static INT32 DrvLoadRoms()
gfx1_len += ri.nLen; gfx1_len += ri.nLen;
continue; continue;
} }
} }
nGfxROM0Len = gfx0_len >> 5; nGfxROM0Len = gfx0_len >> 5;
@ -1412,7 +1410,7 @@ static INT32 DrvLoadRoms()
return 0; return 0;
} }
void bestbest_ay8910_write_a(UINT32,UINT32) static void bestbest_ay8910_write_a(UINT32,UINT32)
{ {
} }
@ -1430,16 +1428,6 @@ static INT32 bestbestSynchroniseStream(INT32 nSoundRate)
return (INT64)ZetTotalCycles() * nSoundRate / 6000000; return (INT64)ZetTotalCycles() * nSoundRate / 6000000;
} }
static INT32 bestbestSyncDAC()
{
return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (6000000.0000 / (nBurnFPS / 100.0000))));
}
static INT32 bssoccerSyncDAC()
{
return (INT32)(float)(nBurnSoundLen * (ZetTotalCycles() / (5000000.0000 / (nBurnFPS / 100.0000))));
}
static INT32 BestbestInit() static INT32 BestbestInit()
{ {
INT32 nLen; INT32 nLen;
@ -1475,19 +1463,15 @@ static INT32 BestbestInit()
ZetInit(0); ZetInit(0);
ZetOpen(0); ZetOpen(0);
ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0); ZetMapMemory(DrvZ80ROM0, 0x0000, 0xbfff, MAP_ROM);
ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0); ZetMapMemory(DrvZ80RAM0, 0xe000, 0xe7ff, MAP_RAM);
ZetMapArea(0xe000, 0xe7ff, 0, DrvZ80RAM0);
ZetMapArea(0xe000, 0xe7ff, 1, DrvZ80RAM0);
ZetMapArea(0xe000, 0xe7ff, 2, DrvZ80RAM0);
ZetSetReadHandler(bestbest_sound0_read); ZetSetReadHandler(bestbest_sound0_read);
ZetSetWriteHandler(bestbest_sound0_write); ZetSetWriteHandler(bestbest_sound0_write);
ZetClose(); ZetClose();
ZetInit(1); ZetInit(1);
ZetOpen(1); ZetOpen(1);
ZetMapArea(0x0000, 0xffff, 0, DrvZ80ROM1); ZetMapMemory(DrvZ80ROM1, 0x0000, 0xffff, MAP_ROM);
ZetMapArea(0x0000, 0xffff, 2, DrvZ80ROM1);
ZetSetInHandler(bestbest_sound1_in); ZetSetInHandler(bestbest_sound1_in);
ZetSetOutHandler(bestbest_sound1_out); ZetSetOutHandler(bestbest_sound1_out);
ZetClose(); ZetClose();
@ -1495,17 +1479,17 @@ static INT32 BestbestInit()
BurnYM3526Init(3000000, &bestbestFMIRQHandler, &bestbestSynchroniseStream, 0); BurnYM3526Init(3000000, &bestbestFMIRQHandler, &bestbestSynchroniseStream, 0);
BurnTimerAttachYM3526(&ZetConfig, 6000000); BurnTimerAttachYM3526(&ZetConfig, 6000000);
BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH); BurnYM3526SetRoute(BURN_SND_YM3526_ROUTE, 1.00, BURN_SND_ROUTE_BOTH);
AY8910Init(0, 1500000, 0); AY8910Init(0, 1500000, 0);
AY8910SetPorts(0, NULL, NULL, bestbest_ay8910_write_a, NULL); AY8910SetPorts(0, NULL, NULL, bestbest_ay8910_write_a, NULL);
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT); AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT); AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_3, 0.00, BURN_SND_ROUTE_BOTH); // suppressed? AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_3, 0.00, BURN_SND_ROUTE_BOTH); // suppressed?
DACInit(0, 0, 1, bestbestSyncDAC); DACInit(0, 0, 1, ZetTotalCycles, 6000000);
DACInit(1, 0, 1, bestbestSyncDAC); DACInit(1, 0, 1, ZetTotalCycles, 6000000);
DACInit(2, 0, 1, bestbestSyncDAC); DACInit(2, 0, 1, ZetTotalCycles, 6000000);
DACInit(3, 0, 1, bestbestSyncDAC); DACInit(3, 0, 1, ZetTotalCycles, 6000000);
DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT);
DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT);
DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT);
@ -1547,21 +1531,15 @@ static INT32 SunaqInit()
ZetInit(0); ZetInit(0);
ZetOpen(0); ZetOpen(0);
ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); ZetMapMemory(DrvZ80ROM0, 0x0000, 0xefff, MAP_ROM);
ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); ZetMapMemory(DrvZ80RAM0, 0xf000, 0xf7ff, MAP_RAM);
ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0);
ZetSetWriteHandler(sunaq_sound0_write); ZetSetWriteHandler(sunaq_sound0_write);
ZetSetReadHandler(bssoccer_sound0_read); ZetSetReadHandler(bssoccer_sound0_read);
ZetClose(); ZetClose();
ZetInit(1); ZetInit(1);
ZetOpen(1); ZetOpen(1);
ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); ZetMapMemory(DrvZ80ROM1, 0x0000, 0xffff, MAP_ROM);
ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1);
ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000);
ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000);
ZetSetInHandler(bssoccer_sound1_in); ZetSetInHandler(bssoccer_sound1_in);
ZetSetOutHandler(bssoccer_sound1_out); ZetSetOutHandler(bssoccer_sound1_out);
ZetClose(); ZetClose();
@ -1570,8 +1548,8 @@ static INT32 SunaqInit()
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT);
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT);
DACInit(0, 0, 2, bestbestSyncDAC); DACInit(0, 0, 2, ZetTotalCycles, 6000000);
DACInit(1, 0, 2, bestbestSyncDAC); DACInit(1, 0, 2, ZetTotalCycles, 6000000);
DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT);
DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT);
@ -1613,21 +1591,15 @@ static INT32 UballoonInit()
ZetInit(0); ZetInit(0);
ZetOpen(0); ZetOpen(0);
ZetMapArea(0x0000, 0xefff, 0, DrvZ80ROM0); ZetMapMemory(DrvZ80ROM0, 0x0000, 0xefff, MAP_ROM);
ZetMapArea(0x0000, 0xefff, 2, DrvZ80ROM0); ZetMapMemory(DrvZ80RAM0, 0xf000, 0xf7ff, MAP_RAM);
ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0);
ZetSetWriteHandler(sunaq_sound0_write); ZetSetWriteHandler(sunaq_sound0_write);
ZetSetReadHandler(bssoccer_sound0_read); ZetSetReadHandler(bssoccer_sound0_read);
ZetClose(); ZetClose();
ZetInit(1); ZetInit(1);
ZetOpen(1); ZetOpen(1);
ZetMapArea(0x0000, 0x03ff, 0, DrvZ80ROM1); ZetMapMemory(DrvZ80ROM1, 0x0000, 0xffff, MAP_ROM);
ZetMapArea(0x0000, 0x03ff, 2, DrvZ80ROM1);
ZetMapArea(0x0400, 0xffff, 0, DrvZ80ROM1 + 0x400);
ZetMapArea(0x0400, 0xffff, 2, DrvZ80ROM1 + 0x400);
ZetSetInHandler(uballoon_sound1_in); ZetSetInHandler(uballoon_sound1_in);
ZetSetOutHandler(uballoon_sound1_out); ZetSetOutHandler(uballoon_sound1_out);
ZetClose(); ZetClose();
@ -1636,8 +1608,8 @@ static INT32 UballoonInit()
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT);
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT);
DACInit(0, 0, 1, bssoccerSyncDAC); DACInit(0, 0, 1, ZetTotalCycles, 5333333);
DACInit(1, 0, 1, bssoccerSyncDAC); DACInit(1, 0, 1, ZetTotalCycles, 5333333);
DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT); DACSetRoute(0, 0.50, BURN_SND_ROUTE_LEFT);
DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT); DACSetRoute(1, 0.50, BURN_SND_ROUTE_RIGHT);
@ -1677,31 +1649,22 @@ static INT32 BssoccerInit()
ZetInit(0); ZetInit(0);
ZetOpen(0); ZetOpen(0);
ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM0); ZetMapMemory(DrvZ80ROM0, 0x0000, 0x7fff, MAP_ROM);
ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM0); ZetMapMemory(DrvZ80RAM0, 0xf000, 0xf7ff, MAP_RAM);
ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80RAM0);
ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80RAM0);
ZetSetWriteHandler(bssoccer_sound0_write); ZetSetWriteHandler(bssoccer_sound0_write);
ZetSetReadHandler(bssoccer_sound0_read); ZetSetReadHandler(bssoccer_sound0_read);
ZetClose(); ZetClose();
ZetInit(1); ZetInit(1);
ZetOpen(1); ZetOpen(1);
ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM1); ZetMapMemory(DrvZ80ROM1, 0x0000, 0xffff, MAP_ROM);
ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM1); ZetSetInHandler(bssoccer_sound1_in);
ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM1 + 0x1000);
ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM1 + 0x1000);
ZetSetInHandler(bssoccer_sound1_in);
ZetSetOutHandler(bssoccer_sound1_out); ZetSetOutHandler(bssoccer_sound1_out);
ZetClose(); ZetClose();
ZetInit(2); ZetInit(2);
ZetOpen(2); ZetOpen(2);
ZetMapArea(0x0000, 0x0fff, 0, DrvZ80ROM2); ZetMapMemory(DrvZ80ROM2, 0x0000, 0xffff, MAP_ROM);
ZetMapArea(0x0000, 0x0fff, 2, DrvZ80ROM2);
ZetMapArea(0x1000, 0xffff, 0, DrvZ80ROM2 + 0x1000);
ZetMapArea(0x1000, 0xffff, 2, DrvZ80ROM2 + 0x1000);
ZetSetInHandler(bssoccer_sound2_in); ZetSetInHandler(bssoccer_sound2_in);
ZetSetOutHandler(bssoccer_sound2_out); ZetSetOutHandler(bssoccer_sound2_out);
ZetClose(); ZetClose();
@ -1710,12 +1673,12 @@ static INT32 BssoccerInit()
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.20, BURN_SND_ROUTE_LEFT);
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT); BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.20, BURN_SND_ROUTE_RIGHT);
DACInit(0, 0, 1, bssoccerSyncDAC); DACInit(0, 0, 1, ZetTotalCycles, 5333333);
DACInit(1, 0, 1, bssoccerSyncDAC); DACInit(1, 0, 1, ZetTotalCycles, 5333333);
DACInit(2, 0, 1, bssoccerSyncDAC); DACInit(2, 0, 1, ZetTotalCycles, 5333333);
DACInit(3, 0, 1, bssoccerSyncDAC); DACInit(3, 0, 1, ZetTotalCycles, 5333333);
DACSetRoute(0, 0.40, BURN_SND_ROUTE_LEFT); DACSetRoute(0, 0.40, BURN_SND_ROUTE_BOTH);
DACSetRoute(1, 0.40, BURN_SND_ROUTE_RIGHT); DACSetRoute(1, 0.40, BURN_SND_ROUTE_BOTH);
DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT); DACSetRoute(2, 0.40, BURN_SND_ROUTE_LEFT);
DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT); DACSetRoute(3, 0.40, BURN_SND_ROUTE_RIGHT);
@ -1836,7 +1799,7 @@ static void draw_sprites(UINT16 *sprites, UINT8 *gfx_base, INT32 max_tile)
tile_x += tile_xinc; tile_x += tile_xinc;
if (sy < -15 || sy > (nScreenHeight - 1) || sx < -15 || sx > (nScreenWidth - 1)) { if (sy < -15 || sy > (nScreenHeight - 1) || sx < -15 || sx > (nScreenWidth - 1)) {
continue; continue;
} }
if (tile_flipy) { if (tile_flipy) {
@ -1870,9 +1833,7 @@ static INT32 DrvDraw()
} }
} }
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) { BurnTransferClear(0xff);
pTransDraw[i] = 0xff;
}
draw_sprites((UINT16*)DrvSprRAM0, DrvGfxROM0, nGfxROM0Len); draw_sprites((UINT16*)DrvSprRAM0, DrvGfxROM0, nGfxROM0Len);
if (!game_select) { if (!game_select) {
@ -1949,7 +1910,7 @@ static INT32 BestbestFrame()
SekNewFrame(); SekNewFrame();
ZetNewFrame(); ZetNewFrame();
SekOpen(0); SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) { for (INT32 i = 0; i < nInterleave; i++) {
@ -1960,22 +1921,22 @@ static INT32 BestbestFrame()
ZetOpen(0); ZetOpen(0);
BurnTimerUpdateYM3526(i * (nCyclesTotal[1] / nInterleave)); BurnTimerUpdateYM3526(i * (nCyclesTotal[1] / nInterleave));
ZetClose(); ZetClose();
ZetOpen(1); ZetOpen(1);
ZetRun(nCyclesTotal[2] / nInterleave); ZetRun(nCyclesTotal[2] / nInterleave);
ZetClose(); ZetClose();
if (pBurnSoundOut) { if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave; INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1);
AY8910Render(pSoundBuf, nSegmentLength); AY8910Render(pSoundBuf, nSegmentLength);
nSoundBufferPos += nSegmentLength; nSoundBufferPos += nSegmentLength;
} }
} }
SekClose(); SekClose();
if (pBurnSoundOut) { if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1); INT16* pSoundBuf = pSoundBuffer + (nSoundBufferPos << 1);
@ -1984,7 +1945,7 @@ static INT32 BestbestFrame()
AY8910Render(pSoundBuf, nSegmentLength); AY8910Render(pSoundBuf, nSegmentLength);
} }
} }
ZetOpen(0); ZetOpen(0);
BurnTimerEndFrameYM3526(nCyclesTotal[1]); BurnTimerEndFrameYM3526(nCyclesTotal[1]);
if (pBurnSoundOut) { if (pBurnSoundOut) {
@ -2019,10 +1980,10 @@ static INT32 SunaqFrame()
nCyclesTotal[0] = 6000000 / 60; nCyclesTotal[0] = 6000000 / 60;
nCyclesTotal[1] = 3579500 / 60; nCyclesTotal[1] = 3579500 / 60;
nCyclesTotal[2] = 6000000 / 60; nCyclesTotal[2] = 6000000 / 60;
SekNewFrame(); SekNewFrame();
ZetNewFrame(); ZetNewFrame();
SekOpen(0); SekOpen(0);
for (INT32 i = 0; i < nInterleave; i++) for (INT32 i = 0; i < nInterleave; i++)
@ -2035,7 +1996,7 @@ static INT32 SunaqFrame()
ZetRun(nCyclesTotal[j+1] / nInterleave); ZetRun(nCyclesTotal[j+1] / nInterleave);
ZetClose(); ZetClose();
} }
if (pBurnSoundOut) { if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave; INT32 nSegmentLength = nBurnSoundLen / nInterleave;
INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
@ -2052,7 +2013,7 @@ static INT32 SunaqFrame()
if (nSegmentLength) { if (nSegmentLength) {
BurnYM2151Render(pSoundBuf, nSegmentLength); BurnYM2151Render(pSoundBuf, nSegmentLength);
} }
DACUpdate(pBurnSoundOut, nBurnSoundLen); DACUpdate(pBurnSoundOut, nBurnSoundLen);
} }
@ -2070,6 +2031,7 @@ static INT32 UballoonFrame()
INT32 nInterleave = 50; INT32 nInterleave = 50;
INT32 nSoundBufferPos = 0; INT32 nSoundBufferPos = 0;
INT32 nCyclesTotal[3]; INT32 nCyclesTotal[3];
INT32 nCyclesDone[3] = { 0, 0, 0 };
if (DrvReset) { if (DrvReset) {
DrvDoReset(); DrvDoReset();
@ -2079,8 +2041,8 @@ static INT32 UballoonFrame()
nCyclesTotal[0] = 8000000 / 60; nCyclesTotal[0] = 8000000 / 60;
nCyclesTotal[1] = 3579500 / 60; nCyclesTotal[1] = 3579500 / 60;
nCyclesTotal[2] = 5000000 / 60; nCyclesTotal[2] = 5333333 / 60;
SekNewFrame(); SekNewFrame();
ZetNewFrame(); ZetNewFrame();
@ -2091,11 +2053,13 @@ static INT32 UballoonFrame()
SekRun(nCyclesTotal[0] / nInterleave); SekRun(nCyclesTotal[0] / nInterleave);
if (i == (nInterleave )-1) SekSetIRQLine(1, CPU_IRQSTATUS_AUTO); if (i == (nInterleave )-1) SekSetIRQLine(1, CPU_IRQSTATUS_AUTO);
for (INT32 j = 0; j < 2; j++) { ZetOpen(0);
ZetOpen(j); nCyclesDone[1] += ZetRun(((i + 1) * nCyclesTotal[1] / nInterleave) - nCyclesDone[1]);
ZetRun(nCyclesTotal[j+1] / nInterleave); ZetClose();
ZetClose();
} ZetOpen(1);
nCyclesDone[2] += ZetRun(((i + 1) * nCyclesTotal[2] / nInterleave) - nCyclesDone[2]);
ZetClose();
if (pBurnSoundOut) { if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave; INT32 nSegmentLength = nBurnSoundLen / nInterleave;
@ -2114,8 +2078,10 @@ static INT32 UballoonFrame()
if (nSegmentLength) { if (nSegmentLength) {
BurnYM2151Render(pSoundBuf, nSegmentLength); BurnYM2151Render(pSoundBuf, nSegmentLength);
} }
ZetOpen(1);
DACUpdate(pBurnSoundOut, nBurnSoundLen); DACUpdate(pBurnSoundOut, nBurnSoundLen);
ZetClose();
} }
SekClose(); SekClose();
@ -2133,6 +2099,7 @@ static INT32 BssoccerFrame()
INT32 nInterleave = 50; INT32 nInterleave = 50;
INT32 nSoundBufferPos = 0; INT32 nSoundBufferPos = 0;
INT32 nCyclesTotal[4]; INT32 nCyclesTotal[4];
INT32 nCyclesDone[4] = { 0, 0, 0, 0 };
if (DrvReset) { if (DrvReset) {
DrvDoReset(); DrvDoReset();
@ -2142,9 +2109,9 @@ static INT32 BssoccerFrame()
nCyclesTotal[0] = 8000000 / 60; nCyclesTotal[0] = 8000000 / 60;
nCyclesTotal[1] = 3579500 / 60; nCyclesTotal[1] = 3579500 / 60;
nCyclesTotal[2] = 5000000 / 60; nCyclesTotal[2] = 5333333 / 60;
nCyclesTotal[3] = 5000000 / 60; nCyclesTotal[3] = 5333333 / 60;
SekNewFrame(); SekNewFrame();
ZetNewFrame(); ZetNewFrame();
@ -2156,11 +2123,15 @@ static INT32 BssoccerFrame()
if (i == (nInterleave / 2)-1) SekSetIRQLine(2, CPU_IRQSTATUS_AUTO); if (i == (nInterleave / 2)-1) SekSetIRQLine(2, CPU_IRQSTATUS_AUTO);
if (i == (nInterleave )-1) SekSetIRQLine(1, CPU_IRQSTATUS_AUTO); if (i == (nInterleave )-1) SekSetIRQLine(1, CPU_IRQSTATUS_AUTO);
for (INT32 j = 0; j < 3; j++) { ZetOpen(0);
ZetOpen(j); nCyclesDone[1] += ZetRun(((i + 1) * nCyclesTotal[1] / nInterleave) - nCyclesDone[1]);
ZetRun(nCyclesTotal[j+1] / nInterleave); ZetClose();
ZetClose(); ZetOpen(1);
} nCyclesDone[2] += ZetRun(((i + 1) * nCyclesTotal[2] / nInterleave) - nCyclesDone[2]);
ZetClose();
ZetOpen(2);
nCyclesDone[3] += ZetRun(((i + 1) * nCyclesTotal[3] / nInterleave) - nCyclesDone[3]);
ZetClose();
if (pBurnSoundOut) { if (pBurnSoundOut) {
INT32 nSegmentLength = nBurnSoundLen / nInterleave; INT32 nSegmentLength = nBurnSoundLen / nInterleave;
@ -2178,8 +2149,10 @@ static INT32 BssoccerFrame()
if (nSegmentLength) { if (nSegmentLength) {
BurnYM2151Render(pSoundBuf, nSegmentLength); BurnYM2151Render(pSoundBuf, nSegmentLength);
} }
ZetOpen(1);
DACUpdate(pBurnSoundOut, nBurnSoundLen); DACUpdate(pBurnSoundOut, nBurnSoundLen);
ZetClose();
} }
SekClose(); SekClose();
@ -2192,7 +2165,7 @@ static INT32 BssoccerFrame()
} }
static INT32 DrvScan(INT32 nAction,INT32 *pnMin) static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
{ {
struct BurnArea ba; struct BurnArea ba;
@ -2200,7 +2173,7 @@ static INT32 DrvScan(INT32 nAction,INT32 *pnMin)
*pnMin = 0x029692; *pnMin = 0x029692;
} }
if (nAction & ACB_VOLATILE) { if (nAction & ACB_VOLATILE) {
memset(&ba, 0, sizeof(ba)); memset(&ba, 0, sizeof(ba));
ba.Data = AllRam; ba.Data = AllRam;
@ -2261,7 +2234,7 @@ static struct BurnRomInfo bestbestRomDesc[] = {
{ "2.bin", 0x20000, 0x42843dec, 1 | BRF_ESS | BRF_PRG }, // 1 { "2.bin", 0x20000, 0x42843dec, 1 | BRF_ESS | BRF_PRG }, // 1
{ "3.bin", 0x80000, 0xe2bb8f26, 1 | BRF_ESS | BRF_PRG }, // 2 { "3.bin", 0x80000, 0xe2bb8f26, 1 | BRF_ESS | BRF_PRG }, // 2
{ "1.bin", 0x80000, 0xd365e20a, 1 | BRF_ESS | BRF_PRG }, // 3 { "1.bin", 0x80000, 0xd365e20a, 1 | BRF_ESS | BRF_PRG }, // 3
{ "5.bin", 0x10000, 0xbb9265e6, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code { "5.bin", 0x10000, 0xbb9265e6, 2 | BRF_ESS | BRF_PRG }, // 4 - Z80 #0 Code
{ "6.bin", 0x10000, 0xdd445f6b, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code { "6.bin", 0x10000, 0xdd445f6b, 3 | BRF_ESS | BRF_PRG }, // 5 - Z80 #1 Code
@ -2308,7 +2281,7 @@ static struct BurnRomInfo sunaqRomDesc[] = {
{ "audio2.bin", 0x80000, 0xcac85ba9, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code { "audio2.bin", 0x80000, 0xcac85ba9, 3 | BRF_ESS | BRF_PRG }, // 3 - Z80 #1 Code
{ "gfx1.bin", 0x80000, 0x0bde5acf, 5 | BRF_GRA }, // 4 - Sprites { "gfx1.bin", 0x80000, 0x0bde5acf, 5 | BRF_GRA }, // 4 - Sprites
{ "gfx2.bin", 0x80000, 0x24b74826, 5 | BRF_GRA }, // 5 { "gfx2.bin", 0x80000, 0x24b74826, 5 | BRF_GRA }, // 5
}; };
@ -2383,7 +2356,7 @@ STD_ROM_FN(bssoccer)
struct BurnDriver BurnDrvBssoccer = { struct BurnDriver BurnDrvBssoccer = {
"bssoccer", NULL, NULL, NULL, "1996", "bssoccer", NULL, NULL, NULL, "1996",
"Back Street Soccer\0", "graphics issues?", "SunA", "Miscellaneous", "Back Street Soccer\0", NULL, "SunA", "Miscellaneous",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 4, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0, BDF_GAME_WORKING, 4, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0,
NULL, bssoccerRomInfo, bssoccerRomName, NULL, NULL, BssoccerInputInfo, bssoccerDIPInfo, NULL, bssoccerRomInfo, bssoccerRomName, NULL, NULL, BssoccerInputInfo, bssoccerDIPInfo,

File diff suppressed because it is too large Load Diff

View File

@ -982,14 +982,14 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority)
INT32 scrollx = ((cur_map->scrollx - cur_map->xoffset) / cur_map->twidth) * cur_map->twidth; INT32 scrollx = ((cur_map->scrollx - cur_map->xoffset) / cur_map->twidth) * cur_map->twidth;
// start drawing at tile-border, and let RenderCustomTile..Clip() take care of the sub-tile clipping. // start drawing at tile-border, and let RenderCustomTile..Clip() take care of the sub-tile clipping.
miny -= (miny % cur_map->theight); INT32 starty = miny - (miny % cur_map->theight);
minx -= (minx % cur_map->twidth); INT32 startx = minx - (minx % cur_map->twidth);
for (INT32 y = miny; y < (INT32)(maxy + cur_map->theight); y += cur_map->theight) for (INT32 y = starty; y < (INT32)(maxy + cur_map->theight); y += cur_map->theight)
{ {
INT32 syy = (y + scrolly) % (cur_map->theight * cur_map->mheight); INT32 syy = (y + scrolly) % (cur_map->theight * cur_map->mheight);
for (INT32 x = minx; x < (INT32)(maxx + cur_map->twidth); x += cur_map->twidth) for (INT32 x = startx; x < (INT32)(maxx + cur_map->twidth); x += cur_map->twidth)
{ {
INT32 sxx = (x + scrollx) % (cur_map->twidth * cur_map->mwidth); INT32 sxx = (x + scrollx) % (cur_map->twidth * cur_map->mwidth);