Removed superfluous ^Z at the end of files
This commit is contained in:
@@ -1,289 +1,288 @@
|
||||
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
//
|
||||
//This program is free software; you can redistribute it and/or
|
||||
//modify it under the terms of the GNU General Public License
|
||||
//as published by the Free Software Foundation; either
|
||||
//version 2 of the License, or (at your option) any later
|
||||
//version.
|
||||
//
|
||||
//This program is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with this program; if not, write to the Free Software
|
||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
//#define MMX
|
||||
|
||||
|
||||
#define uint32 unsigned long
|
||||
#define uint16 unsigned short
|
||||
#define uint8 unsigned char
|
||||
|
||||
|
||||
|
||||
static uint32 colorMask = 0xF7DEF7DE;
|
||||
static uint32 lowPixelMask = 0x08210821;
|
||||
static uint32 qcolorMask = 0xE79CE79C;
|
||||
static uint32 qlowpixelMask = 0x18631863;
|
||||
static uint32 redblueMask = 0xF81F;
|
||||
static uint32 greenMask = 0x7E0;
|
||||
|
||||
|
||||
|
||||
extern "C" void Init_2xSaI(uint32 BitFormat)
|
||||
{
|
||||
|
||||
|
||||
if (BitFormat == 565)
|
||||
{
|
||||
colorMask = 0xF7DEF7DE;
|
||||
lowPixelMask = 0x08210821;
|
||||
qcolorMask = 0xE79CE79C;
|
||||
qlowpixelMask = 0x18631863;
|
||||
redblueMask = 0xF81F;
|
||||
greenMask = 0x7E0;
|
||||
}
|
||||
else
|
||||
if (BitFormat == 555)
|
||||
{
|
||||
colorMask = 0x7BDE7BDE;
|
||||
lowPixelMask = 0x04210421;
|
||||
qcolorMask = 0x739C739C;
|
||||
qlowpixelMask = 0x0C630C63;
|
||||
redblueMask = 0x7C1F;
|
||||
greenMask = 0x3E0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
#ifdef MMX
|
||||
Init_2xSaIMMX(BitFormat);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r-=1;
|
||||
if (y <= 1) r+=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32 INTERPOLATE(uint32 A, uint32 B)
|
||||
{
|
||||
if (A !=B)
|
||||
{
|
||||
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
|
||||
}
|
||||
else return A;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
register uint32 x = ((A & qcolorMask) >> 2) +
|
||||
((B & qcolorMask) >> 2) +
|
||||
((C & qcolorMask) >> 2) +
|
||||
((D & qcolorMask) >> 2);
|
||||
register uint32 y = (A & qlowpixelMask) +
|
||||
(B & qlowpixelMask) +
|
||||
(C & qlowpixelMask) +
|
||||
(D & qlowpixelMask);
|
||||
y = (y>>2) & qlowpixelMask;
|
||||
return x+y;
|
||||
}
|
||||
|
||||
|
||||
#define BLUE_MASK565 0x001F001F
|
||||
#define RED_MASK565 0xF800F800
|
||||
#define GREEN_MASK565 0x07E007E0
|
||||
|
||||
#define BLUE_MASK555 0x001F001F
|
||||
#define RED_MASK555 0x7C007C00
|
||||
#define GREEN_MASK555 0x03E003E0
|
||||
|
||||
|
||||
//srcPtr equ 8
|
||||
//deltaPtr equ 12
|
||||
//srcPitch equ 16
|
||||
//width equ 20
|
||||
//dstOffset equ 24
|
||||
//dstPitch equ 28
|
||||
//dstSegment equ 32
|
||||
|
||||
extern "C" void Super2xSaI(uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch,
|
||||
int width, uint8 *dstPtr , uint32 dstPitch)
|
||||
{
|
||||
uint16 *dP;
|
||||
uint16 *bP;
|
||||
uint32 inc_bP;
|
||||
int height = 1;
|
||||
uint32 dPitch = dstPitch >> 1;
|
||||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
{
|
||||
inc_bP = 1;
|
||||
|
||||
// for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
dP = (uint16 *) dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= inc_bP )
|
||||
{
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3,
|
||||
colorB0, colorB1, colorB2, colorB3,
|
||||
colorS1, colorS2;
|
||||
uint32 product1a, product1b,
|
||||
product2a, product2b;
|
||||
|
||||
//--------------------------------------- B1 B2
|
||||
// 4 5 6 S2
|
||||
// 1 2 3 S1
|
||||
// A1 A2
|
||||
|
||||
colorB0 = *(bP- Nextline - 1);
|
||||
colorB1 = *(bP- Nextline);
|
||||
colorB2 = *(bP- Nextline + 1);
|
||||
colorB3 = *(bP- Nextline + 2);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA0 = *(bP + Nextline + Nextline - 1);
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
colorA3 = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
if (color2 == color6 && color5 != color3)
|
||||
{
|
||||
product2b = product1b = color2;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 != color6)
|
||||
{
|
||||
product2b = product1b = color5;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 == color6)
|
||||
{
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0)
|
||||
product2b = product1b = color6;
|
||||
else
|
||||
if (r < 0)
|
||||
product2b = product1b = color5;
|
||||
else
|
||||
{
|
||||
product2b = product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
|
||||
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
|
||||
else
|
||||
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
|
||||
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
|
||||
else
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
|
||||
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
|
||||
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
|
||||
else
|
||||
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
|
||||
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
|
||||
else
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
|
||||
product2a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
|
||||
product2a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
product2a = color2;
|
||||
|
||||
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
|
||||
product1a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
product1a = color5;
|
||||
|
||||
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
|
||||
*dP = product1a;
|
||||
*(dP + 1) = product1b;
|
||||
*(dP + dPitch) = product2a;
|
||||
*(dP + dPitch + 1) = product2b;
|
||||
|
||||
bP ++;
|
||||
dP += 2;
|
||||
}//end of for ( finish= width etc..)
|
||||
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch << 1;
|
||||
}; //endof: for (height; height; height--)
|
||||
}
|
||||
}
|
||||
|
||||
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
//
|
||||
//This program is free software; you can redistribute it and/or
|
||||
//modify it under the terms of the GNU General Public License
|
||||
//as published by the Free Software Foundation; either
|
||||
//version 2 of the License, or (at your option) any later
|
||||
//version.
|
||||
//
|
||||
//This program is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with this program; if not, write to the Free Software
|
||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
//#define MMX
|
||||
|
||||
|
||||
#define uint32 unsigned long
|
||||
#define uint16 unsigned short
|
||||
#define uint8 unsigned char
|
||||
|
||||
|
||||
|
||||
static uint32 colorMask = 0xF7DEF7DE;
|
||||
static uint32 lowPixelMask = 0x08210821;
|
||||
static uint32 qcolorMask = 0xE79CE79C;
|
||||
static uint32 qlowpixelMask = 0x18631863;
|
||||
static uint32 redblueMask = 0xF81F;
|
||||
static uint32 greenMask = 0x7E0;
|
||||
|
||||
|
||||
|
||||
extern "C" void Init_2xSaI(uint32 BitFormat)
|
||||
{
|
||||
|
||||
|
||||
if (BitFormat == 565)
|
||||
{
|
||||
colorMask = 0xF7DEF7DE;
|
||||
lowPixelMask = 0x08210821;
|
||||
qcolorMask = 0xE79CE79C;
|
||||
qlowpixelMask = 0x18631863;
|
||||
redblueMask = 0xF81F;
|
||||
greenMask = 0x7E0;
|
||||
}
|
||||
else
|
||||
if (BitFormat == 555)
|
||||
{
|
||||
colorMask = 0x7BDE7BDE;
|
||||
lowPixelMask = 0x04210421;
|
||||
qcolorMask = 0x739C739C;
|
||||
qlowpixelMask = 0x0C630C63;
|
||||
redblueMask = 0x7C1F;
|
||||
greenMask = 0x3E0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
#ifdef MMX
|
||||
Init_2xSaIMMX(BitFormat);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r-=1;
|
||||
if (y <= 1) r+=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32 INTERPOLATE(uint32 A, uint32 B)
|
||||
{
|
||||
if (A !=B)
|
||||
{
|
||||
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
|
||||
}
|
||||
else return A;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
register uint32 x = ((A & qcolorMask) >> 2) +
|
||||
((B & qcolorMask) >> 2) +
|
||||
((C & qcolorMask) >> 2) +
|
||||
((D & qcolorMask) >> 2);
|
||||
register uint32 y = (A & qlowpixelMask) +
|
||||
(B & qlowpixelMask) +
|
||||
(C & qlowpixelMask) +
|
||||
(D & qlowpixelMask);
|
||||
y = (y>>2) & qlowpixelMask;
|
||||
return x+y;
|
||||
}
|
||||
|
||||
|
||||
#define BLUE_MASK565 0x001F001F
|
||||
#define RED_MASK565 0xF800F800
|
||||
#define GREEN_MASK565 0x07E007E0
|
||||
|
||||
#define BLUE_MASK555 0x001F001F
|
||||
#define RED_MASK555 0x7C007C00
|
||||
#define GREEN_MASK555 0x03E003E0
|
||||
|
||||
|
||||
//srcPtr equ 8
|
||||
//deltaPtr equ 12
|
||||
//srcPitch equ 16
|
||||
//width equ 20
|
||||
//dstOffset equ 24
|
||||
//dstPitch equ 28
|
||||
//dstSegment equ 32
|
||||
|
||||
extern "C" void Super2xSaI(uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch,
|
||||
int width, uint8 *dstPtr , uint32 dstPitch)
|
||||
{
|
||||
uint16 *dP;
|
||||
uint16 *bP;
|
||||
uint32 inc_bP;
|
||||
int height = 1;
|
||||
uint32 dPitch = dstPitch >> 1;
|
||||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
{
|
||||
inc_bP = 1;
|
||||
|
||||
// for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
dP = (uint16 *) dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= inc_bP )
|
||||
{
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3,
|
||||
colorB0, colorB1, colorB2, colorB3,
|
||||
colorS1, colorS2;
|
||||
uint32 product1a, product1b,
|
||||
product2a, product2b;
|
||||
|
||||
//--------------------------------------- B1 B2
|
||||
// 4 5 6 S2
|
||||
// 1 2 3 S1
|
||||
// A1 A2
|
||||
|
||||
colorB0 = *(bP- Nextline - 1);
|
||||
colorB1 = *(bP- Nextline);
|
||||
colorB2 = *(bP- Nextline + 1);
|
||||
colorB3 = *(bP- Nextline + 2);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA0 = *(bP + Nextline + Nextline - 1);
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
colorA3 = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
if (color2 == color6 && color5 != color3)
|
||||
{
|
||||
product2b = product1b = color2;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 != color6)
|
||||
{
|
||||
product2b = product1b = color5;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 == color6)
|
||||
{
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0)
|
||||
product2b = product1b = color6;
|
||||
else
|
||||
if (r < 0)
|
||||
product2b = product1b = color5;
|
||||
else
|
||||
{
|
||||
product2b = product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
|
||||
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
|
||||
else
|
||||
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
|
||||
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
|
||||
else
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
|
||||
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
|
||||
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
|
||||
else
|
||||
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
|
||||
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
|
||||
else
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
|
||||
product2a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
|
||||
product2a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
product2a = color2;
|
||||
|
||||
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
|
||||
product1a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
product1a = color5;
|
||||
|
||||
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
|
||||
*dP = product1a;
|
||||
*(dP + 1) = product1b;
|
||||
*(dP + dPitch) = product2a;
|
||||
*(dP + dPitch + 1) = product2b;
|
||||
|
||||
bP ++;
|
||||
dP += 2;
|
||||
}//end of for ( finish= width etc..)
|
||||
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch << 1;
|
||||
}; //endof: for (height; height; height--)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,189 +1,188 @@
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
|
||||
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set
|
||||
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,drawmode7dcolor
|
||||
EXTSYM cwinptr
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
ALIGN16
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Window 0
|
||||
or dl,dl
|
||||
jz %%nodrawbw
|
||||
test byte[ebp],0FFh
|
||||
jnz %%nodrawbw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawbw
|
||||
add esi,2
|
||||
inc ebp
|
||||
%endmacro
|
||||
|
||||
|
||||
NEWSYM drawmode716b
|
||||
test byte[scaddset],1
|
||||
jnz near drawmode7dcolor
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process Mode7Normal, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov ebp,[cwinptr]
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process Mode7Window, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB Mode7Window, domosaic16b, 2
|
||||
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
|
||||
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set
|
||||
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,drawmode7dcolor
|
||||
EXTSYM cwinptr
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
ALIGN16
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Window 0
|
||||
or dl,dl
|
||||
jz %%nodrawbw
|
||||
test byte[ebp],0FFh
|
||||
jnz %%nodrawbw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawbw
|
||||
add esi,2
|
||||
inc ebp
|
||||
%endmacro
|
||||
|
||||
|
||||
NEWSYM drawmode716b
|
||||
test byte[scaddset],1
|
||||
jnz near drawmode7dcolor
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process Mode7Normal, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov ebp,[cwinptr]
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process Mode7Window, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB Mode7Window, domosaic16b, 2
|
||||
|
||||
@@ -1,233 +1,232 @@
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
|
||||
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,cwinptr
|
||||
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,dcolortab,vidbright
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM Gendcolortable
|
||||
; generate Direct Color Table
|
||||
push eax
|
||||
push edx
|
||||
xor ecx,ecx
|
||||
.loopdct
|
||||
mov al,cl
|
||||
and eax,00000111b
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,13
|
||||
mov edx,eax
|
||||
mov al,cl
|
||||
and eax,00111000b
|
||||
shr eax,3
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,8
|
||||
or edx,eax
|
||||
mov al,cl
|
||||
and eax,11000000b
|
||||
shr eax,6
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,3
|
||||
or edx,eax
|
||||
and edx,0FFFFh
|
||||
mov [dcolortab+ecx*4],edx
|
||||
inc cl
|
||||
jnz .loopdct
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov ecx,[dcolortab+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Window 0
|
||||
or dl,dl
|
||||
jz %%nodrawbw
|
||||
test byte[ebp],0FFh
|
||||
jnz %%nodrawbw
|
||||
mov ecx,[dcolortab+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawbw
|
||||
add esi,2
|
||||
inc ebp
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
NEWSYM prevbrightdc, db 0
|
||||
NEWSYM drawmode7dcolor
|
||||
mov bl,[vidbright]
|
||||
cmp bl,[prevbrightdc]
|
||||
je .nodcchange
|
||||
mov [prevbrightdc],bl
|
||||
call Gendcolortable
|
||||
.nodcchange
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process Mode7Normal, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov ebp,[cwinptr]
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process Mode7Window, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB Mode7Window, domosaic16b, 2
|
||||
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset
|
||||
EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,cwinptr
|
||||
EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,dcolortab,vidbright
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM Gendcolortable
|
||||
; generate Direct Color Table
|
||||
push eax
|
||||
push edx
|
||||
xor ecx,ecx
|
||||
.loopdct
|
||||
mov al,cl
|
||||
and eax,00000111b
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,13
|
||||
mov edx,eax
|
||||
mov al,cl
|
||||
and eax,00111000b
|
||||
shr eax,3
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,8
|
||||
or edx,eax
|
||||
mov al,cl
|
||||
and eax,11000000b
|
||||
shr eax,6
|
||||
mov bl,[vidbright]
|
||||
mul bl
|
||||
mov bl,15
|
||||
div bl
|
||||
xor ah,ah
|
||||
shl eax,3
|
||||
or edx,eax
|
||||
and edx,0FFFFh
|
||||
mov [dcolortab+ecx*4],edx
|
||||
inc cl
|
||||
jnz .loopdct
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov ecx,[dcolortab+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Window 0
|
||||
or dl,dl
|
||||
jz %%nodrawbw
|
||||
test byte[ebp],0FFh
|
||||
jnz %%nodrawbw
|
||||
mov ecx,[dcolortab+edx*4]
|
||||
mov [esi],cx
|
||||
%%nodrawbw
|
||||
add esi,2
|
||||
inc ebp
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
NEWSYM prevbrightdc, db 0
|
||||
NEWSYM drawmode7dcolor
|
||||
mov bl,[vidbright]
|
||||
cmp bl,[prevbrightdc]
|
||||
je .nodcchange
|
||||
mov [prevbrightdc],bl
|
||||
call Gendcolortable
|
||||
.nodcchange
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process Mode7Normal, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov ebp,[cwinptr]
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process Mode7Window, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB Mode7Window, domosaic16b, 2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,364 +1,363 @@
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM cwinptr
|
||||
EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor
|
||||
EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab,DoTransp
|
||||
EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf,drawmode716b
|
||||
EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset
|
||||
EXTSYM fulladdtab
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
|
||||
%macro mode7halfadd 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
or cx,cx
|
||||
jz %%noadd
|
||||
and edx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
%%noadd
|
||||
mov [esi],dx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladd 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsub 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
xor edx,0FFFFh
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsub 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7halfaddwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
or cx,cx
|
||||
je %%noadd
|
||||
and edx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
%%noadd
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
xor ecx,ecx
|
||||
inc dword[cwinptr2]
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladdwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
inc dword[cwinptr2]
|
||||
xor ecx,ecx
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsubwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
xor edx,0FFFFh
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
xor ecx,ecx
|
||||
inc dword[cwinptr2]
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsubwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
inc dword[cwinptr2]
|
||||
xor ecx,ecx
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode716tmacro 2
|
||||
Mode7Calculate
|
||||
mov ebp,transpbuf+32
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process %1, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB %1, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process %2, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB %2, domosaic16b, 2
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 half Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716t
|
||||
test byte[scaddset],1
|
||||
jnz near drawmode7dcolor
|
||||
cmp byte[DoTransp],1
|
||||
jne .transpfull
|
||||
jmp drawmode716b
|
||||
.transpfull
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
mov [cwinptr2],esi
|
||||
test byte[scaddtype],80h
|
||||
jnz near drawmode716tsub
|
||||
test byte[scaddtype],40h
|
||||
jz near drawmode716tfulladd
|
||||
cmp byte[scrnon+1],0
|
||||
je near drawmode716tfulladd
|
||||
cmp dword[coladdr],0
|
||||
jnz near drawmode716tfulladd
|
||||
; cmp byte[scrnon+1],10h
|
||||
; je near drawmode716tfulladd
|
||||
;.n
|
||||
mode716tmacro mode7halfadd,mode7halfaddwinon
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 Full Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716tfulladd
|
||||
mode716tmacro mode7fulladd,mode7fulladdwinon
|
||||
|
||||
;**********************************************************
|
||||
; Processes and draws Mode 7 subtract
|
||||
;**********************************************************
|
||||
|
||||
drawmode716tsub:
|
||||
mode716tmacro mode7fullsub,mode7fullsubwinon
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, main & sub mode
|
||||
;**********************************************************
|
||||
|
||||
NEWSYM drawmode716tb
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
mov [cwinptr2],esi
|
||||
mode716tmacro mode7mainsub,mode7mainsubwinon
|
||||
|
||||
cwinptr2 dd 0
|
||||
|
||||
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
EXTSYM cwinptr
|
||||
EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor
|
||||
EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab,DoTransp
|
||||
EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf,drawmode716b
|
||||
EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset
|
||||
EXTSYM fulladdtab
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
|
||||
%macro mode7halfadd 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
or cx,cx
|
||||
jz %%noadd
|
||||
and edx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
%%noadd
|
||||
mov [esi],dx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladd 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsub 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
xor edx,0FFFFh
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsub 0
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7halfaddwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
or cx,cx
|
||||
je %%noadd
|
||||
and edx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
%%noadd
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
xor ecx,ecx
|
||||
inc dword[cwinptr2]
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladdwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
inc dword[cwinptr2]
|
||||
xor ecx,ecx
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsubwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov edx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
mov edx,[fulladdtab+edx*2]
|
||||
xor edx,0FFFFh
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodraw
|
||||
xor ecx,ecx
|
||||
inc dword[cwinptr2]
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsubwinon 0
|
||||
mov ecx,[cwinptr2]
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[ecx],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
inc dword[cwinptr2]
|
||||
xor ecx,ecx
|
||||
add esi,2
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro mode716tmacro 2
|
||||
Mode7Calculate
|
||||
mov ebp,transpbuf+32
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov edi,[vram]
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+32
|
||||
mov ecx,128
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+32
|
||||
.nomosaic
|
||||
|
||||
; esi = pointer to video buffer
|
||||
; edi = pointer to vram
|
||||
; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit)
|
||||
; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit)
|
||||
; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit
|
||||
; [.mode7xpos+1] = word value of x position
|
||||
; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit
|
||||
; [.mode7ypos+1] = word value of y position
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
mov byte[.mode7xincc],0
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
mov byte[.mode7xincc],0FEh
|
||||
.noneg
|
||||
mov dword[.mode7yadd2],800h
|
||||
mov byte[.mode7yinc],1
|
||||
test dword[.mode7yadder],80000000h
|
||||
jz .noneg2
|
||||
mov dword[.mode7yadd2],-800h
|
||||
mov byte[.mode7yinc],-1
|
||||
.noneg2
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawmode7win
|
||||
.domosaic
|
||||
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3
|
||||
Mode7Process %1, domosaic16b, 2
|
||||
.nextval3
|
||||
Mode7ProcessB %1, domosaic16b, 2
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.mode7xpos dd 0 ; x position
|
||||
.tempa2 dd 0 ; keep this blank!
|
||||
.mode7xrpos dd 0 ; x position
|
||||
.tempa dd 0 ; keep this blank!
|
||||
.mode7ypos dd 0 ; y position
|
||||
.tempb2 dd 0 ; keep this blank!
|
||||
.mode7yrpos dd 0 ; y position
|
||||
.tempb dd 0 ; keep this blank!
|
||||
.mode7xadder dd 0 ; number to add for x
|
||||
.tempc2 dd 0 ; keep this blank!
|
||||
.mode7xadd2 dd 0 ; number to add for x
|
||||
.tempc dd 0 ; keep this blank!
|
||||
.mode7yadder dd 0 ; number to add for y
|
||||
.tempd2 dd 0 ; keep this blank!
|
||||
.mode7yadd2 dd 0 ; number to add for y
|
||||
.tempd dd 0 ; keep this blank!
|
||||
.mode7ptr dd 0 ; pointer value
|
||||
.mode7xinc dd 0 ; number to add for x
|
||||
.mode7xincc dd 0 ; range check for x
|
||||
.mode7yinc dd 0 ; number to add for y
|
||||
.mode7xsloc dd 0 ; which screen x
|
||||
.mode7ysloc dd 0 ; which screen y
|
||||
.mode7xsrl dd 0 ; which relative screen x
|
||||
.mode7ysrl dd 0 ; which relative screen y
|
||||
.cxloc dw 0 ; cx location
|
||||
.cyloc dw 0 ; cy location
|
||||
.m7xaddofa dd 0
|
||||
.m7xaddof2a dd 0
|
||||
.m7yaddofa dd 0
|
||||
.m7yaddof2a dd 0
|
||||
|
||||
.drawmode7win
|
||||
.domosaicw
|
||||
mov edi,[vram]
|
||||
cmp dword[.mode7xadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7xadder],-7F0h
|
||||
jl near .nextval3w
|
||||
cmp dword[.mode7yadder],7F0h
|
||||
jg near .nextval3w
|
||||
cmp dword[.mode7yadder],-7F0h
|
||||
jl near .nextval3w
|
||||
|
||||
Mode7Process %2, domosaic16b, 2
|
||||
.nextval3w
|
||||
Mode7ProcessB %2, domosaic16b, 2
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 half Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716t
|
||||
test byte[scaddset],1
|
||||
jnz near drawmode7dcolor
|
||||
cmp byte[DoTransp],1
|
||||
jne .transpfull
|
||||
jmp drawmode716b
|
||||
.transpfull
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
mov [cwinptr2],esi
|
||||
test byte[scaddtype],80h
|
||||
jnz near drawmode716tsub
|
||||
test byte[scaddtype],40h
|
||||
jz near drawmode716tfulladd
|
||||
cmp byte[scrnon+1],0
|
||||
je near drawmode716tfulladd
|
||||
cmp dword[coladdr],0
|
||||
jnz near drawmode716tfulladd
|
||||
; cmp byte[scrnon+1],10h
|
||||
; je near drawmode716tfulladd
|
||||
;.n
|
||||
mode716tmacro mode7halfadd,mode7halfaddwinon
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 Full Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716tfulladd
|
||||
mode716tmacro mode7fulladd,mode7fulladdwinon
|
||||
|
||||
;**********************************************************
|
||||
; Processes and draws Mode 7 subtract
|
||||
;**********************************************************
|
||||
|
||||
drawmode716tsub:
|
||||
mode716tmacro mode7fullsub,mode7fullsubwinon
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, main & sub mode
|
||||
;**********************************************************
|
||||
|
||||
NEWSYM drawmode716tb
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
mov [cwinptr2],esi
|
||||
mode716tmacro mode7mainsub,mode7mainsubwinon
|
||||
|
||||
cwinptr2 dd 0
|
||||
|
||||
|
||||
@@ -1,326 +1,325 @@
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%macro Mode7Calculate 0
|
||||
; mode 7, ax = curyposition, dx = curxposition (left side)
|
||||
; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen
|
||||
; center map coordinates = (X0,Y0)
|
||||
; 1.) cx=X0-bg1scrolx, cy =Y0-ax
|
||||
|
||||
mov bx,[mode7X0]
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonega
|
||||
or bx,1110000000000000b
|
||||
.nonega
|
||||
mov [.cxloc],bx
|
||||
mov bx,dx
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegb
|
||||
or bx,1110000000000000b
|
||||
.nonegb
|
||||
sub [.cxloc],bx
|
||||
mov bx,ax
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegc
|
||||
or bx,1110000000000000b
|
||||
.nonegc
|
||||
mov [.cyloc],bx
|
||||
mov bx,[mode7Y0]
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegd
|
||||
or bx,1110000000000000b
|
||||
.nonegd
|
||||
sub word[.cyloc],bx
|
||||
|
||||
; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D)
|
||||
|
||||
movsx eax,word[mode7B]
|
||||
movsx ebx,word[.cyloc]
|
||||
imul eax,ebx
|
||||
mov [.mode7xpos],eax
|
||||
mov bx,word[mode7X0]
|
||||
add [.mode7xpos+1],bx
|
||||
|
||||
movsx ebx,word[.cyloc]
|
||||
movsx eax,word[mode7D]
|
||||
imul eax,ebx
|
||||
mov [.mode7ypos],eax
|
||||
mov bx,word[mode7Y0]
|
||||
add [.mode7ypos+1],bx
|
||||
|
||||
; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B)
|
||||
|
||||
movsx ebx,word[.cxloc]
|
||||
movsx eax,word[mode7A]
|
||||
mov [.mode7xadder],eax
|
||||
imul eax,ebx
|
||||
neg eax
|
||||
add [.mode7xpos],eax
|
||||
|
||||
movsx eax,word[mode7C]
|
||||
movsx ebx,word[.cxloc]
|
||||
neg eax
|
||||
mov [.mode7yadder],eax
|
||||
imul eax,ebx
|
||||
add [.mode7ypos],eax
|
||||
|
||||
test byte[mode7set],1
|
||||
jz .nohflip
|
||||
mov eax,[.mode7xadder]
|
||||
shl eax,8
|
||||
add [.mode7xpos],eax
|
||||
neg dword[.mode7xadder]
|
||||
mov eax,[.mode7yadder]
|
||||
shl eax,8
|
||||
sub [.mode7ypos],eax
|
||||
neg dword[.mode7yadder]
|
||||
.nohflip
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Process 3
|
||||
mov dword[.temp],256
|
||||
test byte[mode7set],80h
|
||||
jnz near %%norep2
|
||||
|
||||
mov eax,[.mode7xpos]
|
||||
and eax,7FFh
|
||||
mov [.mode7xrpos],eax
|
||||
mov eax,[.mode7ypos]
|
||||
and eax,7FFh
|
||||
mov [.mode7yrpos],eax
|
||||
|
||||
; get tile data offset into edi
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
mov edi,[vram]
|
||||
xor ecx,ecx
|
||||
mov [.mode7ptr],ebx
|
||||
mov cl,[edi+ebx]
|
||||
shl ecx,7
|
||||
add edi,ecx
|
||||
|
||||
mov eax,[.mode7xrpos]
|
||||
mov ebx,[.mode7ptr]
|
||||
jmp %%nextval
|
||||
ALIGN16
|
||||
%%nextval
|
||||
test ah,08h
|
||||
jnz near %%rposoffx
|
||||
%%nextposx
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near %%rposoffy
|
||||
%%nextposy
|
||||
mov ch,ah
|
||||
mov edx,[.mode7yadder]
|
||||
mov cl,byte[.mode7yrpos+1]
|
||||
sub dword[.mode7yrpos],edx
|
||||
xor edx,edx
|
||||
add eax,[.mode7xadder]
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov dl,[edi+edx]
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextval
|
||||
jmp %%finishmode7
|
||||
|
||||
%%rposoffx
|
||||
add bl,[.mode7xinc]
|
||||
xor ecx,ecx
|
||||
mov cl,[vrama+ebx]
|
||||
shl ecx,7
|
||||
sub eax,[.mode7xadd2]
|
||||
lea edi,[ecx+vrama]
|
||||
jmp %%nextposx
|
||||
|
||||
%%rposoffy
|
||||
sub bh,[.mode7yinc]
|
||||
and ebx,07FFFh
|
||||
xor ecx,ecx
|
||||
mov cl,[vrama+ebx]
|
||||
mov edx,[.mode7yadd2]
|
||||
shl ecx,7
|
||||
add dword[.mode7yrpos],edx
|
||||
lea edi,[ecx+vrama]
|
||||
jmp %%nextposy
|
||||
|
||||
%%finishmode7
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near %2
|
||||
ret
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, no repetition mode
|
||||
;**********************************************************
|
||||
|
||||
%%norep2
|
||||
test byte[mode7set],40h
|
||||
jnz %%tilerep2
|
||||
jmp %%nextvalb2
|
||||
ALIGN16
|
||||
%%nextvalb2
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja %%offscr2
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near %%offscr3
|
||||
%%offscr2
|
||||
mov eax,[.mode7xadder]
|
||||
mov ebx,[.mode7yadder]
|
||||
add [.mode7xpos],eax
|
||||
sub [.mode7ypos],ebx
|
||||
add esi,%3
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalb2
|
||||
jmp %%finishmode7
|
||||
%%tilerep2
|
||||
%%nextvalb3
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja %%offscr2b
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near %%offscr3
|
||||
%%offscr2b
|
||||
mov ch,[.mode7xpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov cl,[.mode7ypos+1]
|
||||
mov ebx,[.mode7yadder]
|
||||
mov dl,[mode7tab+ecx]
|
||||
add [.mode7xpos],eax
|
||||
mov dl,[vrama+edx]
|
||||
sub [.mode7ypos],ebx
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalb3
|
||||
jmp %%finishmode7
|
||||
%%offscr3
|
||||
mov eax,[.mode7xpos]
|
||||
and eax,7FFh
|
||||
mov [.mode7xrpos],eax
|
||||
mov eax,[.mode7ypos]
|
||||
and eax,7FFh
|
||||
mov [.mode7yrpos],eax
|
||||
|
||||
; get tile data offset into edi
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
mov edi,[vram]
|
||||
xor ch,ch
|
||||
mov [.mode7ptr],ebx
|
||||
mov cl,[edi+ebx]
|
||||
shl ecx,7
|
||||
add edi,ecx
|
||||
|
||||
jmp %%nextvalr
|
||||
ALIGN16
|
||||
%%nodr2
|
||||
add esi,%3
|
||||
dec dword[.temp]
|
||||
jz near %%fin2
|
||||
%%nextvalr
|
||||
test byte[.mode7xrpos+1],08h
|
||||
jnz near %%rposoffxr
|
||||
%%nextposxr
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near %%rposoffyr
|
||||
%%nextposyr
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
mov edx,[.mode7xadder]
|
||||
add dword[.mode7xrpos],edx
|
||||
mov edx,[.mode7xadder]
|
||||
sub dword[.mode7yrpos],edx
|
||||
xor edx,edx
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov dl,[edi+edx]
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalr
|
||||
%%fin2
|
||||
jmp %%finishmode7
|
||||
%%rposoffxr
|
||||
mov al,[.mode7xinc]
|
||||
mov edi,[vram]
|
||||
add [.mode7ptr],al
|
||||
mov cl,byte[.mode7xincc]
|
||||
cmp byte[.mode7ptr],cl
|
||||
je %%roff
|
||||
%%roffxretb
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadd2]
|
||||
shl ecx,7
|
||||
sub [.mode7xrpos],eax
|
||||
add edi,ecx
|
||||
jmp %%nextposxr
|
||||
%%rposoffyr
|
||||
mov al,[.mode7yinc]
|
||||
mov edi,[vram]
|
||||
sub [.mode7ptr+1],al
|
||||
js %%roff
|
||||
%%roffyretb
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7yadd2]
|
||||
shl ecx,7
|
||||
add [.mode7yrpos],eax
|
||||
add edi,ecx
|
||||
jmp %%nextposyr
|
||||
%%roff
|
||||
test byte[mode7set],40h
|
||||
jnz %%tilerep3
|
||||
jmp %%finishmode7
|
||||
%%tilerep3
|
||||
and byte[.mode7yrpos+1],07h
|
||||
and byte[.mode7xrpos+1],07h
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
add [.mode7xrpos],eax
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[vrama+edx]
|
||||
sub [.mode7yrpos],eax
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%tilerep3
|
||||
jmp %%finishmode7
|
||||
%endmacro
|
||||
|
||||
|
||||
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either
|
||||
;version 2 of the License, or (at your option) any later
|
||||
;version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%macro Mode7Calculate 0
|
||||
; mode 7, ax = curyposition, dx = curxposition (left side)
|
||||
; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen
|
||||
; center map coordinates = (X0,Y0)
|
||||
; 1.) cx=X0-bg1scrolx, cy =Y0-ax
|
||||
|
||||
mov bx,[mode7X0]
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonega
|
||||
or bx,1110000000000000b
|
||||
.nonega
|
||||
mov [.cxloc],bx
|
||||
mov bx,dx
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegb
|
||||
or bx,1110000000000000b
|
||||
.nonegb
|
||||
sub [.cxloc],bx
|
||||
mov bx,ax
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegc
|
||||
or bx,1110000000000000b
|
||||
.nonegc
|
||||
mov [.cyloc],bx
|
||||
mov bx,[mode7Y0]
|
||||
and bx,0001111111111111b ; 13 -> 16 bit signed value
|
||||
test bx,0001000000000000b
|
||||
jz .nonegd
|
||||
or bx,1110000000000000b
|
||||
.nonegd
|
||||
sub word[.cyloc],bx
|
||||
|
||||
; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D)
|
||||
|
||||
movsx eax,word[mode7B]
|
||||
movsx ebx,word[.cyloc]
|
||||
imul eax,ebx
|
||||
mov [.mode7xpos],eax
|
||||
mov bx,word[mode7X0]
|
||||
add [.mode7xpos+1],bx
|
||||
|
||||
movsx ebx,word[.cyloc]
|
||||
movsx eax,word[mode7D]
|
||||
imul eax,ebx
|
||||
mov [.mode7ypos],eax
|
||||
mov bx,word[mode7Y0]
|
||||
add [.mode7ypos+1],bx
|
||||
|
||||
; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B)
|
||||
|
||||
movsx ebx,word[.cxloc]
|
||||
movsx eax,word[mode7A]
|
||||
mov [.mode7xadder],eax
|
||||
imul eax,ebx
|
||||
neg eax
|
||||
add [.mode7xpos],eax
|
||||
|
||||
movsx eax,word[mode7C]
|
||||
movsx ebx,word[.cxloc]
|
||||
neg eax
|
||||
mov [.mode7yadder],eax
|
||||
imul eax,ebx
|
||||
add [.mode7ypos],eax
|
||||
|
||||
test byte[mode7set],1
|
||||
jz .nohflip
|
||||
mov eax,[.mode7xadder]
|
||||
shl eax,8
|
||||
add [.mode7xpos],eax
|
||||
neg dword[.mode7xadder]
|
||||
mov eax,[.mode7yadder]
|
||||
shl eax,8
|
||||
sub [.mode7ypos],eax
|
||||
neg dword[.mode7yadder]
|
||||
.nohflip
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Process 3
|
||||
mov dword[.temp],256
|
||||
test byte[mode7set],80h
|
||||
jnz near %%norep2
|
||||
|
||||
mov eax,[.mode7xpos]
|
||||
and eax,7FFh
|
||||
mov [.mode7xrpos],eax
|
||||
mov eax,[.mode7ypos]
|
||||
and eax,7FFh
|
||||
mov [.mode7yrpos],eax
|
||||
|
||||
; get tile data offset into edi
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
mov edi,[vram]
|
||||
xor ecx,ecx
|
||||
mov [.mode7ptr],ebx
|
||||
mov cl,[edi+ebx]
|
||||
shl ecx,7
|
||||
add edi,ecx
|
||||
|
||||
mov eax,[.mode7xrpos]
|
||||
mov ebx,[.mode7ptr]
|
||||
jmp %%nextval
|
||||
ALIGN16
|
||||
%%nextval
|
||||
test ah,08h
|
||||
jnz near %%rposoffx
|
||||
%%nextposx
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near %%rposoffy
|
||||
%%nextposy
|
||||
mov ch,ah
|
||||
mov edx,[.mode7yadder]
|
||||
mov cl,byte[.mode7yrpos+1]
|
||||
sub dword[.mode7yrpos],edx
|
||||
xor edx,edx
|
||||
add eax,[.mode7xadder]
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov dl,[edi+edx]
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextval
|
||||
jmp %%finishmode7
|
||||
|
||||
%%rposoffx
|
||||
add bl,[.mode7xinc]
|
||||
xor ecx,ecx
|
||||
mov cl,[vrama+ebx]
|
||||
shl ecx,7
|
||||
sub eax,[.mode7xadd2]
|
||||
lea edi,[ecx+vrama]
|
||||
jmp %%nextposx
|
||||
|
||||
%%rposoffy
|
||||
sub bh,[.mode7yinc]
|
||||
and ebx,07FFFh
|
||||
xor ecx,ecx
|
||||
mov cl,[vrama+ebx]
|
||||
mov edx,[.mode7yadd2]
|
||||
shl ecx,7
|
||||
add dword[.mode7yrpos],edx
|
||||
lea edi,[ecx+vrama]
|
||||
jmp %%nextposy
|
||||
|
||||
%%finishmode7
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near %2
|
||||
ret
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, no repetition mode
|
||||
;**********************************************************
|
||||
|
||||
%%norep2
|
||||
test byte[mode7set],40h
|
||||
jnz %%tilerep2
|
||||
jmp %%nextvalb2
|
||||
ALIGN16
|
||||
%%nextvalb2
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja %%offscr2
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near %%offscr3
|
||||
%%offscr2
|
||||
mov eax,[.mode7xadder]
|
||||
mov ebx,[.mode7yadder]
|
||||
add [.mode7xpos],eax
|
||||
sub [.mode7ypos],ebx
|
||||
add esi,%3
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalb2
|
||||
jmp %%finishmode7
|
||||
%%tilerep2
|
||||
%%nextvalb3
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja %%offscr2b
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near %%offscr3
|
||||
%%offscr2b
|
||||
mov ch,[.mode7xpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov cl,[.mode7ypos+1]
|
||||
mov ebx,[.mode7yadder]
|
||||
mov dl,[mode7tab+ecx]
|
||||
add [.mode7xpos],eax
|
||||
mov dl,[vrama+edx]
|
||||
sub [.mode7ypos],ebx
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalb3
|
||||
jmp %%finishmode7
|
||||
%%offscr3
|
||||
mov eax,[.mode7xpos]
|
||||
and eax,7FFh
|
||||
mov [.mode7xrpos],eax
|
||||
mov eax,[.mode7ypos]
|
||||
and eax,7FFh
|
||||
mov [.mode7yrpos],eax
|
||||
|
||||
; get tile data offset into edi
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
mov edi,[vram]
|
||||
xor ch,ch
|
||||
mov [.mode7ptr],ebx
|
||||
mov cl,[edi+ebx]
|
||||
shl ecx,7
|
||||
add edi,ecx
|
||||
|
||||
jmp %%nextvalr
|
||||
ALIGN16
|
||||
%%nodr2
|
||||
add esi,%3
|
||||
dec dword[.temp]
|
||||
jz near %%fin2
|
||||
%%nextvalr
|
||||
test byte[.mode7xrpos+1],08h
|
||||
jnz near %%rposoffxr
|
||||
%%nextposxr
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near %%rposoffyr
|
||||
%%nextposyr
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
mov edx,[.mode7xadder]
|
||||
add dword[.mode7xrpos],edx
|
||||
mov edx,[.mode7xadder]
|
||||
sub dword[.mode7yrpos],edx
|
||||
xor edx,edx
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov dl,[edi+edx]
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%nextvalr
|
||||
%%fin2
|
||||
jmp %%finishmode7
|
||||
%%rposoffxr
|
||||
mov al,[.mode7xinc]
|
||||
mov edi,[vram]
|
||||
add [.mode7ptr],al
|
||||
mov cl,byte[.mode7xincc]
|
||||
cmp byte[.mode7ptr],cl
|
||||
je %%roff
|
||||
%%roffxretb
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadd2]
|
||||
shl ecx,7
|
||||
sub [.mode7xrpos],eax
|
||||
add edi,ecx
|
||||
jmp %%nextposxr
|
||||
%%rposoffyr
|
||||
mov al,[.mode7yinc]
|
||||
mov edi,[vram]
|
||||
sub [.mode7ptr+1],al
|
||||
js %%roff
|
||||
%%roffyretb
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7yadd2]
|
||||
shl ecx,7
|
||||
add [.mode7yrpos],eax
|
||||
add edi,ecx
|
||||
jmp %%nextposyr
|
||||
%%roff
|
||||
test byte[mode7set],40h
|
||||
jnz %%tilerep3
|
||||
jmp %%finishmode7
|
||||
%%tilerep3
|
||||
and byte[.mode7yrpos+1],07h
|
||||
and byte[.mode7xrpos+1],07h
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
add [.mode7xrpos],eax
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[vrama+edx]
|
||||
sub [.mode7yrpos],eax
|
||||
%1
|
||||
dec dword[.temp]
|
||||
jnz near %%tilerep3
|
||||
jmp %%finishmode7
|
||||
%endmacro
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user