First release of ZSNES sources
This commit is contained in:
29
zsnes/src/betauser.mac
Normal file
29
zsnes/src/betauser.mac
Normal file
@@ -0,0 +1,29 @@
|
||||
;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 USERNAMEN 'Public'
|
||||
%define USERNAMEC 'P'^76,'b'^89,'-'^178,'|'^34,'-'^217
|
||||
%define USERNAMEI 0 ; 1
|
||||
|
||||
|
||||
1874
zsnes/src/cfgload.asm
Normal file
1874
zsnes/src/cfgload.asm
Normal file
File diff suppressed because it is too large
Load Diff
953
zsnes/src/chips/dsp1emu.c
Normal file
953
zsnes/src/chips/dsp1emu.c
Normal file
@@ -0,0 +1,953 @@
|
||||
//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 <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
|
||||
#define DebugDSP1
|
||||
|
||||
// uncomment some lines to test
|
||||
//#define printinfo
|
||||
//#define debug02
|
||||
//#define debug0A
|
||||
//#define debug06
|
||||
|
||||
|
||||
#ifdef DebugDSP1
|
||||
|
||||
FILE * LogFile = NULL;
|
||||
|
||||
void Log_Message (char *Message, ...)
|
||||
{
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap,Message);
|
||||
vsprintf(Msg,Message,ap );
|
||||
va_end(ap);
|
||||
|
||||
strcat(Msg,"\r\n\0");
|
||||
fwrite(Msg,strlen(Msg),1,LogFile);
|
||||
}
|
||||
|
||||
void Start_Log (void)
|
||||
{
|
||||
char LogFileName[255];
|
||||
char *p;
|
||||
|
||||
strcpy(LogFileName,"dsp1emu.log\0");
|
||||
|
||||
LogFile = fopen(LogFileName,"wb");
|
||||
}
|
||||
|
||||
void Stop_Log (void)
|
||||
{
|
||||
if (LogFile)
|
||||
{
|
||||
fclose(LogFile);
|
||||
LogFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* Math tables *
|
||||
\***************************************************************************/
|
||||
|
||||
int CosTable2[256]={65536,65516,65457,65358,65220,65043,64826,64571,64276,63943,63571,63161,62713,62227,61704,61144,60546,59912,59243,58537,57796,
|
||||
57020,56210,55367,54489,53579,52637,51663,50658,49622,48556,47461,46338,45187,44008,42803,41572,
|
||||
40316,39036,37732,36406,35057,33688,32298,30889,29461,28015,26553,25074,23581,22073,20552,19018,17473,15918,14353,12779,11198,9610,8016,6417,4814,
|
||||
3209,1601,-6,-1615,-3222,-4828,-6430,-8029,-9623,-11211,-12792,-14366,-15931,-17486,-19031,-20565,-22086,-23593,-25087,-26565,-28028,-29473,
|
||||
-30901,-32310,-33700,-35069,-36417,-37743,-39047,-40327,-41583,-42813,-44018,-45197,-46348,-47471,-48565,
|
||||
-49631,-50666,-51671,-52645,-53587,-54497,-55374,-56217,-57027,-57802,-58543,-59248,-59918,-60551,-61148,
|
||||
-61709,-62232,-62717,-63165,-63575,-63946,-64279,-64573,-64828,-65044,-65221,-65359,-65457,-65516,-65535,
|
||||
-65515,-65456,-65357,-65219,-65041,-64824,-64568,-64273,-63940,-63568,-63158,-62709,-62223,-61699,-61139,
|
||||
-60541,-59907,-59237,-58531,-57790,-57014,-56203,-55359,-54482,-53571,-52629,-51654,-50649,-49613,-48547,
|
||||
-47452,-46328,-45177,-43998,-42793,-41562,-40306,-39025,-37721,-36395,-35046,-33676,-32286,-30877,-29449,
|
||||
-28003,-26540,-25062,-23568,-22060,-20539,-19005,-17460,-15905,-14340,-12766,-11184,-9596,-8002,-6403,
|
||||
-4801,-3195,-1588,20,1628,3236,4841,6444,8043,9636,11224,12806,14379,15944,17500,19044,20578,22099,
|
||||
23606,25099,26578,28040,29485,30913,32322,33711,35080,36428,37754,39058,40338,41593,42824,44028,
|
||||
45206,46357,47480,48575,49640,50675,51680,52653,53595,54504,55381,56224,57034,57809,58549,59254,
|
||||
59923,60557,61153,61713,62236,62721,63168,63578,63949,64281,64575,64830,65046,65223,65360,65458,65516};
|
||||
|
||||
int SinTable2[256]={0,1608,3215,4821,6424,8022,9616,11204,12786,14359,15924,17480,19025,20558,22079,
|
||||
23587,25081,26559,28021,29467,30895,32304,33694,35063,36411,37738,39041,40322,41577,42808,44013,
|
||||
45192,46343,47466,48561,49626,50662,51667,52641,53583,54493,55370,56214,57024,57799,58540,59245,
|
||||
59915,60549,61146,61706,62229,62715,63163,63573,63944,64277,64572,64827,65043,65221,65358,65457,
|
||||
65516,65535,65516,65456,65357,65219,65042,64825,64569,64275,63941,63570,63159,62711,62225,61702,
|
||||
61141,60544,59910,59240,58534,57793,57017,56207,55363,54486,53575,52633,51659,50653,49617,48552,
|
||||
47457,46333,45182,44003,42798,41567,40311,39031,37727,36400,35052,33682,32292,30883,29455,28009,
|
||||
26547,25068,23574,22067,20545,19012,17467,15911,14346,12772,11191,9603,8009,6410,4807,3202,1594,
|
||||
-13,-1622,-3229,-4834,-6437,-8036,-9630,-11218,-12799,-14373,-15938,-17493,-19038,-20571,-22092,
|
||||
-23600,-25093,-26571,-28034,-29479,-30907,-32316,-33705,-35075,-36423,-37749,-39052,-40332,-41588,-42818,-44023,-45201,-46352,-47476,-48570,-49635,-50671,-51675,-52649,-53591,-54501,-55377,-56221,-57030,-57806,-58546,-59251,-59921,-60554,-61151,-61711,
|
||||
-62234,-62719,-63167,-63576,-63947,-64280,-64574,-64829,-65045,-65222,-65359,-65458,-65516,-65535,
|
||||
-65515,-65456,-65356,-65218,-65040,-64823,-64567,-64272,-63938,-63566,-63156,-62707,-62221,-61697,
|
||||
-61136,-60538,-59904,-59234,-58528,-57786,-57010,-56200,-55356,-54478,-53567,-52625,-51650,-50645,
|
||||
-49609,-48543,-47447,-46324,-45172,-43993,-42788,-41556,-40300,-39020,-37716,-36389,-35040,-33670,
|
||||
-32280,-30871,-29443,-27997,-26534,-25056,-23562,-22054,-20532,-18999,-17454,-15898,-14333,-12759,
|
||||
-11178,-9589,-7995,-6397,-4794,-3188,-1581};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* C4 C code *
|
||||
\***************************************************************************/
|
||||
|
||||
|
||||
short C4WFXVal;
|
||||
short C4WFYVal;
|
||||
short C4WFZVal;
|
||||
short C4WFX2Val;
|
||||
short C4WFY2Val;
|
||||
short C4WFDist;
|
||||
short C4WFScale;
|
||||
double tanval;
|
||||
double c4x,c4y,c4z;
|
||||
double c4x2,c4y2,c4z2;
|
||||
|
||||
C4TransfWireFrame()
|
||||
{
|
||||
c4x=(double)C4WFXVal;
|
||||
c4y=(double)C4WFYVal;
|
||||
c4z=(double)C4WFZVal-0x95;
|
||||
|
||||
// Rotate X
|
||||
tanval=-(double)C4WFX2Val*3.14159265*2/128;
|
||||
c4y2=c4y*cos(tanval)-c4z*sin(tanval);
|
||||
c4z2=c4y*sin(tanval)+c4z*cos(tanval);
|
||||
|
||||
// Rotate Y
|
||||
tanval=-(double)C4WFY2Val*3.14159265*2/128;
|
||||
c4x2=c4x*cos(tanval)+c4z2*sin(tanval);
|
||||
c4z=c4x*-sin(tanval)+c4z2*cos(tanval);
|
||||
|
||||
// Rotate Z
|
||||
tanval=-(double)C4WFDist*3.14159265*2/128;
|
||||
c4x=c4x2*cos(tanval)-c4y2*sin(tanval);
|
||||
c4y=c4x2*sin(tanval)+c4y2*cos(tanval);
|
||||
|
||||
// Scale
|
||||
C4WFXVal=c4x*(double)C4WFScale/(0x90*(c4z+0x95))*0x95;
|
||||
C4WFYVal=c4y*(double)C4WFScale/(0x90*(c4z+0x95))*0x95;
|
||||
}
|
||||
|
||||
C4TransfWireFrame2()
|
||||
{
|
||||
c4x=(double)C4WFXVal;
|
||||
c4y=(double)C4WFYVal;
|
||||
c4z=(double)C4WFZVal;
|
||||
|
||||
// Rotate X
|
||||
tanval=-(double)C4WFX2Val*3.14159265*2/128;
|
||||
c4y2=c4y*cos(tanval)-c4z*sin(tanval);
|
||||
c4z2=c4y*sin(tanval)+c4z*cos(tanval);
|
||||
|
||||
// Rotate Y
|
||||
tanval=-(double)C4WFY2Val*3.14159265*2/128;
|
||||
c4x2=c4x*cos(tanval)+c4z2*sin(tanval);
|
||||
c4z=c4x*-sin(tanval)+c4z2*cos(tanval);
|
||||
|
||||
// Rotate Z
|
||||
tanval=-(double)C4WFDist*3.14159265*2/128;
|
||||
c4x=c4x2*cos(tanval)-c4y2*sin(tanval);
|
||||
c4y=c4x2*sin(tanval)+c4y2*cos(tanval);
|
||||
|
||||
// Scale
|
||||
C4WFXVal=c4x*(double)C4WFScale/0x100;
|
||||
C4WFYVal=c4y*(double)C4WFScale/0x100;
|
||||
}
|
||||
|
||||
C4CalcWireFrame()
|
||||
{
|
||||
C4WFXVal=C4WFX2Val-C4WFXVal;
|
||||
C4WFYVal=C4WFY2Val-C4WFYVal;
|
||||
if (abs(C4WFXVal)>abs(C4WFYVal)){
|
||||
C4WFDist=abs(C4WFXVal)+1;
|
||||
C4WFYVal=256*(double)C4WFYVal/abs((double)C4WFXVal);
|
||||
if (C4WFXVal<0) C4WFXVal=-256;
|
||||
else C4WFXVal=256;
|
||||
}
|
||||
else
|
||||
if (C4WFYVal!=0) {
|
||||
C4WFDist=abs(C4WFYVal)+1;
|
||||
C4WFXVal=256*(double)C4WFXVal/abs((double)C4WFYVal);
|
||||
if (C4WFYVal<0) C4WFYVal=-256;
|
||||
else C4WFYVal=256;
|
||||
}
|
||||
else C4WFDist=0;
|
||||
}
|
||||
|
||||
short C41FXVal;
|
||||
short C41FYVal;
|
||||
short C41FAngleRes;
|
||||
short C41FDist;
|
||||
short C41FDistVal;
|
||||
|
||||
C4Op1F()
|
||||
{
|
||||
if (C41FXVal == 0) {
|
||||
if (C41FYVal>0) C41FAngleRes=0x80;
|
||||
else C41FAngleRes=0x180;
|
||||
}
|
||||
else {
|
||||
tanval = ((double)C41FYVal)/((double)C41FXVal);
|
||||
C41FAngleRes=atan(tanval)/(3.141592675*2)*512;
|
||||
C41FAngleRes=C41FAngleRes;
|
||||
if (C41FXVal<0) C41FAngleRes+=0x100;
|
||||
C41FAngleRes&=0x1FF;
|
||||
}
|
||||
}
|
||||
|
||||
C4Op15()
|
||||
{
|
||||
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
||||
((double)C41FXVal));
|
||||
C41FDist=tanval;
|
||||
}
|
||||
|
||||
C4Op0D()
|
||||
{
|
||||
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
||||
((double)C41FXVal));
|
||||
tanval=(double)C41FDistVal/tanval;
|
||||
C41FYVal=((double)C41FYVal*tanval)*0.99;
|
||||
C41FXVal=((double)C41FXVal*tanval)*0.98;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* DSP1 code *
|
||||
\***************************************************************************/
|
||||
|
||||
|
||||
void InitDSP(void)
|
||||
{
|
||||
#ifdef DebugDSP1
|
||||
Start_Log();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
short Op00Multiplicand;
|
||||
short Op00Multiplier;
|
||||
short Op00Result;
|
||||
|
||||
DSPOp00()
|
||||
{
|
||||
Op00Result=Op00Multiplicand*Op00Multiplier/32768;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP00 MULT %d*%d/32768=%d",Op00Multiplicand,Op00Multiplier,Op00Result);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
short Op10Coefficient;
|
||||
short Op10Exponent;
|
||||
short Op10CoefficientR;
|
||||
short Op10ExponentR;
|
||||
|
||||
// To fix...
|
||||
|
||||
DSPOp10()
|
||||
{
|
||||
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP10 NOT IMPLEMENTED");
|
||||
#endif
|
||||
|
||||
Op10ExponentR=-Op10Exponent;
|
||||
Op10CoefficientR=1/Op10Coefficient;
|
||||
}
|
||||
|
||||
|
||||
short Op04Angle;
|
||||
unsigned short Op04Radius;
|
||||
short Op04Sin;
|
||||
short Op04Cos;
|
||||
|
||||
DSPOp04()
|
||||
{
|
||||
Op04Sin=SinTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
||||
Op04Cos=CosTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP04 Angle:%d Radius:%d",(Op04Angle/256)&255,Op04Radius);
|
||||
Log_Message("OP04 SIN:%d COS:%d",Op04Sin,Op04Cos);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
short Op08X;
|
||||
short Op08Y;
|
||||
short Op08Z;
|
||||
int Op08Size;
|
||||
|
||||
DSPOp08Radius()
|
||||
{
|
||||
Op08Size=(Op08X*Op08X+Op08Y*Op08Y+Op08Z*Op08Z)*2;
|
||||
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP08 %d,%d,%d",Op08X,Op08Y,Op08Z);
|
||||
Log_Message("OP08 ((Op08X^2)+(Op08Y^2)+(Op08X^2))*2=%d",Op08Size );
|
||||
#endif
|
||||
}
|
||||
|
||||
short Op18X;
|
||||
short Op18Y;
|
||||
short Op18Z;
|
||||
short Op18R;
|
||||
short Op18Difference;
|
||||
|
||||
DSPOp18()
|
||||
{
|
||||
Op18Difference=((Op18X*Op18X+Op18Y*Op18Y+Op18Z*Op18Z-Op18R*Op18R)*2)/65536;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP18 DIFF %d",Op18Difference);
|
||||
#endif
|
||||
}
|
||||
|
||||
short Op28X;
|
||||
short Op28Y;
|
||||
short Op28Z;
|
||||
short Op28R;
|
||||
|
||||
DSPOp28()
|
||||
{
|
||||
Op28R=sqrt(abs(Op28X*Op28X+Op28Y*Op28Y+Op28Z*Op28Z));
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP28 X:%d Y:%d Z:%d",Op18X,Op18Y,Op18Z);
|
||||
Log_Message("OP28 Vector Length %d",Op18R);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned short Op0CA;
|
||||
short Op0CX1;
|
||||
short Op0CY1;
|
||||
short Op0CX2;
|
||||
short Op0CY2;
|
||||
|
||||
DSPOp0C()
|
||||
{
|
||||
Op0CX2=(Op0CX1*CosTable2[(Op0CA/256)&255]+Op0CY1*SinTable2[(Op0CA/256)&255])/65536;
|
||||
Op0CY2=(Op0CX1*-SinTable2[(Op0CA/256)&255]+Op0CY1*CosTable2[(Op0CA/256)&255])/65536;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP0C Angle:%d X:%d Y:%d CX:%d CY:%d",(Op0CA/256)&255,Op0CX1,Op0CY1,Op0CX2,Op0CY2);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned short Op1CAZ;
|
||||
unsigned short Op1CAX;
|
||||
unsigned short Op1CAY;
|
||||
short Op1CX;
|
||||
short Op1CY;
|
||||
short Op1CZ;
|
||||
short Op1CX1;
|
||||
short Op1CY1;
|
||||
short Op1CZ1;
|
||||
short Op1CX2;
|
||||
short Op1CY2;
|
||||
short Op1CZ2;
|
||||
short Op1CX3;
|
||||
short Op1CY3;
|
||||
short Op1CZ3;
|
||||
|
||||
DSPOp1C()
|
||||
{
|
||||
// rotate around Y
|
||||
Op1CX1=(Op1CX*CosTable2[(Op1CAY/256)&255]+Op1CZ*SinTable2[(Op1CAY/256)&255])/65536;
|
||||
Op1CY1=Op1CY;
|
||||
Op1CZ1=(Op1CX*-SinTable2[(Op1CAY/256)&255]+Op1CZ*CosTable2[(Op1CAY/256)&255])/65536;
|
||||
// rotate around X
|
||||
Op1CX2=Op1CX1;
|
||||
Op1CY2=(Op1CY1*CosTable2[(Op1CAX/256)&255]+Op1CZ1*-SinTable2[(Op1CAX/256)&255])/65536;
|
||||
Op1CZ2=(Op1CY1*SinTable2[(Op1CAX/256)&255]+Op1CZ1*CosTable2[(Op1CAX/256)&255])/65536;
|
||||
// rotate around Z
|
||||
Op1CX3=(Op1CX2*CosTable2[(Op1CAZ/256)&255]+Op1CY2*-SinTable2[(Op1CAZ/256)&255])/65536;
|
||||
Op1CY3=(Op1CX2*SinTable2[(Op1CAZ/256)&255]+Op1CY2*CosTable2[(Op1CAZ/256)&255])/65536;
|
||||
Op1CZ3=Op1CZ2;
|
||||
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP1C Apply Matrix CX:%d CY:%d CZ",Op1CX3,Op1CY3,Op1CZ3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
short Op02FX;
|
||||
short Op02FY;
|
||||
short Op02FZ;
|
||||
short Op02LFE;
|
||||
short Op02LES;
|
||||
unsigned short Op02AAS;
|
||||
unsigned short Op02AZS;
|
||||
unsigned short Op02VOF;
|
||||
unsigned short Op02VVA;
|
||||
|
||||
short Op02CX;
|
||||
short Op02CY;
|
||||
double Op02CXF;
|
||||
double Op02CYF;
|
||||
double ViewerX0;
|
||||
double ViewerY0;
|
||||
double ViewerZ0;
|
||||
double ViewerX1;
|
||||
double ViewerY1;
|
||||
double ViewerZ1;
|
||||
double ViewerX;
|
||||
double ViewerY;
|
||||
double ViewerZ;
|
||||
int ViewerAX;
|
||||
int ViewerAY;
|
||||
int ViewerAZ;
|
||||
double NumberOfSlope;
|
||||
double ScreenX;
|
||||
double ScreenY;
|
||||
double ScreenZ;
|
||||
double TopLeftScreenX;
|
||||
double TopLeftScreenY;
|
||||
double TopLeftScreenZ;
|
||||
double BottomRightScreenX;
|
||||
double BottomRightScreenY;
|
||||
double BottomRightScreenZ;
|
||||
double Ready;
|
||||
double RasterLX;
|
||||
double RasterLY;
|
||||
double RasterLZ;
|
||||
double ScreenLX1;
|
||||
double ScreenLY1;
|
||||
double ScreenLZ1;
|
||||
|
||||
DSPOp02()
|
||||
{
|
||||
ViewerZ1=-cos(Op02AZS*6.2832/65536.0);
|
||||
ViewerX1=sin(Op02AZS*6.2832/65536.0)*sin(Op02AAS*6.2832/65536.0);
|
||||
ViewerY1=sin(Op02AZS*6.2832/65536.0)*cos(-Op02AAS*6.2832/65536.0);
|
||||
|
||||
#ifdef debug02
|
||||
printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n",ViewerX1,ViewerY1,
|
||||
ViewerZ1);
|
||||
getch();
|
||||
#endif
|
||||
ViewerX=Op02FX-ViewerX1*Op02LFE;
|
||||
ViewerY=Op02FY-ViewerY1*Op02LFE;
|
||||
ViewerZ=Op02FZ-ViewerZ1*Op02LFE;
|
||||
|
||||
ScreenX=Op02FX+ViewerX1*(Op02LES-Op02LFE);
|
||||
ScreenY=Op02FY+ViewerY1*(Op02LES-Op02LFE);
|
||||
ScreenZ=Op02FZ+ViewerZ1*(Op02LES-Op02LFE);
|
||||
|
||||
#ifdef debug02
|
||||
printf("ViewerX : %f ViewerY : %f ViewerZ : %f\n",ViewerX,ViewerY,ViewerZ);
|
||||
printf("Op02FX : %d Op02FY : %d Op02FZ : %d\n",Op02FX,Op02FY,Op02FZ);
|
||||
printf("ScreenX : %f ScreenY : %f ScreenZ : %f\n",ScreenX,ScreenY,ScreenZ);
|
||||
getch();
|
||||
#endif
|
||||
if (ViewerZ1==0)ViewerZ1++;
|
||||
NumberOfSlope=ViewerZ/-ViewerZ1;
|
||||
|
||||
Op02CX=ViewerX+ViewerX1*NumberOfSlope;
|
||||
Op02CY=ViewerY+ViewerY1*NumberOfSlope;
|
||||
|
||||
Op02CXF=ViewerX+ViewerX1*NumberOfSlope;
|
||||
Op02CYF=ViewerY+ViewerY1*NumberOfSlope;
|
||||
|
||||
Op02VOF=0x0000;
|
||||
if(Op02LFE==0x2200)Op02VVA=0xFECD;
|
||||
else Op02VVA=0xFFB2;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP02 FX:%d FY:%d FZ:%d LFE:%d LES:%d",Op02FX,Op02FY,Op02FZ,Op02LFE,Op02LES);
|
||||
Log_Message(" AAS:%d AZS:%d VOF:%d VVA:%d",Op02AAS,Op02AZS,Op02VOF,Op02VVA);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
short Op0AVS;
|
||||
short Op0AA;
|
||||
short Op0AB;
|
||||
short Op0AC;
|
||||
short Op0AD;
|
||||
|
||||
double RasterRX;
|
||||
double RasterRY;
|
||||
double RasterRZ;
|
||||
double RasterLSlopeX;
|
||||
double RasterLSlopeY;
|
||||
double RasterLSlopeZ;
|
||||
double RasterRSlopeX;
|
||||
double RasterRSlopeY;
|
||||
double RasterRSlopeZ;
|
||||
double GroundLX;
|
||||
double GroundLY;
|
||||
double GroundRX;
|
||||
double GroundRY;
|
||||
double Distance;
|
||||
|
||||
DSPOp0A()
|
||||
{
|
||||
if(Op0AVS==0)Op0AVS++;
|
||||
|
||||
ScreenLZ1=-cos((Op02AZS-16384.0)*6.2832/65536.0); // -16384.0
|
||||
ScreenLX1=sin((Op02AZS-16384.0)*6.2832/65536.0)*-sin(Op02AAS*6.2832/65536.0);
|
||||
ScreenLY1=-sin((Op02AZS-16384.0)*6.2832/65536.0)*-cos(-Op02AAS*6.2832/65536.0);
|
||||
|
||||
RasterRX=RasterLX=ScreenX+(Op0AVS)*ScreenLX1;
|
||||
RasterRY=RasterLY=ScreenY+(Op0AVS)*ScreenLY1;
|
||||
RasterRZ=RasterLZ=ScreenZ+(Op0AVS)*ScreenLZ1;
|
||||
|
||||
ScreenLX1=sin((Op02AAS+16384.0)*6.2832/65536);
|
||||
ScreenLY1=cos(-(Op02AAS+16384.0)*6.2832/65536);
|
||||
|
||||
RasterLX=RasterLX-128*ScreenLX1;
|
||||
RasterLY=RasterLY-128*ScreenLY1;
|
||||
|
||||
RasterRX=RasterRX+128*ScreenLX1;
|
||||
RasterRY=RasterRY+128*ScreenLY1;
|
||||
|
||||
Distance=Op02LFE;
|
||||
if(Distance==0)Distance=1;
|
||||
|
||||
RasterLSlopeX=(RasterLX-ViewerX)/Distance;
|
||||
RasterLSlopeY=(RasterLY-ViewerY)/Distance;
|
||||
RasterLSlopeZ=(RasterLZ-ViewerZ)/Distance;
|
||||
|
||||
RasterRSlopeX=(RasterRX-ViewerX)/Distance;
|
||||
RasterRSlopeY=(RasterRY-ViewerY)/Distance;
|
||||
RasterRSlopeZ=(RasterRZ-ViewerZ)/Distance;
|
||||
|
||||
if(RasterLSlopeZ==0) RasterLSlopeZ++; // divide by 0
|
||||
|
||||
NumberOfSlope=ViewerZ/-RasterLSlopeZ;
|
||||
|
||||
GroundLX=ViewerX+RasterLSlopeX*NumberOfSlope;
|
||||
GroundLY=ViewerY+RasterLSlopeY*NumberOfSlope;
|
||||
|
||||
if(RasterRSlopeZ==0) RasterRSlopeZ++; // divide by 0
|
||||
|
||||
NumberOfSlope=ViewerZ/-RasterRSlopeZ;
|
||||
|
||||
GroundRX=ViewerX+RasterRSlopeX*NumberOfSlope;
|
||||
GroundRY=ViewerY+RasterRSlopeY*NumberOfSlope;
|
||||
|
||||
|
||||
if(Op02LES==0)Op02LES=1;
|
||||
|
||||
Op0AA=(GroundRX-GroundLX);
|
||||
Op0AB=(GroundRY-GroundLY); //0x300/Op02LES*2;
|
||||
|
||||
if(Op0AVS!=0)
|
||||
{
|
||||
Op0AC=(((Op02CXF)-((GroundRX+GroundLX)/2)))/Op0AVS;
|
||||
Op0AD=(((Op02CYF)-((GroundRY+GroundLY)/2)))/Op0AVS*256;
|
||||
}
|
||||
else
|
||||
{
|
||||
Op0AC=0;
|
||||
Op0AD=0;
|
||||
}
|
||||
Op0AVS+=1;
|
||||
}
|
||||
|
||||
short Op06X;
|
||||
short Op06Y;
|
||||
short Op06Z;
|
||||
short Op06H;
|
||||
short Op06V;
|
||||
unsigned short Op06S;
|
||||
|
||||
double ObjPX;
|
||||
double ObjPY;
|
||||
double ObjPZ;
|
||||
double ObjPX1;
|
||||
double ObjPY1;
|
||||
double ObjPZ1;
|
||||
double ObjPX2;
|
||||
double ObjPY2;
|
||||
double ObjPZ2;
|
||||
double DivideOp06;
|
||||
int Temp;
|
||||
|
||||
DSPOp06()
|
||||
{
|
||||
|
||||
ObjPX=Op06X-Op02CXF;
|
||||
ObjPY=Op06Y-Op02CYF;
|
||||
ObjPZ=Op06Z;
|
||||
|
||||
// rotate around Z
|
||||
ObjPX1=(ObjPX*cos((-Op02AAS+32768)/65536.0*6.2832)+ObjPY*-sin((-Op02AAS+32768)/65536.0*6.2832));
|
||||
ObjPY1=(ObjPX*sin((-Op02AAS+32768)/65536.0*6.2832)+ObjPY*cos((-Op02AAS+32768)/65536.0*6.2832));
|
||||
ObjPZ1=ObjPZ;
|
||||
|
||||
// rotate around X
|
||||
ObjPX2=ObjPX1;
|
||||
ObjPY2=(ObjPY1*cos((-Op02AZS)/65536.0*6.2832)+ObjPZ1*-sin((-Op02AZS)/65536.0*6.2832));
|
||||
ObjPZ2=(ObjPY1*sin((-Op02AZS)/65536.0*6.2832)+ObjPZ1*cos((-Op02AZS)/65536.0*6.2832));
|
||||
|
||||
#ifdef debug06
|
||||
printf("ObjPX2: %f ObjPY2: %f ObjPZ2: %f\n",ObjPX2,ObjPY2,ObjPZ2);
|
||||
#endif
|
||||
|
||||
ObjPZ2=ObjPZ2-Op02LFE;
|
||||
|
||||
if (ObjPZ2<0)
|
||||
{
|
||||
Op06H=-ObjPX2*Op02LES/-(ObjPZ2); //-ObjPX2*256/-ObjPZ2;
|
||||
Op06V=-ObjPY2*Op02LES/-(ObjPZ2); //-ObjPY2*256/-ObjPZ2;
|
||||
Op06S=256*Op02LES/-ObjPZ2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Op06H=0;
|
||||
Op06V=14*16;
|
||||
}
|
||||
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP06 X:%d Y:%d Z:%d",Op06X,Op06Y,Op06Z);
|
||||
Log_Message("OP06 H:%d V:%d S:%d",Op06H,Op06V,Op06S);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
double matrix[4][4];
|
||||
double smat[4][4];
|
||||
double tmat[4][4];
|
||||
double xmat[4][4];
|
||||
double ymat[4][4];
|
||||
double zmat[4][4];
|
||||
double matrix0[4][4];
|
||||
double matrix1[4][4];
|
||||
double matrix2[4][4];
|
||||
double matrixI0[4][4];
|
||||
double matrixI1[4][4];
|
||||
double matrixI2[4][4];
|
||||
|
||||
void InitMatrix()
|
||||
{
|
||||
matrix[0][0]=1; matrix[0][1]=0; matrix[0][2]=0; matrix[0][3]=0;
|
||||
matrix[1][0]=0; matrix[1][1]=1; matrix[1][2]=0; matrix[1][3]=0;
|
||||
matrix[2][0]=0; matrix[2][1]=0; matrix[2][2]=1; matrix[2][3]=0;
|
||||
matrix[3][0]=0; matrix[3][1]=0; matrix[3][2]=0; matrix[3][3]=1;
|
||||
}
|
||||
|
||||
|
||||
void MultMatrix(double result[4][4],double mat1[4][4],double mat2[4][4])
|
||||
{
|
||||
result[0][0]=0;
|
||||
result[0][0]+=(mat1[0][0]*mat2[0][0]+mat1[0][1]*mat2[1][0]+mat1[0][2]*mat2[2][0]+mat1[0][3]*mat2[3][0]);
|
||||
result[0][1]=0;
|
||||
result[0][1]+=(mat1[0][0]*mat2[0][1]+mat1[0][1]*mat2[1][1]+mat1[0][2]*mat2[2][1]+mat1[0][3]*mat2[3][1]);
|
||||
result[0][2]=0;
|
||||
result[0][2]+=(mat1[0][0]*mat2[0][2]+mat1[0][1]*mat2[1][2]+mat1[0][2]*mat2[2][2]+mat1[0][3]*mat2[3][2]);
|
||||
result[0][3]=0;
|
||||
result[0][3]+=(mat1[0][0]*mat2[0][3]+mat1[0][1]*mat2[1][3]+mat1[0][2]*mat2[2][3]+mat1[0][3]*mat2[3][3]);
|
||||
|
||||
result[1][0]=0;
|
||||
result[1][0]+=(mat1[1][0]*mat2[0][0]+mat1[1][1]*mat2[1][0]+mat1[1][2]*mat2[2][0]+mat1[1][3]*mat2[3][0]);
|
||||
result[1][1]=0;
|
||||
result[1][1]+=(mat1[1][0]*mat2[0][1]+mat1[1][1]*mat2[1][1]+mat1[1][2]*mat2[2][1]+mat1[1][3]*mat2[3][1]);
|
||||
result[1][2]=0;
|
||||
result[1][2]+=(mat1[1][0]*mat2[0][2]+mat1[1][1]*mat2[1][2]+mat1[1][2]*mat2[2][2]+mat1[1][3]*mat2[3][2]);
|
||||
result[1][3]=0;
|
||||
result[1][3]+=(mat1[1][0]*mat2[0][3]+mat1[1][1]*mat2[1][3]+mat1[1][2]*mat2[2][3]+mat1[1][3]*mat2[3][3]);
|
||||
|
||||
result[2][0]=0;
|
||||
result[2][0]+=(mat1[2][0]*mat2[0][0]+mat1[2][1]*mat2[1][0]+mat1[2][2]*mat2[2][0]+mat1[2][3]*mat2[3][0]);
|
||||
result[2][1]=0;
|
||||
result[2][1]+=(mat1[2][0]*mat2[0][1]+mat1[2][1]*mat2[1][1]+mat1[2][2]*mat2[2][1]+mat1[2][3]*mat2[3][1]);
|
||||
result[2][2]=0;
|
||||
result[2][2]+=(mat1[2][0]*mat2[0][2]+mat1[2][1]*mat2[1][2]+mat1[2][2]*mat2[2][2]+mat1[2][3]*mat2[3][2]);
|
||||
result[2][3]=0;
|
||||
result[2][3]+=(mat1[2][0]*mat2[0][3]+mat1[2][1]*mat2[1][3]+mat1[2][2]*mat2[2][3]+mat1[2][3]*mat2[3][3]);
|
||||
|
||||
result[3][0]=0;
|
||||
result[3][0]+=(mat1[3][0]*mat2[0][0]+mat1[3][1]*mat2[1][0]+mat1[3][2]*mat2[2][0]+mat1[3][3]*mat2[3][0]);
|
||||
result[3][1]=0;
|
||||
result[3][1]+=(mat1[3][0]*mat2[0][1]+mat1[3][1]*mat2[1][1]+mat1[3][2]*mat2[2][1]+mat1[3][3]*mat2[3][1]);
|
||||
result[3][2]=0;
|
||||
result[3][2]+=(mat1[3][0]*mat2[0][2]+mat1[3][1]*mat2[1][2]+mat1[3][2]*mat2[2][2]+mat1[3][3]*mat2[3][2]);
|
||||
result[3][3]=0;
|
||||
result[3][3]+=(mat1[3][0]*mat2[0][3]+mat1[3][1]*mat2[1][3]+mat1[3][2]*mat2[2][3]+mat1[3][3]*mat2[3][3]);
|
||||
}
|
||||
|
||||
void CopyMatrix(double dest[4][4],double source[4][4])
|
||||
{
|
||||
dest[0][0]=source[0][0];
|
||||
dest[0][1]=source[0][1];
|
||||
dest[0][2]=source[0][2];
|
||||
dest[0][3]=source[0][3];
|
||||
dest[1][0]=source[1][0];
|
||||
dest[1][1]=source[1][1];
|
||||
dest[1][2]=source[1][2];
|
||||
dest[1][3]=source[1][3];
|
||||
dest[2][0]=source[2][0];
|
||||
dest[2][1]=source[2][1];
|
||||
dest[2][2]=source[2][2];
|
||||
dest[2][3]=source[2][3];
|
||||
dest[3][0]=source[3][0];
|
||||
dest[3][1]=source[3][1];
|
||||
dest[3][2]=source[3][2];
|
||||
dest[3][3]=source[3][3];
|
||||
}
|
||||
|
||||
void scale(double sf)
|
||||
{
|
||||
double mat[4][4];
|
||||
smat[0][0]=sf; smat[0][1]=0; smat[0][2]=0; smat[0][3]=0;
|
||||
smat[1][0]=0; smat[1][1]=sf; smat[1][2]=0; smat[1][3]=0;
|
||||
smat[2][0]=0; smat[2][1]=0; smat[2][2]=sf; smat[2][3]=0;
|
||||
smat[3][0]=0; smat[3][1]=0; smat[3][2]=0; smat[3][3]=1;
|
||||
MultMatrix(mat,smat,matrix);
|
||||
CopyMatrix(matrix,mat);
|
||||
}
|
||||
|
||||
void translate(double xt,double yt,double zt)
|
||||
{
|
||||
double mat[4][4];
|
||||
tmat[0][0]=1; tmat[0][1]=0; tmat[0][2]=0; tmat[0][3]=0;
|
||||
tmat[1][0]=0; tmat[1][1]=1; tmat[1][2]=0; tmat[1][3]=0;
|
||||
tmat[2][0]=0; tmat[2][1]=0; tmat[2][2]=1; tmat[2][3]=0;
|
||||
tmat[3][0]=xt; tmat[3][1]=yt; tmat[3][2]=zt; tmat[3][3]=1;
|
||||
MultMatrix(mat,matrix,tmat);
|
||||
CopyMatrix(matrix,mat);
|
||||
}
|
||||
|
||||
void rotate(double ax,double ay,double az)
|
||||
{
|
||||
double mat1[4][4];
|
||||
double mat2[4][4];
|
||||
xmat[0][0]=1; xmat[0][1]=0; xmat[0][2]=0; xmat[0][3]=0;
|
||||
xmat[1][0]=0; xmat[1][1]=cos(ax); xmat[1][2]=sin(ax); xmat[1][3]=0;
|
||||
xmat[2][0]=0; xmat[2][1]=-(sin(ax)); xmat[2][2]=cos(ax); xmat[2][3]=0;
|
||||
xmat[3][0]=0; xmat[3][1]=0; xmat[3][2]=0; xmat[3][3]=1;
|
||||
MultMatrix(mat1,xmat,matrix);
|
||||
ymat[0][0]=cos(ay); ymat[0][1]=0; ymat[0][2]=-(sin(ay)); ymat[0][3]=0;
|
||||
ymat[1][0]=0; ymat[1][1]=1; ymat[1][2]=0; ymat[1][3]=0;
|
||||
ymat[2][0]=sin(ay); ymat[2][1]=0; ymat[2][2]=cos(ay); ymat[2][3]=0;
|
||||
ymat[3][0]=0; ymat[3][1]=0; ymat[3][2]=0; ymat[3][3]=1;
|
||||
MultMatrix(mat2,ymat,mat1);
|
||||
zmat[0][0]=cos(az); zmat[0][1]=sin(az); zmat[0][2]=0; zmat[0][3]=0;
|
||||
zmat[1][0]=-(sin(az)); zmat[1][1]=cos(az); zmat[1][2]=0; zmat[1][3]=0;
|
||||
zmat[2][0]=0; zmat[2][1]=0; zmat[2][2]=1; zmat[2][3]=0;
|
||||
zmat[3][0]=0; zmat[3][1]=0; zmat[3][2]=0; zmat[3][3]=1;
|
||||
MultMatrix(matrix,zmat,mat2);
|
||||
}
|
||||
|
||||
short Op01m;
|
||||
short Op01Zr;
|
||||
short Op01Xr;
|
||||
short Op01Yr;
|
||||
|
||||
DSPOp01()
|
||||
{
|
||||
InitMatrix();
|
||||
rotate(Op01Xr/65536.0*6.2832,Op01Yr/65536.0*6.2832,Op01Zr/65536.0*6.2832);
|
||||
CopyMatrix(matrix0,matrix);
|
||||
InitMatrix();
|
||||
rotate(0,0,Op01Zr/65536.0*6.2832);
|
||||
rotate(Op01Xr/65536.0*6.2832,0,0);
|
||||
rotate(0,Op01Yr/65536.0*6.2832,0);
|
||||
CopyMatrix(matrixI0,matrix);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP01");
|
||||
#endif
|
||||
}
|
||||
|
||||
DSPOp11()
|
||||
{
|
||||
InitMatrix();
|
||||
rotate(Op01Xr/65536.0*6.2832,Op01Yr/65536.0*6.2832,Op01Zr/65536.0*6.2832);
|
||||
CopyMatrix(matrix1,matrix);
|
||||
InitMatrix();
|
||||
rotate(0,0,Op01Zr/65536.0*6.2832);
|
||||
rotate(Op01Xr/65536.0*6.2832,0,0);
|
||||
rotate(0,Op01Yr/65536.0*6.2832,0);
|
||||
CopyMatrix(matrixI1,matrix);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP11");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
DSPOp21()
|
||||
{
|
||||
InitMatrix();
|
||||
rotate(Op01Xr/65536.0*6.2832,Op01Yr/65536.0*6.2832,Op01Zr/65536.0*6.2832);
|
||||
CopyMatrix(matrix2,matrix);
|
||||
InitMatrix();
|
||||
rotate(0,0,Op01Zr/65536.0*6.2832);
|
||||
rotate(Op01Xr/65536.0*6.2832,0,0);
|
||||
rotate(0,Op01Yr/65536.0*6.2832,0);
|
||||
CopyMatrix(matrixI2,matrix);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP21");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
short Op0DX;
|
||||
short Op0DY;
|
||||
short Op0DZ;
|
||||
short Op0DF;
|
||||
short Op0DL;
|
||||
short Op0DU;
|
||||
|
||||
DSPOp0D()
|
||||
{
|
||||
Op0DF=(double)(Op0DX*matrixI0[0][0]+Op0DY*matrixI0[1][0]+Op0DZ*matrixI0[2][0]+matrixI0[3][0]);
|
||||
Op0DL=(double)(Op0DX*matrixI0[0][1]+Op0DY*matrixI0[1][1]+Op0DZ*matrixI0[2][1]+matrixI0[3][1]);
|
||||
Op0DU=(double)(Op0DX*matrixI0[0][2]+Op0DY*matrixI0[1][2]+Op0DZ*matrixI0[2][2]+matrixI0[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP0D");
|
||||
#endif
|
||||
}
|
||||
|
||||
DSPOp1D()
|
||||
{
|
||||
Op0DF=(double)(Op0DX*matrixI1[0][0]+Op0DY*matrixI1[1][0]+Op0DZ*matrixI1[2][0]+matrixI1[3][0]);
|
||||
Op0DL=(double)(Op0DX*matrixI1[0][1]+Op0DY*matrixI1[1][1]+Op0DZ*matrixI1[2][1]+matrixI1[3][1]);
|
||||
Op0DU=(double)(Op0DX*matrixI1[0][2]+Op0DY*matrixI1[1][2]+Op0DZ*matrixI1[2][2]+matrixI1[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP1D");
|
||||
#endif
|
||||
}
|
||||
|
||||
DSPOp2D()
|
||||
{
|
||||
Op0DF=(double)(Op0DX*matrixI2[0][0]+Op0DY*matrixI2[1][0]+Op0DZ*matrixI2[2][0]+matrixI2[3][0]);
|
||||
Op0DL=(double)(Op0DX*matrixI2[0][1]+Op0DY*matrixI2[1][1]+Op0DZ*matrixI2[2][1]+matrixI2[3][1]);
|
||||
Op0DU=(double)(Op0DX*matrixI2[0][2]+Op0DY*matrixI2[1][2]+Op0DZ*matrixI2[2][2]+matrixI2[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP2D");
|
||||
#endif
|
||||
}
|
||||
|
||||
short Op03F;
|
||||
short Op03L;
|
||||
short Op03U;
|
||||
short Op03X;
|
||||
short Op03Y;
|
||||
short Op03Z;
|
||||
|
||||
DSPOp03()
|
||||
{
|
||||
Op03X=(double)(Op03F*matrix0[0][0]+Op03L*matrix0[1][0]+Op03U*matrix0[2][0]+matrix0[3][0]);
|
||||
Op03Y=(double)(Op03F*matrix0[0][1]+Op03L*matrix0[1][1]+Op03U*matrix0[2][1]+matrix0[3][1]);
|
||||
Op03Z=(double)(Op03F*matrix0[0][2]+Op03L*matrix0[1][2]+Op03U*matrix0[2][2]+matrix0[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP03");
|
||||
#endif
|
||||
}
|
||||
|
||||
DSPOp13()
|
||||
{
|
||||
Op03X=(double)(Op03F*matrix1[0][0]+Op03L*matrix1[1][0]+Op03U*matrix1[2][0]+matrix1[3][0]);
|
||||
Op03Y=(double)(Op03F*matrix1[0][1]+Op03L*matrix1[1][1]+Op03U*matrix1[2][1]+matrix1[3][1]);
|
||||
Op03Z=(double)(Op03F*matrix1[0][2]+Op03L*matrix1[1][2]+Op03U*matrix1[2][2]+matrix1[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP13");
|
||||
#endif
|
||||
}
|
||||
|
||||
DSPOp23()
|
||||
{
|
||||
Op03X=(double)(Op03F*matrix2[0][0]+Op03L*matrix2[1][0]+Op03U*matrix2[2][0]+matrix2[3][0]);
|
||||
Op03Y=(double)(Op03F*matrix2[0][1]+Op03L*matrix2[1][1]+Op03U*matrix2[2][1]+matrix2[3][1]);
|
||||
Op03Z=(double)(Op03F*matrix2[0][2]+Op03L*matrix2[1][2]+Op03U*matrix2[2][2]+matrix2[3][2]);
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP23");
|
||||
#endif
|
||||
}
|
||||
|
||||
short Op14Zr;
|
||||
short Op14Xr;
|
||||
short Op14Yr;
|
||||
short Op14U;
|
||||
short Op14F;
|
||||
short Op14L;
|
||||
short Op14Zrr;
|
||||
short Op14Xrr;
|
||||
short Op14Yrr;
|
||||
|
||||
double Op14Temp;
|
||||
DSPOp14()
|
||||
{
|
||||
Op14Temp=(Op14Zr*6.2832/65536.0)+(1/cos(Op14Xr*6.2832/65536.0))*((Op14U*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0)-(Op14F*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0));
|
||||
Op14Zrr=Op14Temp*65536.0/6.2832;
|
||||
Op14Temp=(Op14Xr*6.2832/65536.0)+((Op14U*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0)+(Op14F*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0));
|
||||
Op14Xrr=Op14Temp*65536.0/6.2832;
|
||||
Op14Temp=(Op14Yr*6.2832/65536.0)-tan(Op14Xr*6.2832/65536.0)*((Op14U*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0)+(Op14F*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0))+(Op14L*6.2832/65536.0);
|
||||
Op14Yrr=Op14Temp*65536.0/6.2832;
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP14 X:%d Y%d Z:%D U:%d F:%d L:%d",Op14Xr,Op14Yr,Op14Zr,Op14U,Op14F,Op14L);
|
||||
Log_Message("OP14 X:%d Y%d Z:%D",Op14Xrr,Op14Yrr,Op14Zrr);
|
||||
#endif
|
||||
}
|
||||
|
||||
short Op0EH;
|
||||
short Op0EV;
|
||||
short Op0EX;
|
||||
short Op0EY;
|
||||
DSPOp0E()
|
||||
{
|
||||
|
||||
// screen Directions UP
|
||||
ScreenLZ1=-cos((Op02AZS-16384.0)*6.2832/65536.0); // -16384.0
|
||||
ScreenLX1=sin((Op02AZS-16384.0)*6.2832/65536.0)*-sin(Op02AAS*6.2832/65536.0);
|
||||
ScreenLY1=-sin((Op02AZS-16384.0)*6.2832/65536.0)*-cos(-Op02AAS*6.2832/65536.0);
|
||||
|
||||
RasterLX=ScreenX+(Op0EV)*ScreenLX1;
|
||||
RasterLY=ScreenY+(Op0EV)*ScreenLY1;
|
||||
RasterLZ=ScreenZ+(Op0EV)*ScreenLZ1;
|
||||
|
||||
// screen direction right
|
||||
ScreenLX1=sin((Op02AAS+16384.0)*6.2832/65536);
|
||||
ScreenLY1=cos(-(Op02AAS+16384.0)*6.2832/65536);
|
||||
|
||||
RasterLX=RasterLX+Op0EH*ScreenLX1;
|
||||
RasterLY=RasterLY+Op0EH*ScreenLY1;
|
||||
|
||||
Distance=Op02LFE;
|
||||
|
||||
if(Distance==0)Distance=1;
|
||||
|
||||
RasterLSlopeX=(RasterLX-ViewerX)/Distance;
|
||||
RasterLSlopeY=(RasterLY-ViewerY)/Distance;
|
||||
RasterLSlopeZ=(RasterLZ-ViewerZ)/Distance;
|
||||
|
||||
if(RasterLSlopeZ==0)RasterLSlopeZ++;
|
||||
|
||||
NumberOfSlope=ViewerZ/-RasterLSlopeZ;
|
||||
|
||||
GroundLX=ViewerX+RasterLSlopeX*NumberOfSlope;
|
||||
GroundLY=ViewerY+RasterLSlopeY*NumberOfSlope;
|
||||
|
||||
Op0EX=GroundLX;
|
||||
Op0EY=GroundLY;
|
||||
|
||||
#ifdef DebugDSP1
|
||||
Log_Message("OP0E COORDINATE H:%d V:%d",Op0EH,Op0EV);
|
||||
Log_Message(" X:%d Y:%d",Op0EX,Op0EY);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
639
zsnes/src/chips/dsp1proc.asm
Normal file
639
zsnes/src/chips/dsp1proc.asm
Normal file
@@ -0,0 +1,639 @@
|
||||
;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 regaccessbankr8,regaccessbankr16,regaccessbankw8,regaccessbankw16
|
||||
EXTSYM DSPOp0A,Op0AA,Op0AB,Op0AC,Op0AD,Op0AVS
|
||||
EXTSYM debstop
|
||||
EXTSYM DSPOp00,Op00Multiplicand,Op00Multiplier
|
||||
EXTSYM Op00Result
|
||||
;EXTSYM DSPOp10,Op10a,Op10b,Op10A,Op10B
|
||||
EXTSYM DSPOp04,Op04Angle,Op04Cos,Op04Radius,Op04Sin
|
||||
EXTSYM DSPOp28,Op28R,Op28X,Op28Y,Op28Z
|
||||
EXTSYM DSPOp0C,Op0CA,Op0CX1,Op0CX2,Op0CY1,Op0CY2
|
||||
EXTSYM DSPOp02,Op02AAS,Op02AZS,Op02CX,Op02CY,Op02FX,Op02FY
|
||||
EXTSYM Op02FZ,Op02LES,Op02LFE,Op02VOF,Op02VVA
|
||||
EXTSYM DSPOp06,Op06X,Op06Y,Op06Z,Op06H,Op06V,Op06S
|
||||
EXTSYM DSPOp0E,Op0EH,Op0EV,Op0EX,Op0EY
|
||||
EXTSYM Op01m, Op01Zr, Op01Xr, Op01Yr, DSPOp01
|
||||
EXTSYM Op0DX, Op0DY, Op0DZ, Op0DF, Op0DL, Op0DU, DSPOp0D
|
||||
EXTSYM Op03X, Op03Y, Op03Z, Op03F, Op03L, Op03U, DSPOp03
|
||||
EXTSYM Op14Zr, Op14Xr, Op14Yr, Op14U, Op14F, Op14L
|
||||
EXTSYM Op14Zrr,Op14Xrr,Op14Yrr, DSPOp14
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM dsp1ptr, dd 0
|
||||
NEWSYM dsp1array, times 4096 db 0
|
||||
|
||||
;*******************************************************
|
||||
; DSP1 Read Functions
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM DSP1Read8b3F
|
||||
test ecx,8000h
|
||||
jnz .dsp1area
|
||||
jmp regaccessbankr8
|
||||
.dsp1area
|
||||
cmp ecx,0C000h
|
||||
jae .doC000
|
||||
mov al,080h
|
||||
ret
|
||||
.doC000
|
||||
mov al,80h
|
||||
ret
|
||||
|
||||
|
||||
NEWSYM DSP1Read16b3F
|
||||
test ecx,8000h
|
||||
jnz .dsp1area
|
||||
jmp regaccessbankr16
|
||||
.dsp1area
|
||||
cmp ecx,0C000h
|
||||
jae .doC000
|
||||
cmp byte[DSP1RLeft],0
|
||||
jne .movestuff
|
||||
mov ax,08000h
|
||||
ret
|
||||
.doC000
|
||||
mov ax,08000h
|
||||
ret
|
||||
.movestuff
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,[DSP1CPtrR]
|
||||
mov ax,[DSP1RET+ebx*2]
|
||||
pop ebx
|
||||
inc byte[DSP1CPtrR]
|
||||
dec byte[DSP1RLeft]
|
||||
jz .nomore
|
||||
.goback
|
||||
ret
|
||||
.nomore
|
||||
cmp byte[DSP1COp],0Ah
|
||||
jne .goback
|
||||
push eax
|
||||
pushad
|
||||
call DSPOp0A
|
||||
popad
|
||||
mov ax,[Op0AA]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op0AB]
|
||||
mov [DSP1RET+2],ax
|
||||
mov ax,[Op0AC]
|
||||
mov [DSP1RET+4],ax
|
||||
mov ax,[Op0AD]
|
||||
mov [DSP1RET+6],ax
|
||||
mov byte[DSP1RLeft],4
|
||||
mov byte[DSP1CPtrR],0
|
||||
pop eax
|
||||
ret
|
||||
|
||||
NEWSYM DSP1Read8b
|
||||
; mov byte[debstop],1
|
||||
cmp ecx,7000h
|
||||
jae .do7000
|
||||
xor al,al
|
||||
ret
|
||||
.do7000
|
||||
mov al,80h
|
||||
test ecx,1
|
||||
jz .no1
|
||||
mov al,80h
|
||||
.no1
|
||||
ret
|
||||
|
||||
NEWSYM DSP1Read16b
|
||||
; mov byte[debstop],1
|
||||
cmp ecx,7000h
|
||||
jae .do7000
|
||||
cmp byte[DSP1RLeft],0
|
||||
jne .movestuff
|
||||
mov ax,0FFFFh
|
||||
ret
|
||||
.do7000
|
||||
mov ax,8000h
|
||||
test ecx,01h
|
||||
jz .norev
|
||||
mov ax,0080h
|
||||
.norev
|
||||
ret
|
||||
.movestuff
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,[DSP1CPtrR]
|
||||
mov ax,[DSP1RET+ebx*2]
|
||||
pop ebx
|
||||
inc byte[DSP1CPtrR]
|
||||
dec byte[DSP1RLeft]
|
||||
jz .nomore
|
||||
.goback
|
||||
ret
|
||||
.nomore
|
||||
cmp byte[DSP1COp],0Ah
|
||||
jne .goback
|
||||
push eax
|
||||
pushad
|
||||
call DSPOp0A
|
||||
popad
|
||||
mov ax,[Op0AA]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op0AB]
|
||||
mov [DSP1RET+2],ax
|
||||
mov ax,[Op0AC]
|
||||
mov [DSP1RET+4],ax
|
||||
mov ax,[Op0AD]
|
||||
mov [DSP1RET+6],ax
|
||||
mov byte[DSP1RLeft],4
|
||||
mov byte[DSP1CPtrR],0
|
||||
pop eax
|
||||
ret
|
||||
|
||||
%macro DSP1WriteInit 2
|
||||
cmp al,%1
|
||||
jne %%no
|
||||
mov byte[DSP1WLeft],%2
|
||||
%%no
|
||||
%endmacro
|
||||
|
||||
NEWSYM DSP1Write8b3F
|
||||
test ecx,8000h
|
||||
jnz .dsp1area
|
||||
jmp regaccessbankw8
|
||||
.dsp1area
|
||||
call DSP1Write8b
|
||||
ret
|
||||
|
||||
NEWSYM DSP1Write16b3F
|
||||
test ecx,8000h
|
||||
jnz .dsp1area
|
||||
jmp regaccessbankw16
|
||||
.dsp1area
|
||||
call DSP1Write16b
|
||||
ret
|
||||
|
||||
NEWSYM DSP1Write8b
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
mov byte[DSPFuncUsed+ebx],1
|
||||
pop ebx
|
||||
mov byte[DSP1COp],al
|
||||
mov byte[DSP1CPtrW],0
|
||||
DSP1WriteInit 00h, 2 ; 16-bit multiply
|
||||
DSP1WriteInit 10h, 2 ; Inverse
|
||||
DSP1WriteInit 04h, 2 ; Trigonometric
|
||||
DSP1WriteInit 08h, 3 ; Vector Size
|
||||
DSP1WriteInit 18h, 4 ; Vector Size Comparison
|
||||
DSP1WriteInit 28h, 3 ; Vector Absolute Value
|
||||
DSP1WriteInit 0Ch, 3 ; Coordinate Rotation
|
||||
DSP1WriteInit 1Ch, 4 ; 3D Coordinate Rotation
|
||||
DSP1WriteInit 02h, 7 ; Vector Size
|
||||
DSP1WriteInit 0Ah, 1 ; Raster Data Calculation via DMA
|
||||
DSP1WriteInit 1Ah, 1 ; Raster Data Calculation w/o DMA
|
||||
DSP1WriteInit 06h, 3 ; Object Projection Calculation
|
||||
DSP1WriteInit 0Eh, 2 ; Coordinate Calculation of a point onscreen
|
||||
DSP1WriteInit 01h, 4 ; Set Attitude Matrix A
|
||||
DSP1WriteInit 11h, 4 ; Set Attitude Matrix B
|
||||
DSP1WriteInit 21h, 4 ; Set Attitude Matrix C
|
||||
DSP1WriteInit 0Dh, 3 ; Convert from global to object coords Matrix A
|
||||
DSP1WriteInit 1Dh, 3 ; Convert from global to object coords Matrix B
|
||||
DSP1WriteInit 2Dh, 3 ; Convert from global to object coords Matrix C
|
||||
DSP1WriteInit 03h, 3 ; Convert from object to global coords Matrix A
|
||||
DSP1WriteInit 13h, 3 ; Convert from object to global coords Matrix B
|
||||
DSP1WriteInit 23h, 3 ; Convert from object to global coords Matrix C
|
||||
DSP1WriteInit 0Bh, 3 ; Calculation of inner product Matrix A
|
||||
DSP1WriteInit 1Bh, 3 ; Calculation of inner product Matrix B
|
||||
DSP1WriteInit 2Bh, 3 ; Calculation of inner product Matrix C
|
||||
DSP1WriteInit 14h, 6 ; 3D angle rotation
|
||||
ret
|
||||
|
||||
%macro DSP1WriteProc 2
|
||||
cmp byte[DSP1COp],%1
|
||||
jne %%no
|
||||
pushad
|
||||
call %2
|
||||
popad
|
||||
%%no
|
||||
%endmacro
|
||||
|
||||
NEWSYM DSP1Write16b
|
||||
; mov byte[debstop],1
|
||||
cmp byte[DSP1WLeft],0
|
||||
jne .yesleft
|
||||
ret
|
||||
.yesleft
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,[DSP1CPtrW]
|
||||
mov [DSP1VARS+ebx*2],ax
|
||||
pop ebx
|
||||
inc byte[DSP1CPtrW]
|
||||
dec byte[DSP1WLeft]
|
||||
jz .ProcessDSP1
|
||||
ret
|
||||
.ProcessDSP1
|
||||
mov byte[DSP1CPtrR],0
|
||||
mov byte[DSP1RLeft],0
|
||||
DSP1WriteProc 00h, DSP1_00 ; 16-bit multiply
|
||||
DSP1WriteProc 10h, DSP1_10 ; Inverse
|
||||
DSP1WriteProc 04h, DSP1_04 ; Trigonometric
|
||||
DSP1WriteProc 08h, DSP1_08 ; Vector Size
|
||||
DSP1WriteProc 18h, DSP1_18 ; Vector Size Comparison
|
||||
DSP1WriteProc 28h, DSP1_28 ; Vector Absolute Value
|
||||
DSP1WriteProc 0Ch, DSP1_0C ; Coordinate Rotation
|
||||
DSP1WriteProc 1Ch, DSP1_1C ; 3D Coordinate Rotation
|
||||
DSP1WriteProc 02h, DSP1_02 ; Vector Size
|
||||
DSP1WriteProc 0Ah, DSP1_0A ; Raster Data Calculation via DMA
|
||||
DSP1WriteProc 1Ah, DSP1_0A ; Raster Data Calculation w/o DMA
|
||||
DSP1WriteProc 06h, DSP1_06 ; Object Projection Calculation
|
||||
DSP1WriteProc 0Eh, DSP1_0E ; Coordinate Calculation of a point onscreen
|
||||
DSP1WriteProc 01h, DSP1_01 ; Set Attitude Matrix A
|
||||
DSP1WriteProc 11h, DSP1_11 ; Set Attitude Matrix B
|
||||
DSP1WriteProc 21h, DSP1_21 ; Set Attitude Matrix C
|
||||
DSP1WriteProc 0Dh, DSP1_0D ; Convert from global to object coords Matrix A
|
||||
DSP1WriteProc 1Dh, DSP1_1D ; Convert from global to object coords Matrix B
|
||||
DSP1WriteProc 2Dh, DSP1_2D ; Convert from global to object coords Matrix C
|
||||
DSP1WriteProc 03h, DSP1_03 ; Convert from object to global coords Matrix A
|
||||
DSP1WriteProc 13h, DSP1_13 ; Convert from object to global coords Matrix B
|
||||
DSP1WriteProc 23h, DSP1_23 ; Convert from object to global coords Matrix C
|
||||
DSP1WriteProc 0Bh, DSP1_0B ; Calculation of inner product Matrix A
|
||||
DSP1WriteProc 1Bh, DSP1_1B ; Calculation of inner product Matrix B
|
||||
DSP1WriteProc 2Bh, DSP1_2B ; Calculation of inner product Matrix C
|
||||
DSP1WriteProc 14h, DSP1_14 ; 3D angle rotation
|
||||
ret
|
||||
|
||||
NEWSYM DSP1COp, db 0
|
||||
NEWSYM DSP1RLeft, db 0
|
||||
NEWSYM DSP1WLeft, db 0
|
||||
NEWSYM DSP1CPtrW, db 0
|
||||
NEWSYM DSP1CPtrR, db 0
|
||||
NEWSYM DSP1VARS, times 16 dw 0
|
||||
NEWSYM DSP1RET, times 16 dw 0
|
||||
NEWSYM DSPDet, db 0
|
||||
|
||||
NEWSYM DSPFuncUsed, times 256 db 0
|
||||
|
||||
;*******************************************************
|
||||
; DSP1 Conversion Functions
|
||||
;*******************************************************
|
||||
DSP1_00: ; 16-bit multiply
|
||||
or byte[DSPDet],01h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op00Multiplicand],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op00Multiplier],ax
|
||||
pushad
|
||||
call DSPOp00
|
||||
popad
|
||||
mov ax,[Op00Result]
|
||||
mov [DSP1RET],ax
|
||||
mov byte[DSP1RLeft],1
|
||||
pop eax
|
||||
ret
|
||||
DSP1_10: ; Inverse
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
; mov [Op10a],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
; mov [Op10b],ax
|
||||
pushad
|
||||
; call DSPOp10
|
||||
popad
|
||||
; mov ax,[Op10A]
|
||||
mov [DSP1RET],ax
|
||||
; mov ax,[Op10B]
|
||||
mov [DSP1RET+2],ax
|
||||
mov byte[DSP1RLeft],2
|
||||
pop eax
|
||||
ret
|
||||
|
||||
DSP1_04: ; Trigonometric
|
||||
or byte[DSPDet],02h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op04Angle],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op04Radius],ax
|
||||
pushad
|
||||
call DSPOp04
|
||||
popad
|
||||
mov ax,[Op04Sin]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op04Cos]
|
||||
mov [DSP1RET+2],ax
|
||||
mov byte[DSP1RLeft],2
|
||||
pop eax
|
||||
ret
|
||||
DSP1_08: ; Vector Size
|
||||
ret
|
||||
DSP1_18: ; Vector Size Comparison
|
||||
ret
|
||||
|
||||
DSP1_28: ; Vector Absolute Value
|
||||
or byte[DSPDet],04h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op28X],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op28Y],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op28Z],ax
|
||||
pushad
|
||||
call DSPOp28
|
||||
popad
|
||||
mov ax,[Op28R]
|
||||
mov [DSP1RET],ax
|
||||
mov byte[DSP1RLeft],1
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
DSP1_0C: ; Coordinate Rotation
|
||||
or byte[DSPDet],08h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op0CA],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op0CX1],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op0CY1],ax
|
||||
pushad
|
||||
call DSPOp0C
|
||||
popad
|
||||
mov ax,[Op0CX2]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op0CY2]
|
||||
mov [DSP1RET+2],ax
|
||||
mov byte[DSP1RLeft],2
|
||||
pop eax
|
||||
ret
|
||||
DSP1_1C: ; 3D Coordinate Rotation
|
||||
ret
|
||||
|
||||
|
||||
DSP1_02: ; Vector Size
|
||||
or byte[DSPDet],10h
|
||||
push eax
|
||||
;Op02FX dw 0
|
||||
;Op02FY dw 0
|
||||
;Op02FZ dw 0
|
||||
;Op02LFE dw 0
|
||||
;Op02LES dw 0
|
||||
;Op02AAS dw 0
|
||||
;Op02AZS dw 0
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op02FX],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op02FY],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op02FZ],ax
|
||||
mov ax,[DSP1VARS+6]
|
||||
mov [Op02LFE],ax
|
||||
mov ax,[DSP1VARS+8]
|
||||
mov [Op02LES],ax
|
||||
mov ax,[DSP1VARS+10]
|
||||
mov [Op02AAS],ax
|
||||
mov ax,[DSP1VARS+12]
|
||||
mov [Op02AZS],ax
|
||||
pushad
|
||||
call DSPOp02
|
||||
popad
|
||||
;Op02VOF dw 0
|
||||
;Op02VVA dw 0
|
||||
;Op02CX dw 0
|
||||
;Op02CY dw 0
|
||||
mov ax,[Op02VOF]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op02VVA]
|
||||
mov [DSP1RET+2],ax
|
||||
mov ax,[Op02CX]
|
||||
mov [DSP1RET+4],ax
|
||||
mov ax,[Op02CY]
|
||||
mov [DSP1RET+6],ax
|
||||
mov byte[DSP1RLeft],4
|
||||
pop eax
|
||||
ret
|
||||
mov eax,dsp1array
|
||||
add eax,[dsp1ptr]
|
||||
push ebx
|
||||
mov byte[eax],02h
|
||||
mov bx,[Op02FX]
|
||||
mov [eax+1],bx
|
||||
mov bx,[Op02FY]
|
||||
mov [eax+3],bx
|
||||
mov bx,[Op02FZ]
|
||||
mov [eax+5],bx
|
||||
mov bx,[Op02LFE]
|
||||
mov [eax+7],bx
|
||||
mov bx,[Op02LES]
|
||||
mov [eax+9],bx
|
||||
mov bx,[Op02AAS]
|
||||
mov [eax+11],bx
|
||||
mov bx,[Op02AZS]
|
||||
mov [eax+13],bx
|
||||
mov bx,[Op02VOF]
|
||||
mov [eax+15],bx
|
||||
mov bx,[Op02VVA]
|
||||
mov [eax+17],bx
|
||||
mov bx,[Op02CX]
|
||||
mov [eax+19],bx
|
||||
mov bx,[Op02CY]
|
||||
mov [eax+21],bx
|
||||
pop ebx
|
||||
add dword[dsp1ptr],23
|
||||
DSP1_0A: ; Raster Data Calculation via DMA
|
||||
mov byte[DSP1COp],0Ah
|
||||
or byte[DSPDet],20h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op0AVS],ax
|
||||
pushad
|
||||
call DSPOp0A
|
||||
popad
|
||||
mov ax,[Op0AA]
|
||||
mov [DSP1RET],ax
|
||||
mov ax,[Op0AB]
|
||||
mov [DSP1RET+2],ax
|
||||
mov ax,[Op0AC]
|
||||
mov [DSP1RET+4],ax
|
||||
mov ax,[Op0AD]
|
||||
mov [DSP1RET+6],ax
|
||||
mov byte[DSP1RLeft],4
|
||||
pop eax
|
||||
ret
|
||||
DSP1_06: ; Object Projection Calculation
|
||||
or byte[DSPDet],40h
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op06X],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op06Y],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op06Z],ax
|
||||
pushad
|
||||
call DSPOp06
|
||||
popad
|
||||
mov ax,[Op06H]
|
||||
mov word[DSP1RET],ax
|
||||
mov ax,[Op06V]
|
||||
mov word[DSP1RET+2],ax
|
||||
mov ax,[Op06S]
|
||||
mov word[DSP1RET+4],ax
|
||||
mov byte[DSP1RLeft],3
|
||||
pop eax
|
||||
ret
|
||||
mov eax,dsp1array
|
||||
add eax,[dsp1ptr]
|
||||
push ebx
|
||||
mov byte[eax],06h
|
||||
mov bx,[Op06X]
|
||||
mov [eax+1],bx
|
||||
mov bx,[Op06Y]
|
||||
mov [eax+3],bx
|
||||
mov bx,[Op06Z]
|
||||
mov [eax+5],bx
|
||||
mov bx,[Op06H]
|
||||
mov [eax+7],bx
|
||||
mov bx,[Op06V]
|
||||
mov [eax+9],bx
|
||||
mov bx,[Op06S]
|
||||
mov [eax+11],bx
|
||||
pop ebx
|
||||
add dword[dsp1ptr],13
|
||||
DSP1_0E: ; Coordinate Calculation of a point onscreen
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op0EH],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op0EV],ax
|
||||
pushad
|
||||
call DSPOp0E
|
||||
popad
|
||||
mov ax,[Op0EX]
|
||||
mov word[DSP1RET],ax
|
||||
mov ax,[Op0EY]
|
||||
mov word[DSP1RET+2],ax
|
||||
mov byte[DSP1RLeft],2
|
||||
pop eax
|
||||
ret
|
||||
DSP1_01: ; Set Attitude Matrix A
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op01m],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op01Zr],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op01Xr],ax
|
||||
mov ax,[DSP1VARS+6]
|
||||
mov [Op01Yr],ax
|
||||
pushad
|
||||
call DSPOp01
|
||||
popad
|
||||
pop eax
|
||||
ret
|
||||
DSP1_11: ; Set Attitude Matrix B
|
||||
ret
|
||||
DSP1_21: ; Set Attitude Matrix C
|
||||
ret
|
||||
DSP1_0D: ; Convert from global to object coords Matrix A
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op0DX],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op0DY],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op0DZ],ax
|
||||
pushad
|
||||
call DSPOp0D
|
||||
popad
|
||||
mov ax,[Op0DF]
|
||||
mov word[DSP1RET],ax
|
||||
mov ax,[Op0DL]
|
||||
mov word[DSP1RET+2],ax
|
||||
mov ax,[Op0DU]
|
||||
mov word[DSP1RET+4],ax
|
||||
mov byte[DSP1RLeft],3
|
||||
pop eax
|
||||
ret
|
||||
DSP1_1D: ; Convert from global to object coords Matrix B
|
||||
ret
|
||||
DSP1_2D: ; Convert from global to object coords Matrix C
|
||||
ret
|
||||
DSP1_03: ; Convert from object to global coords Matrix A
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op03F],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op03L],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op03U],ax
|
||||
pushad
|
||||
call DSPOp03
|
||||
popad
|
||||
mov ax,[Op03X]
|
||||
mov word[DSP1RET],ax
|
||||
mov ax,[Op03Y]
|
||||
mov word[DSP1RET+2],ax
|
||||
mov ax,[Op03Z]
|
||||
mov word[DSP1RET+4],ax
|
||||
mov byte[DSP1RLeft],3
|
||||
pop eax
|
||||
ret
|
||||
DSP1_13: ; Convert from object to global coords Matrix B
|
||||
ret
|
||||
DSP1_23: ; Convert from object to global coords Matrix C
|
||||
ret
|
||||
DSP1_0B: ; Calculation of inner product Matrix A
|
||||
ret
|
||||
DSP1_1B: ; Calculation of inner product Matrix B
|
||||
ret
|
||||
DSP1_2B: ; Calculation of inner product Matrix C
|
||||
ret
|
||||
DSP1_14: ; 3D angle rotation
|
||||
push eax
|
||||
mov ax,[DSP1VARS]
|
||||
mov [Op14Zr],ax
|
||||
mov ax,[DSP1VARS+2]
|
||||
mov [Op14Xr],ax
|
||||
mov ax,[DSP1VARS+4]
|
||||
mov [Op14Yr],ax
|
||||
mov ax,[DSP1VARS+6]
|
||||
mov [Op14U],ax
|
||||
mov ax,[DSP1VARS+8]
|
||||
mov [Op14F],ax
|
||||
mov ax,[DSP1VARS+10]
|
||||
mov [Op14L],ax
|
||||
pushad
|
||||
call DSPOp14
|
||||
popad
|
||||
mov ax,[Op14Zrr]
|
||||
mov word[DSP1RET],ax
|
||||
mov ax,[Op14Xrr]
|
||||
mov word[DSP1RET+2],ax
|
||||
mov ax,[Op14Yrr]
|
||||
mov word[DSP1RET+4],ax
|
||||
mov byte[DSP1RLeft],3
|
||||
pop eax
|
||||
ret
|
||||
|
||||
2683
zsnes/src/chips/fxemu2.asm
Normal file
2683
zsnes/src/chips/fxemu2.asm
Normal file
File diff suppressed because it is too large
Load Diff
835
zsnes/src/chips/fxemu2.mac
Normal file
835
zsnes/src/chips/fxemu2.mac
Normal file
@@ -0,0 +1,835 @@
|
||||
;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 FETCHPIPE 0
|
||||
; mov edx,[SfxPBR]
|
||||
; mov edx,[SfxMemTable+edx*4]
|
||||
; mov edx,[SfxCPB]
|
||||
; mov edx,[SfxR15]
|
||||
mov cl,[ebp]
|
||||
%endmacro
|
||||
|
||||
%macro UpdateR14 0
|
||||
; mov edx,[SfxROMBR]
|
||||
; mov edx,[SfxMemTable+edx*4]
|
||||
mov eax,[SfxCROM]
|
||||
; and dword[SfxR14],0FFFFh
|
||||
add eax,[SfxR14]
|
||||
mov [SfxRomBuffer],eax
|
||||
%endmacro
|
||||
|
||||
%macro UpdateR15 0
|
||||
mov ebp,[SfxCPB]
|
||||
add ebp,[SfxR15]
|
||||
%endmacro
|
||||
|
||||
%macro CLRFLAGS 0
|
||||
;and dword [SfxSFR],0FFFFh-0100h-0200h-1000h ; Clear ALT1,ALT2 and B Flags
|
||||
; xor ch,ch
|
||||
; mov dword [SfxB],0 ; Clear B Flag
|
||||
; mov esi,SfxR0
|
||||
; mov edi,SfxR0
|
||||
%endmacro
|
||||
|
||||
%macro TORN 1 ; V
|
||||
FETCHPIPE
|
||||
mov edi, SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTable+ecx*4]
|
||||
mov edi,SfxR0
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro WITH 1 ; Verified.
|
||||
FETCHPIPE
|
||||
mov esi,SfxR0+%1*4
|
||||
mov edi,SfxR0+%1*4
|
||||
mov dword [SfxB],1
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTablec+ecx*4]
|
||||
mov esi,SfxR0
|
||||
mov edi,SfxR0
|
||||
mov dword [SfxB],0 ; Clear B Flag
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro STWRN 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
add dword [SfxLastRamAdr],ebx ; Save last ram address
|
||||
mov edx,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
mov [ebx+eax],dl ; Store Word
|
||||
xor eax,1
|
||||
inc ebp ; Increase program counter
|
||||
mov [ebx+eax],dh ; Store Word
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro STBRN 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
FETCHPIPE
|
||||
add eax,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
mov ebx,[esi] ; Read Source
|
||||
mov byte [eax],bl ; Store Byte
|
||||
CLRFLAGS
|
||||
inc ebp ; Increase program counter
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LDWRN 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
FETCHPIPE
|
||||
mov dl,[ebx+eax] ; Store Word
|
||||
add dword [SfxLastRamAdr],ebx ; Save last ram address
|
||||
xor eax,1
|
||||
and edx,0FFFFh
|
||||
inc ebp ; Increase program counter
|
||||
mov dh,[ebx+eax] ; Store Word
|
||||
mov [edi],edx ; Read Source
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LDBRN 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
FETCHPIPE
|
||||
add eax,[SfxRAMMem]
|
||||
xor ebx,ebx
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
mov bl,[eax] ; Read Byte
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],ebx ; Store Result
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; test byte[SfxPOR],01h
|
||||
; jnz .nozerocheck
|
||||
; test byte[SfxPOR],02h
|
||||
; jz .nodither
|
||||
|
||||
; **** Can pre-calculate [SfxSCBR] << 10 + [sfxramdata]
|
||||
; Pre-calculate fxbit values from color register
|
||||
|
||||
%macro drawpix4b 0
|
||||
and [eax],edx
|
||||
and [eax+16],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
mov ebx,[fxbit01pcal]
|
||||
and ebx,edx
|
||||
or [eax], ebx
|
||||
and edx,[fxbit23pcal]
|
||||
or [eax+16], edx
|
||||
%endmacro
|
||||
|
||||
%macro drawpix4bd 0
|
||||
and [eax],edx
|
||||
and [eax+16],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
mov ebx,[fxbit45pcal]
|
||||
and ebx,edx
|
||||
or [eax], ebx
|
||||
and edx,[fxbit67pcal]
|
||||
or [eax+16], edx
|
||||
%endmacro
|
||||
|
||||
%macro drawpix2b 0
|
||||
and [eax],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
and edx,[fxbit01pcal]
|
||||
or [eax], edx
|
||||
%endmacro
|
||||
|
||||
%macro drawpix2bd 0
|
||||
and [eax],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
and edx,[fxbit45pcal]
|
||||
or [eax], edx
|
||||
%endmacro
|
||||
|
||||
%macro drawpix8b 0
|
||||
and [eax],edx
|
||||
and [eax+16],edx
|
||||
and [eax+32],edx
|
||||
and [eax+48],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
mov ebx,[fxbit01pcal]
|
||||
and ebx,edx
|
||||
or [eax], ebx
|
||||
mov ebx,[fxbit23pcal]
|
||||
and ebx,edx
|
||||
or [eax+16], ebx
|
||||
mov ebx,[fxbit45pcal]
|
||||
and ebx,edx
|
||||
or [eax+32], ebx
|
||||
and edx,[fxbit67pcal]
|
||||
or [eax+48], edx
|
||||
%endmacro
|
||||
|
||||
%macro drawpix8bd 0
|
||||
and [eax],edx
|
||||
and [eax+16],edx
|
||||
and [eax+32],edx
|
||||
and [eax+48],edx
|
||||
xor edx,0FFFFFFFFh
|
||||
mov ebx,[fxbit45pcal]
|
||||
and ebx,edx
|
||||
or [eax], ebx
|
||||
mov ebx,[fxbit67pcal]
|
||||
and ebx,edx
|
||||
or [eax+16], ebx
|
||||
mov ebx,[fxbit01pcal]
|
||||
and ebx,edx
|
||||
or [eax+32], ebx
|
||||
and edx,[fxbit23pcal]
|
||||
or [eax+48], edx
|
||||
%endmacro
|
||||
|
||||
%macro plotb 5
|
||||
shl eax,%3
|
||||
and ebx,07h
|
||||
add ebx,ebx
|
||||
add eax,ebx
|
||||
add eax,[SCBRrel]
|
||||
mov bl,[SfxR1]
|
||||
mov edx,[fxxand+ebx*4]
|
||||
%2
|
||||
%endmacro
|
||||
|
||||
%macro plotbz 5
|
||||
shl eax,%3
|
||||
and ebx,07h
|
||||
add ebx,ebx
|
||||
add eax,ebx
|
||||
add eax,[SCBRrel]
|
||||
mov bl,[SfxR1]
|
||||
mov edx,[fxxand+ebx*4]
|
||||
test byte[SfxCOLR],%5
|
||||
jz .nodraw
|
||||
%2
|
||||
%endmacro
|
||||
|
||||
%macro plotbd 5
|
||||
shl eax,%3
|
||||
and ebx,07h
|
||||
add ebx,ebx
|
||||
add eax,ebx
|
||||
add eax,[SCBRrel]
|
||||
mov bl,[SfxR1]
|
||||
mov edx,[fxxand+ebx*4]
|
||||
mov bl,[SfxR1]
|
||||
xor bl,[SfxR2]
|
||||
test bl,01h
|
||||
jz near .nodither4b
|
||||
%4
|
||||
inc word [SfxR1]
|
||||
%1
|
||||
.nodither4b
|
||||
%2
|
||||
%endmacro
|
||||
|
||||
%macro plotbzd 5
|
||||
shl eax,%3
|
||||
and ebx,07h
|
||||
add ebx,ebx
|
||||
add eax,ebx
|
||||
add eax,[SCBRrel]
|
||||
mov bl,[SfxR1]
|
||||
mov edx,[fxxand+ebx*4]
|
||||
test byte[SfxCOLR],%5
|
||||
jz near .nodraw
|
||||
mov bl,[SfxR1]
|
||||
xor bl,[SfxR2]
|
||||
test bl,01h
|
||||
jz .nodither4b
|
||||
%4
|
||||
inc word [SfxR1]
|
||||
%1
|
||||
.nodither4b
|
||||
%2
|
||||
%endmacro
|
||||
|
||||
%macro plotlines4b 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 ret, drawpix4b, 5, drawpix4bd, 0Fh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro plotlines4bb 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 FXReturn, drawpix4b, 5, drawpix4bd, 0Fh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro plotlines2b 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 ret, drawpix2b, 4, drawpix2bd, 03h
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro plotlines2bb 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 FXReturn, drawpix2b, 4, drawpix2bd, 03h
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro plotlines8b 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 ret, drawpix8b, 6, drawpix8bd, 0FFh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro plotlines8bb 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 FXReturn, drawpix8b, 6, drawpix8bd, 0FFh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro plotlines8bl 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 ret, drawpix8b, 6, drawpix8bd, 0Fh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro plotlines8bbl 1
|
||||
mov ebx,[SfxR2]
|
||||
FETCHPIPE
|
||||
mov bh,[SfxR1]
|
||||
mov eax,[sfxclineloc]
|
||||
inc ebp
|
||||
mov eax,[eax+ebx*4]
|
||||
cmp eax,0FFFFFFFFh
|
||||
je near .nodraw
|
||||
%1 FXReturn, drawpix8b, 6, drawpix8bd, 0Fh
|
||||
.nodraw
|
||||
inc word [SfxR1]
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ADDRN 1 ; V
|
||||
mov eax, [esi] ; Read Source
|
||||
mov ebx, [SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
add ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ADCRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax, [esi] ; Read Source
|
||||
mov ebx, [SfxR0+%1*4]
|
||||
shr byte[SfxCarry],1
|
||||
adc ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ADIRN 1 ; V
|
||||
mov eax, [esi] ; Read Source
|
||||
FETCHPIPE
|
||||
add ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ADCIRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax, [esi] ; Read Source
|
||||
shr byte[SfxCarry],1
|
||||
adc ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro SUBRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
sub ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro SBCRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
cmp byte[SfxCarry],1
|
||||
sbb ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro SUBIRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
sub ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro CMPRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
sub ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp ; Increase program counter
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ANDRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
and eax,ebx
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro BICRN 1 ; V
|
||||
mov ebx,[SfxR0+%1*4] ; Read RN
|
||||
mov eax,[esi] ; Read Source
|
||||
xor ebx,0FFFFh
|
||||
FETCHPIPE
|
||||
and eax,ebx
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ANDIRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
and eax,%1
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro BICIRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
and eax,%1
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro MULTRN 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,byte [SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
imul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro UMULTRN 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,byte [SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
mul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro MULTIRN 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,%1 ; Read RN
|
||||
FETCHPIPE
|
||||
imul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro UMULTIRN 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,%1 ; Read RN
|
||||
FETCHPIPE
|
||||
mul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LINK 1 ; Verified.
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
add eax,%1
|
||||
FETCHPIPE
|
||||
mov word [SfxR11],ax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro JMPRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read RN
|
||||
mov ebp,[SfxCPB]
|
||||
add ebp,eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LJMPRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4]
|
||||
and eax,07Fh
|
||||
mov byte[SfxPBR],al
|
||||
; mov byte[fxtrace+eax],1
|
||||
mov eax,[SfxMemTable+eax*4]
|
||||
mov [SfxCPB],eax
|
||||
mov ebp,eax
|
||||
add ebp,[esi] ; Read RN
|
||||
mov dword [SfxCacheActive],0
|
||||
push ecx
|
||||
call FxOp02
|
||||
pop ecx
|
||||
dec ebp
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro IBTRN 1 ; V
|
||||
movsx eax,byte[ebp]
|
||||
mov cl,[ebp+1]
|
||||
add ebp,2
|
||||
mov [SfxR0+%1*4],ax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LMSRN 1 ; Verified.
|
||||
xor eax,eax
|
||||
mov al,[ebp]
|
||||
add eax,eax
|
||||
inc ebp
|
||||
add eax,[SfxRAMMem]
|
||||
mov cl,[ebp]
|
||||
mov dword [SfxLastRamAdr],eax
|
||||
mov ebx,[eax] ; Read word from ram
|
||||
inc ebp
|
||||
mov [SfxR0+%1*4],bx ; Write data
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro SMSRN 1 ; Verified.
|
||||
xor eax,eax
|
||||
mov al,[ebp]
|
||||
inc ebp
|
||||
add eax,eax
|
||||
mov cl,[ebp]
|
||||
add eax,[SfxRAMMem]
|
||||
mov ebx,[SfxR0+%1*4] ; Read data
|
||||
mov dword [SfxLastRamAdr],eax
|
||||
inc ebp
|
||||
mov [eax],bx ; Write word to ram
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro FROMRN 1 ; V
|
||||
FETCHPIPE
|
||||
mov esi,SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTable+ecx*4]
|
||||
mov esi,SfxR0
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ORRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read
|
||||
FETCHPIPE
|
||||
or eax,ebx
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro XORRN 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read
|
||||
FETCHPIPE
|
||||
xor eax,ebx
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ORI 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
or eax,%1
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro XORI 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
xor eax,%1
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro INCRN 1 ; Verified
|
||||
inc word[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read Source
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro DECRN 1 ; Verified
|
||||
dec word[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read Source
|
||||
mov [SfxR0+%1*4],eax
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro IWTRN 1 ; aka LEA ; Verified.
|
||||
mov eax,[ebp]
|
||||
mov cl,[ebp+2]
|
||||
and eax,0FFFFh
|
||||
add ebp,3
|
||||
mov [SfxR0+%1*4],eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro LMRN 1 ; Verified!
|
||||
xor eax,eax
|
||||
mov cl,[ebp+2]
|
||||
mov ax,[ebp]
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov [SfxLastRamAdr],eax
|
||||
add [SfxLastRamAdr],ebx
|
||||
mov dl,[eax+ebx]
|
||||
xor eax,1
|
||||
add ebp,3
|
||||
mov dh,[eax+ebx]
|
||||
mov word [SfxR0+%1*4],dx ; Store Word
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro SMRN 1 ; Verified
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
mov eax,[ebp]
|
||||
mov cl,[ebp+2]
|
||||
and eax,0FFFFh
|
||||
mov dx,bx
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov [SfxLastRamAdr],eax
|
||||
add [SfxLastRamAdr],ebx
|
||||
mov [eax+ebx],dl
|
||||
xor eax,1
|
||||
add ebp,3
|
||||
mov [eax+ebx],dh
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro PackEsiEdi 0
|
||||
mov eax,[SfxSREG]
|
||||
shl eax,2
|
||||
add eax,SfxR0
|
||||
mov esi,eax
|
||||
mov eax,[SfxDREG]
|
||||
shl eax,2
|
||||
add eax,SfxR0
|
||||
mov edi,eax
|
||||
mov eax,[SfxRAMBR]
|
||||
shl eax,16
|
||||
add eax,[sfxramdata]
|
||||
mov dword [SfxRAMMem],eax
|
||||
%endmacro
|
||||
|
||||
%macro UnPackEsiEdi 0
|
||||
mov eax,esi
|
||||
sub eax,SfxR0
|
||||
shr eax,2
|
||||
mov [SfxSREG],eax
|
||||
mov eax,edi
|
||||
sub eax,SfxR0
|
||||
shr eax,2
|
||||
mov [SfxDREG],eax
|
||||
%endmacro
|
||||
|
||||
614
zsnes/src/chips/fxemu2b.asm
Normal file
614
zsnes/src/chips/fxemu2b.asm
Normal file
@@ -0,0 +1,614 @@
|
||||
;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 FxTable,FxTableb,FxTablec,SfxB,SfxCPB,SfxCROM,SfxCarry,SfxOverflow
|
||||
EXTSYM SfxR0,SfxR14,SfxR15,SfxRomBuffer,SfxSignZero,withr15sk
|
||||
|
||||
%include "chips/fxemu2.mac"
|
||||
%include "chips/fxemu2b.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM FxOpb05 ; BRA branch always ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov cl,[ebp+1]
|
||||
inc ebp
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb06 ; BGE branch on greater or equals ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov ebx,[SfxSignZero]
|
||||
shr ebx,15
|
||||
inc ebp
|
||||
xor bl,[SfxOverflow]
|
||||
mov cl,[ebp]
|
||||
test bl,01h
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb07 ; BLT branch on lesss than ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov ebx,[SfxSignZero]
|
||||
shr ebx,15
|
||||
inc ebp
|
||||
xor bl,[SfxOverflow]
|
||||
mov cl,[ebp]
|
||||
test bl,01h
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb08 ; BNE branch on not equal ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],0FFFFh
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb09 ; BEQ branch on equal (z=1) ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],0FFFFh
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0A ; BPL branch on plus ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],088000h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0B ; BMI branch on minus ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],088000h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0C ; BCC branch on carry clear ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxCarry],01h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0D ; BCS branch on carry set ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxCarry],01h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0E ; BVC branch on overflow clear ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxOverflow],01h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb0F ; BVS branch on overflow set ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxOverflow],01h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTableb+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb10 ; TO RN set register n as destination register
|
||||
TORNb 0
|
||||
NEWSYM FxOpb11 ; TO RN set register n as destination register
|
||||
TORNb 1
|
||||
NEWSYM FxOpb12 ; TO RN set register n as destination register
|
||||
TORNb 2
|
||||
NEWSYM FxOpb13 ; TO RN set register n as destination register
|
||||
TORNb 3
|
||||
NEWSYM FxOpb14 ; TO RN set register n as destination register
|
||||
TORNb 4
|
||||
NEWSYM FxOpb15 ; TO RN set register n as destination register
|
||||
TORNb 5
|
||||
NEWSYM FxOpb16 ; TO RN set register n as destination register
|
||||
TORNb 6
|
||||
NEWSYM FxOpb17 ; TO RN set register n as destination register
|
||||
TORNb 7
|
||||
NEWSYM FxOpb18 ; TO RN set register n as destination register
|
||||
TORNb 8
|
||||
NEWSYM FxOpb19 ; TO RN set register n as destination register
|
||||
TORNb 9
|
||||
NEWSYM FxOpb1A ; TO RN set register n as destination register
|
||||
TORNb 10
|
||||
NEWSYM FxOpb1B ; TO RN set register n as destination register
|
||||
TORNb 11
|
||||
NEWSYM FxOpb1C ; TO RN set register n as destination register
|
||||
TORNb 12
|
||||
NEWSYM FxOpb1D ; TO RN set register n as destination register
|
||||
TORNb 13
|
||||
NEWSYM FxOpb1E ; TO RN set register n as destination register
|
||||
FETCHPIPE
|
||||
test dword [SfxB],1
|
||||
jnz .VersionB
|
||||
mov edi,SfxR0+14*4
|
||||
inc ebp
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov dword[withr15sk],1
|
||||
mov [SfxR15],eax
|
||||
call [FxTableb+ecx*4]
|
||||
mov edi,SfxR0
|
||||
UpdateR14
|
||||
ret
|
||||
.VersionB
|
||||
mov eax,[esi] ; Read Source
|
||||
mov dword[withr15sk],1
|
||||
mov [SfxR0+14*4],eax ; Write
|
||||
CLRFLAGS
|
||||
UpdateR14
|
||||
inc ebp ; Increase program counter
|
||||
ret
|
||||
NEWSYM FxOpb1F ; TO RN set register n as destination register
|
||||
FETCHPIPE
|
||||
test dword [SfxB],1
|
||||
jnz .VersionB
|
||||
mov edi,SfxR0+15*4
|
||||
inc ebp
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
call [FxTableb+ecx*4]
|
||||
mov ebp,[SfxCPB]
|
||||
mov dword[withr15sk],1
|
||||
add ebp,[SfxR15]
|
||||
mov edi,SfxR0
|
||||
ret
|
||||
.VersionB
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebp,[SfxCPB]
|
||||
mov dword[withr15sk],1
|
||||
add ebp,eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb3D ; ALT1 set alt1 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,01h
|
||||
inc ebp
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
call [FxTableb+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb3E ; ALT2 set alt1 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,02h
|
||||
inc ebp
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
call [FxTable+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpb3F ; ALT3 set alt3 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,03h
|
||||
inc ebp
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
call [FxTable+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpbB0 ; FROM rn set source register
|
||||
FROMRNb 0
|
||||
NEWSYM FxOpbB1 ; FROM rn set source register
|
||||
FROMRNb 1
|
||||
NEWSYM FxOpbB2 ; FROM rn set source register
|
||||
FROMRNb 2
|
||||
NEWSYM FxOpbB3 ; FROM rn set source register
|
||||
FROMRNb 3
|
||||
NEWSYM FxOpbB4 ; FROM rn set source register
|
||||
FROMRNb 4
|
||||
NEWSYM FxOpbB5 ; FROM rn set source register
|
||||
FROMRNb 5
|
||||
NEWSYM FxOpbB6 ; FROM rn set source register
|
||||
FROMRNb 6
|
||||
NEWSYM FxOpbB7 ; FROM rn set source register
|
||||
FROMRNb 7
|
||||
NEWSYM FxOpbB8 ; FROM rn set source register
|
||||
FROMRNb 8
|
||||
NEWSYM FxOpbB9 ; FROM rn set source register
|
||||
FROMRNb 9
|
||||
NEWSYM FxOpbBA ; FROM rn set source register
|
||||
FROMRNb 10
|
||||
NEWSYM FxOpbBB ; FROM rn set source register
|
||||
FROMRNb 11
|
||||
NEWSYM FxOpbBC ; FROM rn set source register
|
||||
FROMRNb 12
|
||||
NEWSYM FxOpbBD ; FROM rn set source register
|
||||
FROMRNb 13
|
||||
NEWSYM FxOpbBE ; FROM rn set source register
|
||||
FROMRNb 14
|
||||
NEWSYM FxOpbBF ; FROM rn set source register
|
||||
test dword [SfxB],1
|
||||
jnz .VersionB
|
||||
mov esi,SfxR0+15*4
|
||||
inc ebp ; Increase program counter
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
call [FxTableb+ecx*4]
|
||||
mov esi,SfxR0
|
||||
ret
|
||||
.VersionB
|
||||
FETCHPIPE
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
inc ebp
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
shr al,7
|
||||
mov byte[SfxOverflow],al
|
||||
CLRFLAGS
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc05 ; BRA branch always ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov cl,[ebp+1]
|
||||
inc ebp
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc06 ; BGE branch on greater or equals ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov ebx,[SfxSignZero]
|
||||
shr ebx,15
|
||||
inc ebp
|
||||
xor bl,[SfxOverflow]
|
||||
mov cl,[ebp]
|
||||
test bl,01h
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc07 ; BLT branch on lesss than ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
mov ebx,[SfxSignZero]
|
||||
shr ebx,15
|
||||
inc ebp
|
||||
xor bl,[SfxOverflow]
|
||||
mov cl,[ebp]
|
||||
test bl,01h
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc08 ; BNE branch on not equal ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],0FFFFh
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc09 ; BEQ branch on equal (z=1) ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],0FFFFh
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0A ; BPL branch on plus ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],088000h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0B ; BMI branch on minus ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test dword[SfxSignZero],088000h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0C ; BCC branch on carry clear ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxCarry],01h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0D ; BCS branch on carry set ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxCarry],01h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0E ; BVC branch on overflow clear ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxOverflow],01h
|
||||
mov cl,[ebp]
|
||||
jnz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc0F ; BVS branch on overflow set ; Verified.
|
||||
movsx eax,byte[ebp]
|
||||
inc ebp
|
||||
test byte[SfxOverflow],01h
|
||||
mov cl,[ebp]
|
||||
jz .nojump
|
||||
add ebp,eax
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
.nojump
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc10 ; TO RN set register n as destination register
|
||||
TORNc 0
|
||||
NEWSYM FxOpc11 ; TO RN set register n as destination register
|
||||
TORNc 1
|
||||
NEWSYM FxOpc12 ; TO RN set register n as destination register
|
||||
TORNc 2
|
||||
NEWSYM FxOpc13 ; TO RN set register n as destination register
|
||||
TORNc 3
|
||||
NEWSYM FxOpc14 ; TO RN set register n as destination register
|
||||
TORNc 4
|
||||
NEWSYM FxOpc15 ; TO RN set register n as destination register
|
||||
TORNc 5
|
||||
NEWSYM FxOpc16 ; TO RN set register n as destination register
|
||||
TORNc 6
|
||||
NEWSYM FxOpc17 ; TO RN set register n as destination register
|
||||
TORNc 7
|
||||
NEWSYM FxOpc18 ; TO RN set register n as destination register
|
||||
TORNc 8
|
||||
NEWSYM FxOpc19 ; TO RN set register n as destination register
|
||||
TORNc 9
|
||||
NEWSYM FxOpc1A ; TO RN set register n as destination register
|
||||
TORNc 10
|
||||
NEWSYM FxOpc1B ; TO RN set register n as destination register
|
||||
TORNc 11
|
||||
NEWSYM FxOpc1C ; TO RN set register n as destination register
|
||||
TORNc 12
|
||||
NEWSYM FxOpc1D ; TO RN set register n as destination register
|
||||
TORNc 13
|
||||
NEWSYM FxOpc1E ; TO RN set register n as destination register
|
||||
FETCHPIPE
|
||||
mov eax,[esi] ; Read Source
|
||||
mov [SfxR0+14*4],eax ; Write
|
||||
CLRFLAGS
|
||||
UpdateR14
|
||||
inc ebp ; Increase program counter
|
||||
ret
|
||||
NEWSYM FxOpc1F ; TO RN set register n as destination register
|
||||
FETCHPIPE
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebp,[SfxCPB]
|
||||
mov [SfxR15],eax
|
||||
add ebp,eax
|
||||
CLRFLAGS
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc3D ; ALT1 set alt1 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,01h
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc3E ; ALT2 set alt1 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,02h
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpc3F ; ALT3 set alt3 mode ; Verified.
|
||||
FETCHPIPE
|
||||
mov dword [SfxB],0
|
||||
or ch,03h
|
||||
inc ebp
|
||||
call [FxTablec+ecx*4]
|
||||
xor ch,ch
|
||||
ret
|
||||
|
||||
NEWSYM FxOpcB0 ; FROM rn set source register
|
||||
FROMRNc 0
|
||||
NEWSYM FxOpcB1 ; FROM rn set source register
|
||||
FROMRNc 1
|
||||
NEWSYM FxOpcB2 ; FROM rn set source register
|
||||
FROMRNc 2
|
||||
NEWSYM FxOpcB3 ; FROM rn set source register
|
||||
FROMRNc 3
|
||||
NEWSYM FxOpcB4 ; FROM rn set source register
|
||||
FROMRNc 4
|
||||
NEWSYM FxOpcB5 ; FROM rn set source register
|
||||
FROMRNc 5
|
||||
NEWSYM FxOpcB6 ; FROM rn set source register
|
||||
FROMRNc 6
|
||||
NEWSYM FxOpcB7 ; FROM rn set source register
|
||||
FROMRNc 7
|
||||
NEWSYM FxOpcB8 ; FROM rn set source register
|
||||
FROMRNc 8
|
||||
NEWSYM FxOpcB9 ; FROM rn set source register
|
||||
FROMRNc 9
|
||||
NEWSYM FxOpcBA ; FROM rn set source register
|
||||
FROMRNc 10
|
||||
NEWSYM FxOpcBB ; FROM rn set source register
|
||||
FROMRNc 11
|
||||
NEWSYM FxOpcBC ; FROM rn set source register
|
||||
FROMRNc 12
|
||||
NEWSYM FxOpcBD ; FROM rn set source register
|
||||
FROMRNc 13
|
||||
NEWSYM FxOpcBE ; FROM rn set source register
|
||||
FROMRNc 14
|
||||
NEWSYM FxOpcBF ; FROM rn set source register
|
||||
FETCHPIPE
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
inc ebp
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
shr al,7
|
||||
mov byte[SfxOverflow],al
|
||||
CLRFLAGS
|
||||
ret
|
||||
|
||||
89
zsnes/src/chips/fxemu2b.mac
Normal file
89
zsnes/src/chips/fxemu2b.mac
Normal file
@@ -0,0 +1,89 @@
|
||||
;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 TORNb 1 ; V
|
||||
FETCHPIPE
|
||||
test dword [SfxB],1
|
||||
jnz .VersionB
|
||||
mov edi, SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
mov dword[withr15sk],1
|
||||
mov [SfxR15],eax
|
||||
call [FxTableb+ecx*4]
|
||||
mov edi,SfxR0
|
||||
ret
|
||||
.VersionB
|
||||
mov eax,[esi] ; Read Source
|
||||
mov dword[withr15sk],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [SfxR0+%1*4],eax ; Write
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro FROMRNb 1 ; V
|
||||
FETCHPIPE
|
||||
test dword [SfxB],1
|
||||
jnz .VersionB
|
||||
mov esi,SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTable+ecx*4]
|
||||
mov esi,SfxR0
|
||||
ret
|
||||
.VersionB
|
||||
mov eax,[SfxR0+%1*4] ; Read
|
||||
inc ebp
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
shr al,7
|
||||
mov byte[SfxOverflow],al
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro TORNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[esi] ; Read Source
|
||||
inc ebp ; Increase program counter
|
||||
mov [SfxR0+%1*4],eax ; Write
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
|
||||
%macro FROMRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read
|
||||
inc ebp
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
shr al,7
|
||||
mov byte[SfxOverflow],al
|
||||
CLRFLAGS
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
2551
zsnes/src/chips/fxemu2c.asm
Normal file
2551
zsnes/src/chips/fxemu2c.asm
Normal file
File diff suppressed because it is too large
Load Diff
529
zsnes/src/chips/fxemu2c.mac
Normal file
529
zsnes/src/chips/fxemu2c.mac
Normal file
@@ -0,0 +1,529 @@
|
||||
;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 FXReturn 0
|
||||
dec dword [NumberOfOpcodes]
|
||||
jmp [FxTabled+ecx*4]
|
||||
ALIGN32
|
||||
%endmacro
|
||||
|
||||
%macro FXReturn2 0
|
||||
dec dword [NumberOfOpcodes]
|
||||
js %%endloop
|
||||
jmp [FxTabled+ecx*4]
|
||||
%%endloop
|
||||
jmp FXEndLoop
|
||||
; jmp [FxTabled+ecx*4]
|
||||
ALIGN32
|
||||
%endmacro
|
||||
|
||||
%macro TORNd 1 ; V
|
||||
FETCHPIPE
|
||||
mov edi, SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTable+ecx*4]
|
||||
mov edi,SfxR0
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro WITHc 1 ; Verified.
|
||||
FETCHPIPE
|
||||
mov esi,SfxR0+%1*4
|
||||
mov edi,SfxR0+%1*4
|
||||
mov dword [SfxB],1
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTablec+ecx*4]
|
||||
mov esi,SfxR0
|
||||
mov edi,SfxR0
|
||||
mov dword [SfxB],0 ; Clear B Flag
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro STWRNc 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
add dword [SfxLastRamAdr],ebx ; Save last ram address
|
||||
mov edx,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
mov [ebx+eax],dl ; Store Word
|
||||
xor eax,1
|
||||
inc ebp ; Increase program counter
|
||||
mov [ebx+eax],dh ; Store Word
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro STBRNc 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
FETCHPIPE
|
||||
add eax,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
mov ebx,[esi] ; Read Source
|
||||
mov byte [eax],bl ; Store Byte
|
||||
CLRFLAGS
|
||||
inc ebp ; Increase program counter
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LDWRNc 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
FETCHPIPE
|
||||
mov dl,[ebx+eax] ; Store Word
|
||||
add dword [SfxLastRamAdr],ebx ; Save last ram address
|
||||
xor eax,1
|
||||
and edx,0FFFFh
|
||||
inc ebp ; Increase program counter
|
||||
mov dh,[ebx+eax] ; Store Word
|
||||
mov [edi],edx ; Read Source
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LDBRNc 1 ; V
|
||||
mov eax,[SfxR0+%1*4] ; Read register
|
||||
FETCHPIPE
|
||||
add eax,[SfxRAMMem]
|
||||
xor ebx,ebx
|
||||
mov dword [SfxLastRamAdr],eax ; Save last ram address
|
||||
mov bl,[eax] ; Read Byte
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],ebx ; Store Result
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ADDRNc 1 ; V
|
||||
mov eax, [esi] ; Read Source
|
||||
mov ebx, [SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
add ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ADCRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax, [esi] ; Read Source
|
||||
mov ebx, [SfxR0+%1*4]
|
||||
shr byte[SfxCarry],1
|
||||
adc ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ADIRNc 1 ; V
|
||||
mov eax, [esi] ; Read Source
|
||||
FETCHPIPE
|
||||
add ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ADCIRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax, [esi] ; Read Source
|
||||
shr byte[SfxCarry],1
|
||||
adc ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
mov [SfxSignZero],eax
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro SUBRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
sub ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro SBCRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
cmp byte[SfxCarry],1
|
||||
sbb ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro SUBIRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
sub ax,%1
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
inc ebp ; Increase program counter
|
||||
mov [edi],eax ; Write Destination
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro CMPRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
sub ax,bx
|
||||
seto byte[SfxOverflow]
|
||||
setc byte[SfxCarry]
|
||||
xor byte[SfxCarry],1
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp ; Increase program counter
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ANDRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
and eax,ebx
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro BICRNc 1 ; V
|
||||
mov ebx,[SfxR0+%1*4] ; Read RN
|
||||
mov eax,[esi] ; Read Source
|
||||
xor ebx,0FFFFh
|
||||
FETCHPIPE
|
||||
and eax,ebx
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ANDIRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
and eax,%1
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro BICIRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
and eax,%1
|
||||
inc ebp
|
||||
mov dword [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro MULTRNc 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,byte [SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
imul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro UMULTRNc 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,byte [SfxR0+%1*4] ; Read RN
|
||||
FETCHPIPE
|
||||
mul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro MULTIRNc 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,%1 ; Read RN
|
||||
FETCHPIPE
|
||||
imul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro UMULTIRNc 1 ; V
|
||||
mov al,byte [esi] ; Read Source
|
||||
mov bl,%1 ; Read RN
|
||||
FETCHPIPE
|
||||
mul bl
|
||||
inc ebp
|
||||
and eax,0FFFFh
|
||||
mov [SfxSignZero],eax
|
||||
mov [edi],eax ; Write Destination
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LINKc 1 ; Verified.
|
||||
mov eax,ebp
|
||||
sub eax,[SfxCPB]
|
||||
add eax,%1
|
||||
FETCHPIPE
|
||||
mov word [SfxR11],ax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro JMPRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read RN
|
||||
mov ebp,[SfxCPB]
|
||||
add ebp,eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LJMPRNc 1 ; V
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4]
|
||||
and eax,07Fh
|
||||
mov byte[SfxPBR],al
|
||||
; mov byte[fxtrace+eax],1
|
||||
mov eax,[SfxMemTable+eax*4]
|
||||
mov [SfxCPB],eax
|
||||
mov ebp,eax
|
||||
add ebp,[esi] ; Read RN
|
||||
mov dword [SfxCacheActive],0
|
||||
push ecx
|
||||
call FxOp02
|
||||
pop ecx
|
||||
dec ebp
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro IBTRNc 1 ; V
|
||||
movsx eax,byte[ebp]
|
||||
mov cl,[ebp+1]
|
||||
add ebp,2
|
||||
mov [SfxR0+%1*4],ax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LMSRNc 1 ; Verified.
|
||||
xor eax,eax
|
||||
mov al,[ebp]
|
||||
add eax,eax
|
||||
inc ebp
|
||||
add eax,[SfxRAMMem]
|
||||
mov cl,[ebp]
|
||||
mov dword [SfxLastRamAdr],eax
|
||||
mov ebx,[eax] ; Read word from ram
|
||||
inc ebp
|
||||
mov [SfxR0+%1*4],bx ; Write data
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro SMSRNc 1 ; Verified.
|
||||
xor eax,eax
|
||||
mov al,[ebp]
|
||||
inc ebp
|
||||
add eax,eax
|
||||
mov cl,[ebp]
|
||||
add eax,[SfxRAMMem]
|
||||
mov ebx,[SfxR0+%1*4] ; Read data
|
||||
mov dword [SfxLastRamAdr],eax
|
||||
inc ebp
|
||||
mov [eax],bx ; Write word to ram
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro FROMRNd 1 ; V
|
||||
FETCHPIPE
|
||||
mov esi,SfxR0+%1*4
|
||||
inc ebp ; Increase program counter
|
||||
call [FxTable+ecx*4]
|
||||
mov esi,SfxR0
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ORRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read
|
||||
FETCHPIPE
|
||||
or eax,ebx
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro XORRNc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
mov ebx,[SfxR0+%1*4] ; Read
|
||||
FETCHPIPE
|
||||
xor eax,ebx
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro ORIc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
or eax,%1
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro XORIc 1 ; V
|
||||
mov eax,[esi] ; Read Source
|
||||
FETCHPIPE
|
||||
xor eax,%1
|
||||
inc ebp
|
||||
mov [edi],eax ; Write DREG
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro INCRNc 1 ; Verified
|
||||
inc word[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read Source
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro DECRNc 1 ; Verified
|
||||
dec word[SfxR0+%1*4]
|
||||
FETCHPIPE
|
||||
mov eax,[SfxR0+%1*4] ; Read Source
|
||||
mov [SfxR0+%1*4],eax
|
||||
mov [SfxSignZero],eax
|
||||
CLRFLAGS
|
||||
inc ebp
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro IWTRNc 1 ; aka LEA ; Verified.
|
||||
mov eax,[ebp]
|
||||
mov cl,[ebp+2]
|
||||
and eax,0FFFFh
|
||||
add ebp,3
|
||||
mov [SfxR0+%1*4],eax
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro LMRNc 1 ; Verified!
|
||||
xor eax,eax
|
||||
mov cl,[ebp+2]
|
||||
mov ax,[ebp]
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov [SfxLastRamAdr],eax
|
||||
add [SfxLastRamAdr],ebx
|
||||
mov dl,[eax+ebx]
|
||||
xor eax,1
|
||||
add ebp,3
|
||||
mov dh,[eax+ebx]
|
||||
mov word [SfxR0+%1*4],dx ; Store Word
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
%macro SMRNc 1 ; Verified
|
||||
mov ebx,[SfxR0+%1*4]
|
||||
mov eax,[ebp]
|
||||
mov cl,[ebp+2]
|
||||
and eax,0FFFFh
|
||||
mov dx,bx
|
||||
mov ebx,[SfxRAMMem]
|
||||
mov [SfxLastRamAdr],eax
|
||||
add [SfxLastRamAdr],ebx
|
||||
mov [eax+ebx],dl
|
||||
xor eax,1
|
||||
add ebp,3
|
||||
mov [eax+ebx],dh
|
||||
CLRFLAGS
|
||||
FXReturn
|
||||
%endmacro
|
||||
|
||||
3546
zsnes/src/chips/fxtable.asm
Normal file
3546
zsnes/src/chips/fxtable.asm
Normal file
File diff suppressed because it is too large
Load Diff
365
zsnes/src/chips/sa1proc.asm
Normal file
365
zsnes/src/chips/sa1proc.asm
Normal file
@@ -0,0 +1,365 @@
|
||||
;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 xa,xx,xy,xd,xdb,xpb,xs,xe,initaddrl,UpdateDPage,wramdata,IRAM,cycpbl,SA1DoIRQ
|
||||
EXTSYM spcnumread,SA1IRQEn,nextopcodesa1,debugds
|
||||
EXTSYM SNSRegP,SNSRegE,SNSRegPCS,SA1Ptr,SNSPtr,nmiv,irqv,nmiv2,irqv2,snesmap2,SA1tablead
|
||||
EXTSYM SA1xpb,SA1RegP,wramdataa,SA1TimerVal,debuggeron
|
||||
EXTSYM SA1RegE,SA1RegPCS,SA1BWPtr,SNSBWPtr,CurBWPtr,SA1NMIV,SA1IRQV,debstop,tablead
|
||||
EXTSYM membank0w8,romdata,SA1LBound,SA1UBound,SA1SH,SA1SHb
|
||||
EXTSYM stackor,stackand,snesmmap,SA1xs,SA1IRQExec
|
||||
EXTSYM SA1Message,Sflagnz,Sflagc,Sflago
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; In exec loop, jump to execloop if SA1Status != 0
|
||||
; *** Disable spc700 if possible ***
|
||||
|
||||
|
||||
|
||||
NEWSYM SA1Status, db 0 ; 0 = 65816, 1 = SA1A, 2 = SA1B
|
||||
|
||||
NEWSYM CurrentExecSA1, db 0
|
||||
NEWSYM CurrentCPU, db 0
|
||||
|
||||
ALIGN32
|
||||
NEWSYM prevedi, dd 0
|
||||
|
||||
%macro SA1Debugb 0
|
||||
pushad
|
||||
sub esi,[initaddrl]
|
||||
mov [SA1xpc],esi
|
||||
call nextopcodesa1
|
||||
popad
|
||||
mov bl,[esi]
|
||||
xor dh,dh
|
||||
inc esi
|
||||
call dword near [edi+ebx*4]
|
||||
dec esi
|
||||
%endmacro
|
||||
|
||||
%macro SA1Debug 0
|
||||
; debug version
|
||||
test byte[debugds],01h
|
||||
jz near .nodebug
|
||||
cmp byte[debuggeron],0
|
||||
je near .nodebug
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
SA1Debugb
|
||||
jmp .debug
|
||||
.nodebug
|
||||
%endmacro
|
||||
|
||||
|
||||
NEWSYM SA1Swap
|
||||
mov ecx,[SA1BWPtr]
|
||||
mov eax,[SA1Ptr] ; small speed hack
|
||||
test byte[SA1DoIRQ],1
|
||||
jnz near .sa1exec3
|
||||
cmp byte[IRAM],0
|
||||
jne .sa1exec2
|
||||
cmp dword[eax],0FCF000A5h
|
||||
je near .nosa1exec
|
||||
cmp dword[eax-2],0FCF000A5h
|
||||
je near .nosa1exec
|
||||
.sa1exec2
|
||||
cmp byte[SA1SHb],1
|
||||
je near .nosa1execb
|
||||
|
||||
cmp word[ecx+72A4h],0
|
||||
jnz .sa1exec
|
||||
cmp dword[eax],0F072A4ADh
|
||||
je near .nosa1execb
|
||||
.sa1exec
|
||||
cmp byte[IRAM+72h],0
|
||||
jne .sa1exec3
|
||||
cmp dword[eax],0F03072ADh
|
||||
je near .nosa1execb
|
||||
.sa1exec3
|
||||
.yesdebugr
|
||||
xor ecx,ecx
|
||||
; store all snes 65816 stuff
|
||||
mov [SNSRegP],dl
|
||||
mov eax,[initaddrl]
|
||||
mov [prevedi],edi
|
||||
mov [SNSRegPCS],eax
|
||||
mov [SNSPtr],esi
|
||||
; restore all sa1 65816 stuff
|
||||
mov dl,[SA1RegP]
|
||||
mov eax,[SA1RegPCS]
|
||||
mov [initaddrl],eax
|
||||
mov eax,[SA1BWPtr]
|
||||
mov [CurBWPtr],eax
|
||||
mov esi,[SA1Ptr]
|
||||
mov dword[snesmap2],IRAM
|
||||
mov dword[wramdata],IRAM
|
||||
; Check if IRQ is executed on SA-1
|
||||
xor eax,eax
|
||||
mov al,dl
|
||||
add dh,25
|
||||
mov edi,[SA1tablead+eax*4]
|
||||
mov byte[SA1Status],1
|
||||
test dword[SA1DoIRQ],0FF000003h
|
||||
jnz near .switchirq
|
||||
.returnirq
|
||||
|
||||
; SA1Debug
|
||||
|
||||
cmp byte[SA1SH],1
|
||||
je near .speedhack
|
||||
|
||||
; non debug version
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
call dword near [edi+ebx*4]
|
||||
dec esi
|
||||
.debug
|
||||
|
||||
; store all sa1 65816 stuff
|
||||
mov [SA1RegP],dl
|
||||
mov eax,[initaddrl]
|
||||
mov [SA1RegPCS],eax
|
||||
mov [SA1Ptr],esi
|
||||
; restore all snes 65816 stuff
|
||||
mov dl,[SNSRegP]
|
||||
mov eax,[SNSRegPCS]
|
||||
mov [initaddrl],eax
|
||||
mov eax,[SNSBWPtr]
|
||||
mov [CurBWPtr],eax
|
||||
mov dword[wramdata],wramdataa
|
||||
mov esi,[SNSPtr]
|
||||
mov eax,[wramdata]
|
||||
mov dword[snesmap2],eax
|
||||
mov edi,[prevedi]
|
||||
xor eax,eax
|
||||
add dh,11
|
||||
inc byte[CurrentExecSA1]
|
||||
mov byte[SA1Status],0
|
||||
add dword[SA1TimerVal],23
|
||||
ret
|
||||
|
||||
.speedhack
|
||||
add dh,100
|
||||
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
call dword near [edi+ebx*4]
|
||||
dec esi
|
||||
; store all sa1 65816 stuff
|
||||
mov [SA1RegP],dl
|
||||
mov eax,[initaddrl]
|
||||
mov [SA1RegPCS],eax
|
||||
mov [SA1Ptr],esi
|
||||
; restore all snes 65816 stuff
|
||||
mov dl,[SNSRegP]
|
||||
mov eax,[SNSRegPCS]
|
||||
mov [initaddrl],eax
|
||||
mov eax,[SNSBWPtr]
|
||||
mov [CurBWPtr],eax
|
||||
mov dword[wramdata],wramdataa
|
||||
mov esi,[SNSPtr]
|
||||
mov eax,[wramdata]
|
||||
mov dword[snesmap2],eax
|
||||
mov edi,[prevedi]
|
||||
xor eax,eax
|
||||
add byte[CurrentExecSA1],4
|
||||
mov byte[SA1Status],0
|
||||
add dword[SA1TimerVal],23
|
||||
; xor dh,dh
|
||||
mov dh,18
|
||||
cmp esi,dword[SA1LBound]
|
||||
jb .stoph
|
||||
cmp esi,dword[SA1UBound]
|
||||
ja .stoph
|
||||
ret
|
||||
.stoph
|
||||
mov byte[SA1SH],0
|
||||
ret
|
||||
.nosa1execb
|
||||
xor ecx,ecx
|
||||
add dh,15
|
||||
add byte[CurrentExecSA1],2
|
||||
mov byte[SA1Status],0
|
||||
ret
|
||||
.nosa1exec
|
||||
xor ecx,ecx
|
||||
add dh,22
|
||||
add byte[CurrentExecSA1],2
|
||||
mov byte[SA1Status],0
|
||||
ret
|
||||
.switchirq
|
||||
test dword[SA1DoIRQ],3
|
||||
jz .notirq
|
||||
test dword[SA1DoIRQ],1
|
||||
jz .nmi
|
||||
and byte[SA1DoIRQ],0FEh
|
||||
call SA1switchtovirq
|
||||
jmp .returnirq
|
||||
.nmi
|
||||
and byte[SA1DoIRQ],0FDh
|
||||
call SA1switchtonmi
|
||||
jmp .returnirq
|
||||
.notirq
|
||||
dec byte[SA1DoIRQ+3]
|
||||
jz .hack
|
||||
jmp .returnirq
|
||||
.hack
|
||||
or byte[SA1DoIRQ],8
|
||||
jmp .returnirq
|
||||
|
||||
NEWSYM SA1xpc, dd 0
|
||||
|
||||
%macro makedl 0
|
||||
and dl,00111100b
|
||||
test dword[Sflagnz],18000h
|
||||
jz %%noneg
|
||||
or dl,80h
|
||||
%%noneg
|
||||
test dword[Sflagnz],0FFFFh
|
||||
jnz %%nozero
|
||||
or dl,02h
|
||||
%%nozero
|
||||
test dword[Sflagc],0FFh
|
||||
jz %%nocarry
|
||||
or dl,01h
|
||||
%%nocarry
|
||||
test dword[Sflago],0FFh
|
||||
jz %%nov
|
||||
or dl,40h
|
||||
%%nov
|
||||
%endmacro
|
||||
|
||||
NEWSYM SA1switchtonmi
|
||||
mov al,byte[SA1Message]
|
||||
mov byte[SA1Message+2],al
|
||||
mov byte[SA1IRQExec+2],1
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [SA1xpc],bx
|
||||
|
||||
xor ecx,ecx
|
||||
mov cx,[SA1xs]
|
||||
mov al,[SA1xpb]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov al,[SA1xpc+1]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov al,[SA1xpc]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
makedl
|
||||
mov al,dl
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov [SA1xs],cx
|
||||
|
||||
xor ebx,ebx
|
||||
mov [SA1xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[SA1NMIV]
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
|
||||
NEWSYM SA1switchtovirq
|
||||
mov al,byte[SA1Message]
|
||||
mov byte[SA1Message+2],al
|
||||
mov byte[SA1IRQExec+1],1
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [SA1xpc],bx
|
||||
|
||||
xor ecx,ecx
|
||||
mov cx,[SA1xs]
|
||||
mov al,[SA1xpb]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov al,[SA1xpc+1]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov al,[SA1xpc]
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
makedl
|
||||
mov al,dl
|
||||
call membank0w8
|
||||
|
||||
dec cx
|
||||
and cx,word[stackand]
|
||||
or cx,word[stackor]
|
||||
mov [SA1xs],cx
|
||||
xor ebx,ebx
|
||||
mov [SA1xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[SA1IRQV]
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
|
||||
2577
zsnes/src/chips/sa1regs.asm
Normal file
2577
zsnes/src/chips/sa1regs.asm
Normal file
File diff suppressed because it is too large
Load Diff
670
zsnes/src/chips/sfxproc.asm
Normal file
670
zsnes/src/chips/sfxproc.asm
Normal file
@@ -0,0 +1,670 @@
|
||||
;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 NumberOfOpcodes,SfxB,SfxBRAMR,SfxCBR,SfxCFGR,SfxCLSR,SfxCPB,SfxCROM
|
||||
EXTSYM SfxCarry,SfxMemTable,SfxOverflow,SfxPBR,SfxPIPE,SfxR0,SfxR1,SfxR10
|
||||
EXTSYM SfxR11,SfxR12,SfxR13,SfxR14,SfxR15,SfxR2,SfxR3,SfxR4,SfxR5,SfxR6
|
||||
EXTSYM SfxR7,SfxR8,SfxR9,SfxRAMBR,SfxRAMMem,SfxROMBR,SfxSCBR,SfxSCMR,SfxSFR
|
||||
EXTSYM SfxSignZero,SfxnRamBanks,StartSFX,regptr,regptw,sfxramdata,ChangeOps
|
||||
EXTSYM SfxPOR,sfxclineloc,UpdatePORSCMR,UpdateCLSR,UpdateSCBRCOLR,SfxAC
|
||||
EXTSYM sfx128lineloc,sfx160lineloc,sfx192lineloc,sfxobjlineloc,SFXProc
|
||||
|
||||
%include "cpu\regs.mac"
|
||||
%include "cpu\regsw.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%macro AssembleSFXFlags 0
|
||||
and word[SfxSFR],8F60h
|
||||
test byte[SfxCarry],1
|
||||
jz .nosfxcarry
|
||||
or word[SfxSFR],04h
|
||||
.nosfxcarry
|
||||
cmp word[SfxSignZero],0
|
||||
jne .nozero
|
||||
or word[SfxSFR],02h
|
||||
.nozero
|
||||
test word[SfxSignZero],8000h
|
||||
jz .noneg
|
||||
or word[SfxSFR],08h
|
||||
.noneg
|
||||
cmp byte[SfxOverflow],0
|
||||
je .noof
|
||||
or word[SfxSFR],10h
|
||||
.noof
|
||||
cmp byte[SfxB],0
|
||||
je .bzero
|
||||
or word[SfxSFR],1000h
|
||||
.bzero
|
||||
%endmacro
|
||||
|
||||
|
||||
NEWSYM initsfxregsr
|
||||
setreg 3000h*4,reg3000r
|
||||
setreg 3001h*4,reg3001r
|
||||
setreg 3002h*4,reg3002r
|
||||
setreg 3003h*4,reg3003r
|
||||
setreg 3004h*4,reg3004r
|
||||
setreg 3005h*4,reg3005r
|
||||
setreg 3006h*4,reg3006r
|
||||
setreg 3007h*4,reg3007r
|
||||
setreg 3008h*4,reg3008r
|
||||
setreg 3009h*4,reg3009r
|
||||
setreg 300Ah*4,reg300Ar
|
||||
setreg 300Bh*4,reg300Br
|
||||
setreg 300Ch*4,reg300Cr
|
||||
setreg 300Dh*4,reg300Dr
|
||||
setreg 300Eh*4,reg300Er
|
||||
setreg 300Fh*4,reg300Fr
|
||||
setreg 3010h*4,reg3010r
|
||||
setreg 3011h*4,reg3011r
|
||||
setreg 3012h*4,reg3012r
|
||||
setreg 3013h*4,reg3013r
|
||||
setreg 3014h*4,reg3014r
|
||||
setreg 3015h*4,reg3015r
|
||||
setreg 3016h*4,reg3016r
|
||||
setreg 3017h*4,reg3017r
|
||||
setreg 3018h*4,reg3018r
|
||||
setreg 3019h*4,reg3019r
|
||||
setreg 301Ah*4,reg301Ar
|
||||
setreg 301Bh*4,reg301Br
|
||||
setreg 301Ch*4,reg301Cr
|
||||
setreg 301Dh*4,reg301Dr
|
||||
setreg 301Eh*4,reg301Er
|
||||
setreg 301Fh*4,reg301Fr
|
||||
setreg 3030h*4,reg3030r
|
||||
setreg 3031h*4,reg3031r
|
||||
setreg 3032h*4,reg3032r
|
||||
setreg 3033h*4,reg3033r
|
||||
setreg 3034h*4,reg3034r
|
||||
setreg 3035h*4,reg3035r
|
||||
setreg 3036h*4,reg3036r
|
||||
setreg 3037h*4,reg3037r
|
||||
setreg 3038h*4,reg3038r
|
||||
setreg 3039h*4,reg3039r
|
||||
setreg 303Ah*4,reg303Ar
|
||||
setreg 303Bh*4,reg303Br
|
||||
setreg 303Ch*4,reg303Cr
|
||||
setreg 303Dh*4,reg303Dr
|
||||
setreg 303Eh*4,reg303Er
|
||||
setreg 303Fh*4,reg303Fr
|
||||
; set 3100-31FF to cacheregr
|
||||
mov edi,3100h*4
|
||||
add edi,[regptr]
|
||||
mov eax,cacheregr
|
||||
mov ecx,200h
|
||||
.loop
|
||||
mov [edi],eax
|
||||
add edi,4
|
||||
dec ecx
|
||||
jnz .loop
|
||||
ret
|
||||
|
||||
NEWSYM initsfxregsw
|
||||
setregw 3000h*4,reg3000w
|
||||
setregw 3001h*4,reg3001w
|
||||
setregw 3002h*4,reg3002w
|
||||
setregw 3003h*4,reg3003w
|
||||
setregw 3004h*4,reg3004w
|
||||
setregw 3005h*4,reg3005w
|
||||
setregw 3006h*4,reg3006w
|
||||
setregw 3007h*4,reg3007w
|
||||
setregw 3008h*4,reg3008w
|
||||
setregw 3009h*4,reg3009w
|
||||
setregw 300Ah*4,reg300Aw
|
||||
setregw 300Bh*4,reg300Bw
|
||||
setregw 300Ch*4,reg300Cw
|
||||
setregw 300Dh*4,reg300Dw
|
||||
setregw 300Eh*4,reg300Ew
|
||||
setregw 300Fh*4,reg300Fw
|
||||
setregw 3010h*4,reg3010w
|
||||
setregw 3011h*4,reg3011w
|
||||
setregw 3012h*4,reg3012w
|
||||
setregw 3013h*4,reg3013w
|
||||
setregw 3014h*4,reg3014w
|
||||
setregw 3015h*4,reg3015w
|
||||
setregw 3016h*4,reg3016w
|
||||
setregw 3017h*4,reg3017w
|
||||
setregw 3018h*4,reg3018w
|
||||
setregw 3019h*4,reg3019w
|
||||
setregw 301Ah*4,reg301Aw
|
||||
setregw 301Bh*4,reg301Bw
|
||||
setregw 301Ch*4,reg301Cw
|
||||
setregw 301Dh*4,reg301Dw
|
||||
setregw 301Eh*4,reg301Ew
|
||||
setregw 301Fh*4,reg301Fw
|
||||
setregw 3030h*4,reg3030w
|
||||
setregw 3031h*4,reg3031w
|
||||
setregw 3032h*4,reg3032w
|
||||
setregw 3033h*4,reg3033w
|
||||
setregw 3034h*4,reg3034w
|
||||
setregw 3035h*4,reg3035w
|
||||
setregw 3036h*4,reg3036w
|
||||
setregw 3037h*4,reg3037w
|
||||
setregw 3038h*4,reg3038w
|
||||
setregw 3039h*4,reg3039w
|
||||
setregw 303Ah*4,reg303Aw
|
||||
setregw 303Bh*4,reg303Bw
|
||||
setregw 303Ch*4,reg303Cw
|
||||
setregw 303Dh*4,reg303Dw
|
||||
setregw 303Eh*4,reg303Ew
|
||||
setregw 303Fh*4,reg303Fw
|
||||
; set 3100-31FF to cacheregw
|
||||
mov edi,3100h*4
|
||||
add edi,[regptw]
|
||||
mov eax,cacheregw
|
||||
mov ecx,200h
|
||||
.loop
|
||||
mov [edi],eax
|
||||
add edi,4
|
||||
dec ecx
|
||||
jnz .loop
|
||||
ret
|
||||
|
||||
NEWSYM cacheregr
|
||||
or byte[cachewarning],1
|
||||
ret
|
||||
|
||||
NEWSYM cacheregw
|
||||
or byte[cachewarning],2
|
||||
ret
|
||||
|
||||
NEWSYM cachewarning, db 0
|
||||
|
||||
; SFX Registers
|
||||
|
||||
NEWSYM reg3000r
|
||||
mov al,[SfxR0]
|
||||
ret
|
||||
NEWSYM reg3001r
|
||||
mov al,[SfxR0+1]
|
||||
ret
|
||||
NEWSYM reg3002r
|
||||
mov al,[SfxR1]
|
||||
ret
|
||||
NEWSYM reg3003r
|
||||
mov al,[SfxR1+1]
|
||||
ret
|
||||
NEWSYM reg3004r
|
||||
mov al,[SfxR2]
|
||||
ret
|
||||
NEWSYM reg3005r
|
||||
mov al,[SfxR2+1]
|
||||
ret
|
||||
NEWSYM reg3006r
|
||||
mov al,[SfxR3]
|
||||
ret
|
||||
NEWSYM reg3007r
|
||||
mov al,[SfxR3+1]
|
||||
ret
|
||||
NEWSYM reg3008r
|
||||
mov al,[SfxR4]
|
||||
ret
|
||||
NEWSYM reg3009r
|
||||
mov al,[SfxR4+1]
|
||||
ret
|
||||
NEWSYM reg300Ar
|
||||
mov al,[SfxR5]
|
||||
ret
|
||||
NEWSYM reg300Br
|
||||
mov al,[SfxR5+1]
|
||||
ret
|
||||
NEWSYM reg300Cr
|
||||
mov al,[SfxR6]
|
||||
ret
|
||||
NEWSYM reg300Dr
|
||||
mov al,[SfxR6+1]
|
||||
ret
|
||||
NEWSYM reg300Er
|
||||
mov al,[SfxR7]
|
||||
ret
|
||||
NEWSYM reg300Fr
|
||||
mov al,[SfxR7+1]
|
||||
ret
|
||||
NEWSYM reg3010r
|
||||
mov al,[SfxR8]
|
||||
ret
|
||||
NEWSYM reg3011r
|
||||
mov al,[SfxR8+1]
|
||||
ret
|
||||
NEWSYM reg3012r
|
||||
mov al,[SfxR9]
|
||||
ret
|
||||
NEWSYM reg3013r
|
||||
mov al,[SfxR9+1]
|
||||
ret
|
||||
NEWSYM reg3014r
|
||||
mov al,[SfxR10]
|
||||
ret
|
||||
NEWSYM reg3015r
|
||||
mov al,[SfxR10+1]
|
||||
ret
|
||||
NEWSYM reg3016r
|
||||
mov al,[SfxR11]
|
||||
ret
|
||||
NEWSYM reg3017r
|
||||
mov al,[SfxR11+1]
|
||||
ret
|
||||
NEWSYM reg3018r
|
||||
mov al,[SfxR12]
|
||||
ret
|
||||
NEWSYM reg3019r
|
||||
mov al,[SfxR12+1]
|
||||
ret
|
||||
NEWSYM reg301Ar
|
||||
mov al,[SfxR13]
|
||||
ret
|
||||
NEWSYM reg301Br
|
||||
mov al,[SfxR13+1]
|
||||
ret
|
||||
NEWSYM reg301Cr
|
||||
mov al,[SfxR14]
|
||||
ret
|
||||
NEWSYM reg301Dr
|
||||
mov al,[SfxR14+1]
|
||||
ret
|
||||
NEWSYM reg301Er
|
||||
mov al,[SfxR15]
|
||||
ret
|
||||
NEWSYM reg301Fr
|
||||
mov al,[SfxR15+1]
|
||||
ret
|
||||
|
||||
; Other SFX stuff
|
||||
|
||||
NEWSYM reg3030r
|
||||
AssembleSFXFlags
|
||||
mov al,[SfxSFR]
|
||||
ret
|
||||
NEWSYM reg3031r
|
||||
cmp byte[SfxAC],1
|
||||
je .alwaysclear
|
||||
cmp dword[ChangeOps],-350*240
|
||||
jl .noclear
|
||||
.alwaysclear
|
||||
and byte[SfxSFR+1],07fh ; clear IRQ flag
|
||||
jmp .cleared
|
||||
.noclear
|
||||
cmp dword[ChangeOps],-350*240*4
|
||||
jge .clear
|
||||
mov dword[ChangeOps],-350*240*4
|
||||
jmp .cleared
|
||||
.clear
|
||||
add dword[ChangeOps],350*240
|
||||
.cleared
|
||||
mov al,[SfxSFR+1]
|
||||
ret
|
||||
.test db 0
|
||||
NEWSYM reg3032r ; Unused
|
||||
xor al,al
|
||||
ret
|
||||
NEWSYM reg3033r ; BRAMR Backup Ram Read only on/off (bits 1-15 unused)
|
||||
mov al,[SfxBRAMR]
|
||||
ret
|
||||
NEWSYM reg3034r ; PBR (Program Bank)
|
||||
mov al,[SfxPBR]
|
||||
ret
|
||||
NEWSYM reg3035r ; Unused
|
||||
xor al,al
|
||||
ret
|
||||
NEWSYM reg3036r ; ROMBR (Gamepak Rom Bank Register)
|
||||
mov al,[SfxROMBR]
|
||||
ret
|
||||
NEWSYM reg3037r ; CFGR (Control Flags Register)
|
||||
mov al,[SfxCFGR]
|
||||
ret
|
||||
NEWSYM reg3038r ; SCBR (Screen Bank Register)
|
||||
mov al,[SfxSCBR]
|
||||
ret
|
||||
NEWSYM reg3039r ; CLSR (Clock Speed Register)
|
||||
mov al,[SfxCLSR]
|
||||
ret
|
||||
NEWSYM reg303Ar ; SCMR (Screen Mode Register)
|
||||
mov al,[SfxSCMR]
|
||||
test byte[SfxPOR],10h
|
||||
jnz .objmode
|
||||
mov al,[SfxSCMR]
|
||||
and al,00100100b ; 4 + 32
|
||||
cmp al,4
|
||||
je .lines160
|
||||
cmp al,32
|
||||
je .lines192
|
||||
cmp al,36
|
||||
je .objmode
|
||||
mov eax,[sfx128lineloc]
|
||||
jmp .donelines
|
||||
.lines160
|
||||
mov eax,[sfx160lineloc]
|
||||
jmp .donelines
|
||||
.lines192
|
||||
mov eax,[sfx192lineloc]
|
||||
jmp .donelines
|
||||
.objmode
|
||||
mov eax,[sfxobjlineloc]
|
||||
.donelines
|
||||
mov [sfxclineloc],eax
|
||||
ret
|
||||
NEWSYM reg303Br ; VCR (Version Code Register)
|
||||
mov al,20h
|
||||
ret
|
||||
NEWSYM reg303Cr ; RAMBR (Ram bank register)
|
||||
mov al,[SfxRAMBR]
|
||||
ret
|
||||
NEWSYM reg303Dr ; Unused
|
||||
xor al,al
|
||||
ret
|
||||
NEWSYM reg303Er ; CBR (Cache Base Register), lower byte
|
||||
mov al,[SfxCBR]
|
||||
ret
|
||||
NEWSYM reg303Fr ; CBR (Cache Base Register), upper byte
|
||||
mov al,[SfxCBR+1]
|
||||
ret
|
||||
|
||||
; SFX Write Registers
|
||||
|
||||
NEWSYM reg3000w
|
||||
mov [SfxR0],al
|
||||
ret
|
||||
NEWSYM reg3001w
|
||||
mov [SfxR0+1],al
|
||||
ret
|
||||
NEWSYM reg3002w
|
||||
mov [SfxR1],al
|
||||
ret
|
||||
NEWSYM reg3003w
|
||||
mov [SfxR1+1],al
|
||||
ret
|
||||
NEWSYM reg3004w
|
||||
mov [SfxR2],al
|
||||
ret
|
||||
NEWSYM reg3005w
|
||||
mov [SfxR2+1],al
|
||||
ret
|
||||
NEWSYM reg3006w
|
||||
mov [SfxR3],al
|
||||
ret
|
||||
NEWSYM reg3007w
|
||||
mov [SfxR3+1],al
|
||||
ret
|
||||
NEWSYM reg3008w
|
||||
mov [SfxR4],al
|
||||
ret
|
||||
NEWSYM reg3009w
|
||||
mov [SfxR4+1],al
|
||||
ret
|
||||
NEWSYM reg300Aw
|
||||
mov [SfxR5],al
|
||||
ret
|
||||
NEWSYM reg300Bw
|
||||
mov [SfxR5+1],al
|
||||
ret
|
||||
NEWSYM reg300Cw
|
||||
mov [SfxR6],al
|
||||
ret
|
||||
NEWSYM reg300Dw
|
||||
mov [SfxR6+1],al
|
||||
ret
|
||||
NEWSYM reg300Ew
|
||||
mov [SfxR7],al
|
||||
ret
|
||||
NEWSYM reg300Fw
|
||||
mov [SfxR7+1],al
|
||||
ret
|
||||
NEWSYM reg3010w
|
||||
mov [SfxR8],al
|
||||
ret
|
||||
NEWSYM reg3011w
|
||||
mov [SfxR8+1],al
|
||||
ret
|
||||
NEWSYM reg3012w
|
||||
mov [SfxR9],al
|
||||
ret
|
||||
NEWSYM reg3013w
|
||||
mov [SfxR9+1],al
|
||||
ret
|
||||
NEWSYM reg3014w
|
||||
mov [SfxR10],al
|
||||
ret
|
||||
NEWSYM reg3015w
|
||||
mov [SfxR10+1],al
|
||||
ret
|
||||
NEWSYM reg3016w
|
||||
mov [SfxR11],al
|
||||
ret
|
||||
NEWSYM reg3017w
|
||||
mov [SfxR11+1],al
|
||||
ret
|
||||
NEWSYM reg3018w
|
||||
mov [SfxR12],al
|
||||
ret
|
||||
NEWSYM reg3019w
|
||||
mov [SfxR12+1],al
|
||||
ret
|
||||
NEWSYM reg301Aw
|
||||
mov [SfxR13],al
|
||||
ret
|
||||
NEWSYM reg301Bw
|
||||
mov [SfxR13+1],al
|
||||
ret
|
||||
NEWSYM reg301Cw
|
||||
mov [SfxR14],al
|
||||
ret
|
||||
NEWSYM reg301Dw
|
||||
mov [SfxR14+1],al
|
||||
ret
|
||||
NEWSYM reg301Ew
|
||||
mov [SfxR15],al
|
||||
ret
|
||||
NEWSYM reg301Fw
|
||||
mov [SfxR15+1],al
|
||||
; start execution
|
||||
push edx
|
||||
mov edx,[SfxPBR]
|
||||
mov edx,[SfxMemTable+edx*4]
|
||||
add edx,[SfxR15]
|
||||
mov dl,[edx]
|
||||
mov [SfxPIPE],dl
|
||||
pop edx
|
||||
inc word[SfxR15]
|
||||
or byte[SfxSFR],20h
|
||||
or dword [SfxSFR],08000h ; Set IRQ Flag
|
||||
mov dword[SFXProc],1
|
||||
; call StartSFXret
|
||||
ret
|
||||
|
||||
; Other SFX stuff
|
||||
|
||||
NEWSYM reg3030w
|
||||
mov [SfxSFR],al
|
||||
; mov dh,10
|
||||
; Disassemble Flags
|
||||
test al,20h
|
||||
jz .noexec
|
||||
pushad
|
||||
mov dword [NumberOfOpcodes],100
|
||||
call StartSFX
|
||||
popad
|
||||
.noexec
|
||||
ret
|
||||
NEWSYM reg3031w
|
||||
mov [SfxSFR+1],al
|
||||
ret
|
||||
NEWSYM reg3032w ; Unused
|
||||
ret
|
||||
NEWSYM reg3033w ; BRAMR Backup Ram Read only on/off (bits 1-15 unused)
|
||||
and al,0FEh
|
||||
mov [SfxBRAMR],al
|
||||
ret
|
||||
NEWSYM reg3034w ; PBR (Program Bank)
|
||||
mov [SfxPBR],al
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
mov ebx,[SfxMemTable+ebx*4]
|
||||
mov [SfxCPB],ebx
|
||||
ret
|
||||
NEWSYM reg3035w ; Unused
|
||||
ret
|
||||
NEWSYM reg3036w ; ROMBR (Gamepak Rom Bank Register)
|
||||
mov [SfxROMBR],al
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
mov ebx,[SfxMemTable+ebx*4]
|
||||
mov [SfxCROM],ebx
|
||||
ret
|
||||
NEWSYM reg3037w ; CFGR (Control Flags Register)
|
||||
mov [SfxCFGR],al
|
||||
ret
|
||||
NEWSYM reg3038w ; SCBR (Screen Bank Register)
|
||||
mov [SfxSCBR],al
|
||||
call UpdateSCBRCOLR
|
||||
ret
|
||||
NEWSYM reg3039w ; CLSR (Clock Speed Register)
|
||||
and al,0FEh
|
||||
mov [SfxCLSR],al
|
||||
call UpdateCLSR
|
||||
ret
|
||||
NEWSYM reg303Aw ; SCMR (Screen Mode Register)
|
||||
mov [SfxSCMR],al
|
||||
call UpdatePORSCMR
|
||||
ret
|
||||
NEWSYM reg303Bw ; VCR (Version Code Register)
|
||||
ret
|
||||
NEWSYM reg303Cw ; RAMBR (Ram bank register)
|
||||
mov bl,[SfxnRamBanks]
|
||||
dec bl
|
||||
and al,bl
|
||||
mov ebx,[SfxnRamBanks]
|
||||
dec ebx
|
||||
and eax,ebx
|
||||
mov [SfxRAMBR],eax
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
shl ebx,16
|
||||
add ebx,[sfxramdata]
|
||||
mov dword [SfxRAMMem],ebx
|
||||
ret
|
||||
NEWSYM reg303Dw ; Unused
|
||||
ret
|
||||
NEWSYM reg303Ew ; CBR (Cache Base Register), lower byte
|
||||
mov [SfxCBR],al
|
||||
ret
|
||||
NEWSYM reg303Fw ; CBR (Cache Base Register), upper byte
|
||||
mov [SfxCBR+1],al
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr8
|
||||
mov ebx,[sfxramdata]
|
||||
mov al,[ebx+ecx]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw8
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx],al
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr16
|
||||
mov ebx,[sfxramdata]
|
||||
mov ax,[ebx+ecx]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw16
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx],ax
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr8b
|
||||
mov ebx,[sfxramdata]
|
||||
mov al,[ebx+ecx+65536]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw8b
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536],al
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr16b
|
||||
mov ebx,[sfxramdata]
|
||||
mov ax,[ebx+ecx+65536]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw16b
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536],ax
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr8c
|
||||
mov ebx,[sfxramdata]
|
||||
mov al,[ebx+ecx+65536*2]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw8c
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536*2],al
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr16c
|
||||
mov ebx,[sfxramdata]
|
||||
mov ax,[ebx+ecx+65536*2]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw16c
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536*2],ax
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr8d
|
||||
mov ebx,[sfxramdata]
|
||||
mov al,[ebx+ecx+65536*3]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw8d
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536*3],al
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankr16d
|
||||
mov ebx,[sfxramdata]
|
||||
mov ax,[ebx+ecx+65536*3]
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
NEWSYM sfxaccessbankw16d
|
||||
mov ebx,[sfxramdata]
|
||||
mov [ebx+ecx+65536*3],ax
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
|
||||
1623
zsnes/src/cpu/65816d.inc
Normal file
1623
zsnes/src/cpu/65816d.inc
Normal file
File diff suppressed because it is too large
Load Diff
1621
zsnes/src/cpu/65816db.inc
Normal file
1621
zsnes/src/cpu/65816db.inc
Normal file
File diff suppressed because it is too large
Load Diff
1631
zsnes/src/cpu/65816dc.inc
Normal file
1631
zsnes/src/cpu/65816dc.inc
Normal file
File diff suppressed because it is too large
Load Diff
812
zsnes/src/cpu/address.inc
Normal file
812
zsnes/src/cpu/address.inc
Normal file
@@ -0,0 +1,812 @@
|
||||
;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.
|
||||
|
||||
EXTSYM membank0w8ram
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8br 0
|
||||
mov al,[esi]
|
||||
inc esi
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16br 0
|
||||
mov eax,[esi]
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
|
||||
%macro addr_d_8bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageW8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageW16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8br 0
|
||||
mov al,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16br 0
|
||||
mov eax,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_8bw 0
|
||||
mov [xa],al
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16bw 0
|
||||
mov [xa],ax
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_8bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
xor bl,bl
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_8bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_8bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_8bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_8bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
792
zsnes/src/cpu/address2.inc
Normal file
792
zsnes/src/cpu/address2.inc
Normal file
@@ -0,0 +1,792 @@
|
||||
;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.
|
||||
|
||||
|
||||
EXTSYM DPageR8,DPageR16,DPageW8,DPageW16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8br 0
|
||||
mov al,[esi]
|
||||
inc esi
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16br 0
|
||||
mov eax,[esi]
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_8bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageW8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageW16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8br 0
|
||||
mov al,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16br 0
|
||||
mov eax,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_8bw 0
|
||||
mov [xa],al
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16bw 0
|
||||
mov [xa],ax
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_8bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
xor bl,bl
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_8bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16bw 0
|
||||
push ax
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_8bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageW8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xx]
|
||||
call dword near [DPageW16]
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16br 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_8bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call dword near [DPageW8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16bw 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
inc esi
|
||||
add cx,[xy]
|
||||
call dword near [DPageW16]
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add esi,2
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
inc esi
|
||||
push cx
|
||||
call dword near [DPageR16]
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call dword near [DPageR8]
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_8bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
pop ax
|
||||
add cx,[xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
409
zsnes/src/cpu/addrni.asm
Normal file
409
zsnes/src/cpu/addrni.asm
Normal file
@@ -0,0 +1,409 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8brni 0
|
||||
mov al,[esi]
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16brni 0
|
||||
mov ax,[esi]
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8brni 0
|
||||
mov al,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16brni 0
|
||||
mov ax,[xa]
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xy]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xy]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
|
||||
405
zsnes/src/cpu/addrni.inc
Normal file
405
zsnes/src/cpu/addrni.inc
Normal file
@@ -0,0 +1,405 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8brni 0
|
||||
mov al,[esi]
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16brni 0
|
||||
mov ax,[esi]
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8brni 0
|
||||
mov al,[xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16brni 0
|
||||
mov ax,[xa]
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xx]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xy]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16brni 0
|
||||
mov ecx,[xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[xy]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
call dword near [DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[xdb]
|
||||
add cx,[xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
|
||||
1355
zsnes/src/cpu/dma.asm
Normal file
1355
zsnes/src/cpu/dma.asm
Normal file
File diff suppressed because it is too large
Load Diff
3054
zsnes/src/cpu/dsp.asm
Normal file
3054
zsnes/src/cpu/dsp.asm
Normal file
File diff suppressed because it is too large
Load Diff
5698
zsnes/src/cpu/dspproc.asm
Normal file
5698
zsnes/src/cpu/dspproc.asm
Normal file
File diff suppressed because it is too large
Load Diff
1995
zsnes/src/cpu/e65816.inc
Normal file
1995
zsnes/src/cpu/e65816.inc
Normal file
File diff suppressed because it is too large
Load Diff
1987
zsnes/src/cpu/e65816b.inc
Normal file
1987
zsnes/src/cpu/e65816b.inc
Normal file
File diff suppressed because it is too large
Load Diff
1987
zsnes/src/cpu/e65816c.inc
Normal file
1987
zsnes/src/cpu/e65816c.inc
Normal file
File diff suppressed because it is too large
Load Diff
4374
zsnes/src/cpu/execute.asm
Normal file
4374
zsnes/src/cpu/execute.asm
Normal file
File diff suppressed because it is too large
Load Diff
524
zsnes/src/cpu/irq.asm
Normal file
524
zsnes/src/cpu/irq.asm
Normal file
@@ -0,0 +1,524 @@
|
||||
;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 flagnz,flago,flagc
|
||||
EXTSYM SfxSCMR,curnmi,execloop,initaddrl,nmiv,snesmap2
|
||||
EXTSYM snesmmap,stackand,stackor,wramdata
|
||||
EXTSYM xe,xirqb,xpb,xpc,xs
|
||||
EXTSYM irqon,irqv
|
||||
EXTSYM irqv8
|
||||
EXTSYM execloopdeb
|
||||
EXTSYM nmiv8
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; NMI Hardware 00FFFA,B 00FFEA,B 3 -> 000108
|
||||
; RES Hardware 00FFFC.D 00FFFC,D 1
|
||||
; BRK Software 00FFFE,F 00FFE6,7 N/A
|
||||
; IRQ Hardware 00FFFE,F 00FFEE,F 4 -> 00010C
|
||||
|
||||
|
||||
%macro makedl 0
|
||||
and dl,00111100b
|
||||
test dword[flagnz],18000h
|
||||
jz %%noneg
|
||||
or dl,80h
|
||||
%%noneg
|
||||
test dword[flagnz],0FFFFh
|
||||
jnz %%nozero
|
||||
or dl,02h
|
||||
%%nozero
|
||||
test dword[flagc],0FFh
|
||||
jz %%nocarry
|
||||
or dl,01h
|
||||
%%nocarry
|
||||
test dword[flago],0FFh
|
||||
jz %%nov
|
||||
or dl,40h
|
||||
%%nov
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; SwitchToNMI/VIRQ Calls NMI/VIRQ
|
||||
;*******************************************************
|
||||
NEWSYM switchtonmi
|
||||
mov byte[curnmi],1
|
||||
test byte[xe],1
|
||||
jne near NMIemulmode
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpb]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,byte[xirqb]
|
||||
mov [xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[nmiv]
|
||||
test byte[SfxSCMR],10h
|
||||
jz .nosfxnmi
|
||||
; mov ax,0108h
|
||||
.nosfxnmi
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
|
||||
NEWSYM NMIemulmode
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,[xpb]
|
||||
xor eax,eax
|
||||
mov ax,[nmiv8]
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
|
||||
NEWSYM switchtovirq
|
||||
mov byte[irqon],80h
|
||||
test byte[xe],1
|
||||
jne near IRQemulmode
|
||||
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpb]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,byte[xirqb]
|
||||
mov [xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[irqv]
|
||||
; test byte[SfxSCMR],10h
|
||||
; jz .nosfxnmi
|
||||
; mov ax,010Ch
|
||||
;.nosfxnmi
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
|
||||
NEWSYM switchtovirqret
|
||||
mov byte[irqon],80h
|
||||
test byte[xe],1
|
||||
jne near IRQemulmode
|
||||
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpb]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,byte[xirqb]
|
||||
mov [xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[irqv]
|
||||
; test byte[SfxSCMR],10h
|
||||
; jz .nosfxnmi
|
||||
; mov ax,010Ch
|
||||
;.nosfxnmi
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
ret
|
||||
|
||||
NEWSYM IRQemulmode
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,[xpb]
|
||||
xor eax,eax
|
||||
mov ax,[irqv8]
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloop
|
||||
|
||||
|
||||
NEWSYM switchtovirqdeb
|
||||
mov byte[irqon],80h
|
||||
test byte[xe],1
|
||||
jne near IRQemulmodedeb
|
||||
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpb]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,byte[xirqb]
|
||||
mov [xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[irqv]
|
||||
; test byte[SfxSCMR],10h
|
||||
; jz .nosfxnmi
|
||||
; mov ax,010Ch
|
||||
;.nosfxnmi
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
|
||||
NEWSYM IRQemulmodedeb
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,[xpb]
|
||||
xor eax,eax
|
||||
mov ax,[irqv8]
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
|
||||
NEWSYM switchtonmideb
|
||||
mov byte[curnmi],1
|
||||
test byte[xe],1
|
||||
jne near NMIemulmodedeb
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpb]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,byte[xirqb]
|
||||
mov [xpb],bl
|
||||
xor eax,eax
|
||||
mov ax,[nmiv]
|
||||
test byte[SfxSCMR],10h
|
||||
jz .nosfxnmi
|
||||
; mov ax,0108h
|
||||
.nosfxnmi
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
|
||||
NEWSYM NMIemulmodedeb
|
||||
mov ebx,esi
|
||||
sub ebx,[initaddrl]
|
||||
mov [xpc],bx
|
||||
|
||||
mov eax,[wramdata]
|
||||
mov bx,[xs]
|
||||
mov cl,[xpc+1]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov cl,[xpc]
|
||||
mov [eax+ebx],cl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
makedl
|
||||
mov [eax+ebx],dl
|
||||
dec bx
|
||||
and bx,word[stackand]
|
||||
or bx,word[stackor]
|
||||
mov [xs],bx
|
||||
xor bh,bh
|
||||
|
||||
mov bl,[xpb]
|
||||
xor eax,eax
|
||||
mov ax,[nmiv8]
|
||||
mov [xpc],ax
|
||||
and dl,11110011b
|
||||
or dl,00000100b
|
||||
test ax,8000h
|
||||
jz .loweraddr
|
||||
mov esi,[snesmmap+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
.loweraddr
|
||||
mov esi,[snesmap2+ebx*4]
|
||||
mov [initaddrl],esi
|
||||
add esi,eax
|
||||
jmp execloopdeb
|
||||
|
||||
|
||||
4406
zsnes/src/cpu/memory.asm
Normal file
4406
zsnes/src/cpu/memory.asm
Normal file
File diff suppressed because it is too large
Load Diff
1099
zsnes/src/cpu/regs.inc
Normal file
1099
zsnes/src/cpu/regs.inc
Normal file
File diff suppressed because it is too large
Load Diff
101
zsnes/src/cpu/regs.mac
Normal file
101
zsnes/src/cpu/regs.mac
Normal file
@@ -0,0 +1,101 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitReg Initializes Registers
|
||||
;*******************************************************
|
||||
|
||||
%macro setreg 2
|
||||
mov edi,%1
|
||||
add edi,[regptr]
|
||||
mov eax,%2
|
||||
mov [edi],eax
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Registers Note : Remember to restore AH, ECX, & DX
|
||||
;*******************************************************
|
||||
|
||||
%macro checkmultchange 0
|
||||
; execute multiplication
|
||||
cmp byte[multchange],0
|
||||
je .nomult
|
||||
push edx
|
||||
push eax
|
||||
xor bh,bh
|
||||
mov bl,[mode7B+1]
|
||||
mov ax,[mode7A]
|
||||
test bl,80h
|
||||
jz .noneg
|
||||
mov bh,0FFh
|
||||
.noneg
|
||||
imul bx
|
||||
mov [compmult],ax
|
||||
mov [compmult+2],dl
|
||||
pop eax
|
||||
pop edx
|
||||
mov byte[multchange],0
|
||||
.nomult
|
||||
%endmacro
|
||||
|
||||
%macro mouse4016doxA 2
|
||||
cmp byte[JoyAPos],%1
|
||||
jne .nx7
|
||||
mov bx,[mousexpos]
|
||||
shr bx,%2
|
||||
and bx,1
|
||||
mov al,bl
|
||||
.nx7
|
||||
%endmacro
|
||||
|
||||
%macro mouse4016doyA 2
|
||||
cmp byte[JoyAPos],%1
|
||||
jne .ny7
|
||||
mov bx,[mouseypos]
|
||||
shr bx,%2
|
||||
and bx,1
|
||||
mov al,bl
|
||||
.ny7
|
||||
%endmacro
|
||||
|
||||
%macro mouse4017dox 2
|
||||
cmp byte[JoyBPos],%1
|
||||
jne .nx7
|
||||
mov bx,[mousexpos]
|
||||
shr bx,%2
|
||||
and bx,1
|
||||
mov al,bl
|
||||
.nx7
|
||||
%endmacro
|
||||
|
||||
%macro mouse4017doy 2
|
||||
cmp byte[JoyBPos],%1
|
||||
jne .ny7
|
||||
mov bx,[mouseypos]
|
||||
shr bx,%2
|
||||
and bx,1
|
||||
mov al,bl
|
||||
.ny7
|
||||
%endmacro
|
||||
|
||||
1772
zsnes/src/cpu/regsw.inc
Normal file
1772
zsnes/src/cpu/regsw.inc
Normal file
File diff suppressed because it is too large
Load Diff
52
zsnes/src/cpu/regsw.mac
Normal file
52
zsnes/src/cpu/regsw.mac
Normal file
@@ -0,0 +1,52 @@
|
||||
;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.
|
||||
|
||||
|
||||
EXTSYM tableadc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitRegW Initializes Write Registers
|
||||
;*******************************************************
|
||||
|
||||
%macro reenablespc 0
|
||||
cmp dword[cycpbl],1000000h
|
||||
jb %%enspc
|
||||
mov dword[cycpbl],0
|
||||
test byte[curexecstate],02h
|
||||
jnz %%enspc
|
||||
or byte[curexecstate],02h
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,dl
|
||||
mov edi,[tableadc+ebx*4]
|
||||
pop ebx
|
||||
%%enspc
|
||||
%endmacro
|
||||
|
||||
%macro setregw 2
|
||||
mov edi,%1
|
||||
add edi,[regptw]
|
||||
mov eax,%2
|
||||
mov [edi],eax
|
||||
%endmacro
|
||||
|
||||
1574
zsnes/src/cpu/s65816d.inc
Normal file
1574
zsnes/src/cpu/s65816d.inc
Normal file
File diff suppressed because it is too large
Load Diff
812
zsnes/src/cpu/saddress.inc
Normal file
812
zsnes/src/cpu/saddress.inc
Normal file
@@ -0,0 +1,812 @@
|
||||
;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.
|
||||
|
||||
|
||||
EXTSYM SA1DPageR8,SA1DPageR16,SA1DPageW8,SA1DPageW16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8br 0
|
||||
mov al,[esi]
|
||||
inc esi
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16br 0
|
||||
mov eax,[esi]
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_8bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageW8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16bw 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageW16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8br 0
|
||||
mov al,[SA1xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16br 0
|
||||
mov eax,[SA1xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_8bw 0
|
||||
mov [SA1xa],al
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16bw 0
|
||||
mov [SA1xa],ax
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_8bw 0
|
||||
push ax
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16bw 0
|
||||
push ax
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
xor bl,bl
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
pop ax
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_8bw 0
|
||||
push ax
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16bw 0
|
||||
push ax
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_8bw 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16bw 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xx]
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xy]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16br 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xy]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_8bw 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xy]
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16bw 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
inc esi
|
||||
add cx,[SA1xy]
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add esi,2
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16br 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_8bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16bw 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add esi,3
|
||||
add cx,[SA1xx]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16br 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
inc esi
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
pop ax
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_8bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16bw 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0w16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16br 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_8bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16bw 0
|
||||
push ax
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
inc esi
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
pop ax
|
||||
add cx,[SA1xy]
|
||||
jnc .np
|
||||
inc bl
|
||||
.np
|
||||
call dword near [memtablew16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
404
zsnes/src/cpu/saddrni.inc
Normal file
404
zsnes/src/cpu/saddrni.inc
Normal file
@@ -0,0 +1,404 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Address Modes
|
||||
;*******************************************************
|
||||
|
||||
; 1. Immediate Addressing -- # - DONE IN PROGRAM
|
||||
|
||||
%macro addr_I_8brni 0
|
||||
mov al,[esi]
|
||||
%endmacro
|
||||
|
||||
%macro addr_I_16brni 0
|
||||
mov ax,[esi]
|
||||
%endmacro
|
||||
|
||||
; 2. Absolute -- a (TESTED)
|
||||
|
||||
%macro addr_a_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_a_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 3. Absolute Long -- al
|
||||
|
||||
%macro addr_al_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_al_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 4. Direct -- d (TESTED)
|
||||
|
||||
%macro addr_d_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR8]
|
||||
%endmacro
|
||||
|
||||
%macro addr_d_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR16]
|
||||
%endmacro
|
||||
|
||||
; 5. Accumulator -- A
|
||||
|
||||
%macro addr_A_8brni 0
|
||||
mov al,[SA1xa]
|
||||
%endmacro
|
||||
|
||||
%macro addr_A_16brni 0
|
||||
mov ax,[SA1xa]
|
||||
%endmacro
|
||||
|
||||
; 7. Direct Indirect Indexed -- (d),y
|
||||
|
||||
%macro addr_BdBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 8. Direct Indirect Indexed Long -- [d],y
|
||||
|
||||
%macro addr_LdLCy_8brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdLCy_16brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 9. Direct Indexed Indirect -- (d,x)
|
||||
|
||||
%macro addr_BdCxB_8brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCxB_16brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 10. Direct Indexed With X -- d,x
|
||||
|
||||
%macro addr_dCx_8brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xx]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCx_16brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xx]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 11. Direct Indexed With Y -- d,y
|
||||
|
||||
%macro addr_dCy_8brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xy]
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCy_16brni 0
|
||||
mov ecx,[SA1xd]
|
||||
mov bl,[esi]
|
||||
add cx,bx
|
||||
add cx,[SA1xy]
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 12. Absolute Indexed With X -- a,x
|
||||
|
||||
%macro addr_aCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 13. Absolute Indexed With Y -- a,y
|
||||
|
||||
%macro addr_aCy_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_aCy_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 14. Absolute Long Indexed With X -- al,x
|
||||
|
||||
%macro addr_alCx_8brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[SA1xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_alCx_16brni 0
|
||||
mov cx,[esi]
|
||||
mov bl,[esi+2]
|
||||
add cx,[SA1xx]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 18. Direct Indirect -- (d)
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; | 00 | (direct address) |
|
||||
; + | DB |
|
||||
; -------------------------------
|
||||
; Address: | effective address |
|
||||
|
||||
%macro addr_BdB_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdB_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
call dword near [SA1DPageR16]
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 19. Direct Indirect Long -- [d]
|
||||
; ___________________
|
||||
; Instruction: | opcode | offset |
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; | Direct Register |
|
||||
; + | offset |
|
||||
; ---------------------
|
||||
; | 00 | direct address |
|
||||
; then:
|
||||
; -------------------------------
|
||||
; Address: | (direct address) |
|
||||
|
||||
%macro addr_LdL_8brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_LdL_16brni 0
|
||||
mov bl,[esi]
|
||||
mov ecx,[SA1xd]
|
||||
add cx,bx
|
||||
push cx
|
||||
call membank0r16
|
||||
pop cx
|
||||
add cx,2
|
||||
push ax
|
||||
call membank0r8
|
||||
mov bl,al
|
||||
pop ax
|
||||
mov cx,ax
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
; 22. Stack Relative -- d,s
|
||||
|
||||
%macro addr_dCs_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
add cx,bx
|
||||
call membank0r8
|
||||
%endmacro
|
||||
|
||||
%macro addr_dCs_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
%endmacro
|
||||
|
||||
; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED)
|
||||
|
||||
%macro addr_BdCsBCy_8brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler8+ebx*4]
|
||||
%endmacro
|
||||
|
||||
%macro addr_BdCsBCy_16brni 0
|
||||
mov bl,[esi]
|
||||
mov cx,[SA1xs]
|
||||
add cx,bx
|
||||
call membank0r16
|
||||
mov cx,ax
|
||||
mov bl,[SA1xdb]
|
||||
add cx,[SA1xy]
|
||||
jnc .npb
|
||||
inc bl
|
||||
.npb
|
||||
call dword near [memtabler16+ebx*4]
|
||||
%endmacro
|
||||
|
||||
|
||||
1990
zsnes/src/cpu/se65816.inc
Normal file
1990
zsnes/src/cpu/se65816.inc
Normal file
File diff suppressed because it is too large
Load Diff
2695
zsnes/src/cpu/spc700.asm
Normal file
2695
zsnes/src/cpu/spc700.asm
Normal file
File diff suppressed because it is too large
Load Diff
97
zsnes/src/cpu/spcaddr.inc
Normal file
97
zsnes/src/cpu/spcaddr.inc
Normal file
@@ -0,0 +1,97 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; A,DP addressing mode
|
||||
%macro SPCaddr_DP 0
|
||||
mov bl,[ebp]
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
%macro SPCaddr_DP_X 0
|
||||
mov bl,[ebp]
|
||||
add bl,[spcX]
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
%macro SPCaddr_LABS 0
|
||||
mov bx,[ebp]
|
||||
add ebx,spcRam
|
||||
ReadByte
|
||||
add ebp,2
|
||||
%endmacro
|
||||
|
||||
%macro SPCaddr_LABS_X 0
|
||||
mov bl,[spcX]
|
||||
add bx,[ebp]
|
||||
add ebp,2
|
||||
add ebx,spcRam
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
; A,(X)
|
||||
%macro SPCaddr__X_ 0
|
||||
mov bl,[spcX]
|
||||
add ebx,[spcRamDP]
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
; A,labs+Y
|
||||
%macro SPCaddr_LABS_Y 0
|
||||
mov bl,[spcY]
|
||||
add bx,[ebp]
|
||||
add ebp,2
|
||||
add ebx,spcRam
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
; A,(DP,X)
|
||||
%macro SPCaddr_bDP_Xb 0
|
||||
mov bl,[ebp]
|
||||
add bl,[spcX]
|
||||
xor eax,eax
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
mov ax, word [ebx]
|
||||
mov ebx,eax
|
||||
add ebx,spcRam
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
%macro SPCaddr_bDPb_Y 0
|
||||
mov bl,[ebp]
|
||||
xor eax,eax
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
mov ax,[ebx]
|
||||
add ax,[spcY]
|
||||
mov ebx,eax
|
||||
add ebx,spcRam
|
||||
ReadByte
|
||||
%endmacro
|
||||
|
||||
168
zsnes/src/cpu/spcdef.inc
Normal file
168
zsnes/src/cpu/spcdef.inc
Normal file
@@ -0,0 +1,168 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; move al at address ebx
|
||||
|
||||
; branch instructions
|
||||
%macro spcbrancher 0
|
||||
inc ebp
|
||||
ret
|
||||
.branch
|
||||
movsx ebx,byte [ebp]
|
||||
inc ebp
|
||||
add ebp,ebx
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; tcall instruction
|
||||
%macro spctcall 1
|
||||
mov ebx,ebp
|
||||
sub ebx,spcRam
|
||||
mov eax,[spcS]
|
||||
mov [spcRam+eax],bh
|
||||
dec byte [spcS]
|
||||
mov eax,[spcS]
|
||||
mov [spcRam+eax],bl
|
||||
dec byte [spcS]
|
||||
mov bx,[spcextraram+%1]
|
||||
test byte[spcRam+0F1h],80h
|
||||
jnz %%finished
|
||||
mov bx,[spcRam+0FFC0h+%1]
|
||||
%%finished
|
||||
add ebx,spcRam
|
||||
mov ebp,ebx
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; SET1 instruction
|
||||
%macro set1 1
|
||||
mov bl,[ebp]
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
push ebx
|
||||
ReadByte
|
||||
pop ebx
|
||||
or al,%1
|
||||
WriteByte
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; CLR1 instruction
|
||||
%macro clr1 1
|
||||
mov bl,[ebp]
|
||||
add ebx,[spcRamDP]
|
||||
inc ebp
|
||||
push ebx
|
||||
ReadByte
|
||||
pop ebx
|
||||
and al,%1
|
||||
WriteByte
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; BBS instruction
|
||||
%macro bbs 1
|
||||
mov bl,[ebp]
|
||||
add ebx,[spcRamDP]
|
||||
ReadByte
|
||||
test al,%1
|
||||
jnz .dp0jump
|
||||
add ebp,2
|
||||
ret
|
||||
.dp0jump
|
||||
movsx ebx,byte [ebp+1]
|
||||
add ebp,ebx
|
||||
add ebp,2
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; BBC instruction
|
||||
%macro bbc 1
|
||||
mov bl,[ebp]
|
||||
add ebx,[spcRamDP]
|
||||
ReadByte
|
||||
test al,%1
|
||||
jz .dp0jump
|
||||
add ebp,2
|
||||
ret
|
||||
.dp0jump
|
||||
movsx ebx,byte [ebp+1]
|
||||
add ebp,ebx
|
||||
add ebp,2
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; OR A, instruction
|
||||
%macro SPC_OR_A 0
|
||||
or byte [spcA], al
|
||||
mov al,[spcA]
|
||||
mov [spcNZ],al
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; AND A, instruction
|
||||
%macro SPC_AND_A 0
|
||||
and byte [spcA], al
|
||||
mov al,[spcA]
|
||||
mov [spcNZ],al
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; EOR A, instruction
|
||||
%macro SPC_EOR_A 0
|
||||
xor byte [spcA], al
|
||||
mov al,[spcA]
|
||||
mov [spcNZ],al
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
; CMP A, instruction
|
||||
%macro SPC_CMP_A 0
|
||||
cmp byte [spcA], al
|
||||
cmc
|
||||
SPCSetFlagnzc
|
||||
%endmacro
|
||||
|
||||
%macro SPC_ADC_A 0
|
||||
mov cl,[spcP]
|
||||
shr cl,1
|
||||
adc byte [spcA], al
|
||||
SPCSetFlagnvhzc
|
||||
%endmacro
|
||||
|
||||
%macro SPC_SBC_A 0
|
||||
mov cl,[spcP]
|
||||
xor cl,1
|
||||
shr cl,1
|
||||
sbb byte [spcA], al
|
||||
cmc
|
||||
SPCSetFlagnvhzc
|
||||
%endmacro
|
||||
|
||||
%macro SPC_MOV_A 0
|
||||
mov byte [spcA], al
|
||||
mov [spcNZ],al
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
699
zsnes/src/cpu/stable.asm
Normal file
699
zsnes/src/cpu/stable.asm
Normal file
@@ -0,0 +1,699 @@
|
||||
;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 SA1tableA,SA1tableB,SA1tableC,SA1tableD,SA1tableE
|
||||
EXTSYM SA1tableF,SA1tableG,SA1tableH,SA1tablead
|
||||
EXTSYM cpucycle, SA1UpdateDPage, intrset
|
||||
|
||||
%include "cpu/s65816d.inc"
|
||||
%include "cpu/saddress.inc"
|
||||
%include "cpu/saddrni.inc"
|
||||
%include "cpu/se65816.inc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; global variables
|
||||
;tableA times 256 dd 0 ; Table addresses (M:0,X:0,D:0)
|
||||
;tableB times 256 dd 0 ; Table addresses (M:1,X:0,D:0)
|
||||
;tableC times 256 dd 0 ; Table addresses (M:0,X:1,D:0)
|
||||
;tableD times 256 dd 0 ; Table addresses (M:1,X:1,D:0)
|
||||
;tableE times 256 dd 0 ; Table addresses (M:0,X:0,D:1)
|
||||
;tableF times 256 dd 0 ; Table addresses (M:1,X:0,D:1)
|
||||
;tableG times 256 dd 0 ; Table addresses (M:0,X:1,D:1)
|
||||
;tableH times 256 dd 0 ; Table addresses (M:1,X:1,D:1)
|
||||
;tablead times 256 dd 0 ; Table address location according to P
|
||||
;memtabler8 times 256 dd 0 ; Memory Bank Locations for reading 8-bit
|
||||
;memtablew8 times 256 dd 0 ; Memory Bank Locations for writing 8-bit
|
||||
;memtabler16 times 256 dd 0 ; Memory Bank Locations for reading 16-bit
|
||||
;memtablew16 times 256 dd 0 ; Memory Bank Locations for reading 16-bit
|
||||
|
||||
;*******************************************************
|
||||
; Generate OpCode Table
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM SA1inittable
|
||||
; set tablead (NVMXDIZC) ( MXD )
|
||||
push es
|
||||
xor ecx,ecx
|
||||
xor al,al
|
||||
mov cx,256
|
||||
mov edi,SA1tablead
|
||||
.loopa
|
||||
test al,08h ; D flag
|
||||
jnz .decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon
|
||||
mov esi,SA1tableA
|
||||
jmp .done
|
||||
.mon
|
||||
mov esi,SA1tableB
|
||||
jmp .done
|
||||
|
||||
.xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon2
|
||||
mov esi,SA1tableC
|
||||
jmp .done
|
||||
.mon2
|
||||
mov esi,SA1tableD
|
||||
jmp .done
|
||||
|
||||
.decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon3
|
||||
test al,20h ; M flag
|
||||
jnz .mon3
|
||||
mov esi,SA1tableE
|
||||
jmp .done
|
||||
.mon3
|
||||
mov esi,SA1tableF
|
||||
jmp .done
|
||||
|
||||
.xon3
|
||||
test al,20h
|
||||
jnz .mon4
|
||||
mov esi,SA1tableG
|
||||
jmp .done
|
||||
.mon4
|
||||
mov esi,SA1tableH
|
||||
.done
|
||||
inc al
|
||||
push eax
|
||||
mov eax,esi
|
||||
stosd
|
||||
pop eax
|
||||
loop .loopa
|
||||
|
||||
; Set CPU addresses
|
||||
mov edi,SA1tableA
|
||||
call SA1settables
|
||||
mov edi,SA1tableB
|
||||
call SA1settables
|
||||
mov edi,SA1tableC
|
||||
call SA1settables
|
||||
mov edi,SA1tableD
|
||||
call SA1settables
|
||||
mov edi,SA1tableE
|
||||
call SA1settables
|
||||
mov edi,SA1tableF
|
||||
call SA1settables
|
||||
mov edi,SA1tableG
|
||||
call SA1settables
|
||||
mov edi,SA1tableH
|
||||
call SA1settables
|
||||
|
||||
; set proper functions
|
||||
mov edi,SA1tableA ; Table addresses (M:0,X:0,D:0)
|
||||
call SA1settablem16
|
||||
mov edi,SA1tableA
|
||||
call SA1settablex16
|
||||
|
||||
mov edi,SA1tableB ; Table addresses (M:1,X:0,D:0)
|
||||
call SA1settablex16
|
||||
|
||||
mov edi,SA1tableC ; Table addresses (M:0,X:1,D:0)
|
||||
call SA1settablem16
|
||||
|
||||
mov edi,SA1tableE ; Table addresses (M:0,X:0,D:1)
|
||||
call SA1settablem16
|
||||
mov edi,SA1tableE
|
||||
call SA1settableDm16
|
||||
mov edi,SA1tableE
|
||||
call SA1settablex16
|
||||
|
||||
mov edi,SA1tableF ; Table addresses (M:1,X:0,D:1)
|
||||
call SA1settablex16
|
||||
mov edi,SA1tableF
|
||||
call SA1settableDm8
|
||||
|
||||
mov edi,SA1tableG ; Table addresses (M:0,X:1,D:1)
|
||||
call SA1settablem16
|
||||
mov edi,SA1tableG
|
||||
call SA1settableDm16
|
||||
|
||||
mov edi,SA1tableH ; Table addresses (M:1,X:1,D:1)
|
||||
call SA1settableDm8
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; Set Tables Sets the opcode tables according to EDI
|
||||
;*******************************************************
|
||||
; This function sets all the non-multiple entries
|
||||
|
||||
NEWSYM SA1settables
|
||||
;row 0
|
||||
mov dword[edi+00h*4],SA1COp00
|
||||
mov dword[edi+01h*4],SA1COp01m8
|
||||
mov dword[edi+02h*4],SA1COp02
|
||||
mov dword[edi+03h*4],SA1COp03m8
|
||||
mov dword[edi+04h*4],SA1COp04m8
|
||||
mov dword[edi+05h*4],SA1COp05m8
|
||||
mov dword[edi+06h*4],SA1COp06m8
|
||||
mov dword[edi+07h*4],SA1COp07m8
|
||||
mov dword[edi+08h*4],SA1COp08
|
||||
mov dword[edi+09h*4],SA1COp09m8
|
||||
mov dword[edi+0Ah*4],SA1COp0Am8
|
||||
mov dword[edi+0Bh*4],SA1COp0B
|
||||
mov dword[edi+0Ch*4],SA1COp0Cm8
|
||||
mov dword[edi+0Dh*4],SA1COp0Dm8
|
||||
mov dword[edi+0Eh*4],SA1COp0Em8
|
||||
mov dword[edi+0Fh*4],SA1COp0Fm8
|
||||
mov dword[edi+10h*4],SA1COp10
|
||||
mov dword[edi+11h*4],SA1COp11m8
|
||||
mov dword[edi+12h*4],SA1COp12m8
|
||||
mov dword[edi+13h*4],SA1COp13m8
|
||||
mov dword[edi+14h*4],SA1COp14m8
|
||||
mov dword[edi+15h*4],SA1COp15m8
|
||||
mov dword[edi+16h*4],SA1COp16m8
|
||||
mov dword[edi+17h*4],SA1COp17m8
|
||||
mov dword[edi+18h*4],SA1COp18
|
||||
mov dword[edi+19h*4],SA1COp19m8
|
||||
mov dword[edi+1Ah*4],SA1COp1Am8
|
||||
mov dword[edi+1Bh*4],SA1COp1B
|
||||
mov dword[edi+1Ch*4],SA1COp1Cm8
|
||||
mov dword[edi+1Dh*4],SA1COp1Dm8
|
||||
mov dword[edi+1Eh*4],SA1COp1Em8
|
||||
mov dword[edi+1Fh*4],SA1COp1Fm8
|
||||
mov dword[edi+20h*4],SA1COp20
|
||||
mov dword[edi+21h*4],SA1COp21m8
|
||||
mov dword[edi+22h*4],SA1COp22
|
||||
mov dword[edi+23h*4],SA1COp23m8
|
||||
mov dword[edi+24h*4],SA1COp24m8
|
||||
mov dword[edi+25h*4],SA1COp25m8
|
||||
mov dword[edi+26h*4],SA1COp26m8
|
||||
mov dword[edi+27h*4],SA1COp27m8
|
||||
mov dword[edi+28h*4],SA1COp28
|
||||
mov dword[edi+29h*4],SA1COp29m8
|
||||
mov dword[edi+2Ah*4],SA1COp2Am8
|
||||
mov dword[edi+2Bh*4],SA1COp2B
|
||||
mov dword[edi+2Ch*4],SA1COp2Cm8
|
||||
mov dword[edi+2Dh*4],SA1COp2Dm8
|
||||
mov dword[edi+2Eh*4],SA1COp2Em8
|
||||
mov dword[edi+2Fh*4],SA1COp2Fm8
|
||||
mov dword[edi+30h*4],SA1COp30
|
||||
mov dword[edi+31h*4],SA1COp31m8
|
||||
mov dword[edi+32h*4],SA1COp32m8
|
||||
mov dword[edi+33h*4],SA1COp33m8
|
||||
mov dword[edi+34h*4],SA1COp34m8
|
||||
mov dword[edi+35h*4],SA1COp35m8
|
||||
mov dword[edi+36h*4],SA1COp36m8
|
||||
mov dword[edi+37h*4],SA1COp37m8
|
||||
mov dword[edi+38h*4],SA1COp38
|
||||
mov dword[edi+39h*4],SA1COp39m8
|
||||
mov dword[edi+3Ah*4],SA1COp3Am8
|
||||
mov dword[edi+3Bh*4],SA1COp3B
|
||||
mov dword[edi+3Ch*4],SA1COp3Cm8
|
||||
mov dword[edi+3Dh*4],SA1COp3Dm8
|
||||
mov dword[edi+3Eh*4],SA1COp3Em8
|
||||
mov dword[edi+3Fh*4],SA1COp3Fm8
|
||||
mov dword[edi+40h*4],SA1COp40
|
||||
mov dword[edi+41h*4],SA1COp41m8
|
||||
mov dword[edi+42h*4],SA1COp42
|
||||
mov dword[edi+43h*4],SA1COp43m8
|
||||
mov dword[edi+44h*4],SA1COp44
|
||||
mov dword[edi+45h*4],SA1COp45m8
|
||||
mov dword[edi+46h*4],SA1COp46m8
|
||||
mov dword[edi+47h*4],SA1COp47m8
|
||||
mov dword[edi+48h*4],SA1COp48m8
|
||||
mov dword[edi+49h*4],SA1COp49m8
|
||||
mov dword[edi+4Ah*4],SA1COp4Am8
|
||||
mov dword[edi+4Bh*4],SA1COp4B
|
||||
mov dword[edi+4Ch*4],SA1COp4C
|
||||
mov dword[edi+4Dh*4],SA1COp4Dm8
|
||||
mov dword[edi+4Eh*4],SA1COp4Em8
|
||||
mov dword[edi+4Fh*4],SA1COp4Fm8
|
||||
mov dword[edi+50h*4],SA1COp50
|
||||
mov dword[edi+51h*4],SA1COp51m8
|
||||
mov dword[edi+52h*4],SA1COp52m8
|
||||
mov dword[edi+53h*4],SA1COp53m8
|
||||
mov dword[edi+54h*4],SA1COp54
|
||||
mov dword[edi+55h*4],SA1COp55m8
|
||||
mov dword[edi+56h*4],SA1COp56m8
|
||||
mov dword[edi+57h*4],SA1COp57m8
|
||||
mov dword[edi+58h*4],SA1COp58
|
||||
mov dword[edi+59h*4],SA1COp59m8
|
||||
mov dword[edi+5Ah*4],SA1COp5Ax8
|
||||
mov dword[edi+5Bh*4],SA1COp5B
|
||||
mov dword[edi+5Ch*4],SA1COp5C
|
||||
mov dword[edi+5Dh*4],SA1COp5Dm8
|
||||
mov dword[edi+5Eh*4],SA1COp5Em8
|
||||
mov dword[edi+5Fh*4],SA1COp5Fm8
|
||||
mov dword[edi+60h*4],SA1COp60
|
||||
mov dword[edi+61h*4],SA1COp61m8nd
|
||||
mov dword[edi+62h*4],SA1COp62
|
||||
mov dword[edi+63h*4],SA1COp63m8nd
|
||||
mov dword[edi+64h*4],SA1COp64m8
|
||||
mov dword[edi+65h*4],SA1COp65m8nd
|
||||
mov dword[edi+66h*4],SA1COp66m8
|
||||
mov dword[edi+67h*4],SA1COp67m8nd
|
||||
mov dword[edi+68h*4],SA1COp68m8
|
||||
mov dword[edi+69h*4],SA1COp69m8nd
|
||||
mov dword[edi+6Ah*4],SA1COp6Am8
|
||||
mov dword[edi+6Bh*4],SA1COp6B
|
||||
mov dword[edi+6Ch*4],SA1COp6C
|
||||
mov dword[edi+6Dh*4],SA1COp6Dm8nd
|
||||
mov dword[edi+6Eh*4],SA1COp6Em8
|
||||
mov dword[edi+6Fh*4],SA1COp6Fm8nd
|
||||
mov dword[edi+70h*4],SA1COp70
|
||||
mov dword[edi+71h*4],SA1COp71m8nd
|
||||
mov dword[edi+72h*4],SA1COp72m8nd
|
||||
mov dword[edi+73h*4],SA1COp73m8nd
|
||||
mov dword[edi+74h*4],SA1COp74m8
|
||||
mov dword[edi+75h*4],SA1COp75m8nd
|
||||
mov dword[edi+76h*4],SA1COp76m8
|
||||
mov dword[edi+77h*4],SA1COp77m8nd
|
||||
mov dword[edi+78h*4],SA1COp78
|
||||
mov dword[edi+79h*4],SA1COp79m8nd
|
||||
mov dword[edi+7Ah*4],SA1COp7Ax8
|
||||
mov dword[edi+7Bh*4],SA1COp7B
|
||||
mov dword[edi+7Ch*4],SA1COp7C
|
||||
mov dword[edi+7Dh*4],SA1COp7Dm8nd
|
||||
mov dword[edi+7Eh*4],SA1COp7Em8
|
||||
mov dword[edi+7Fh*4],SA1COp7Fm8nd
|
||||
mov dword[edi+80h*4],SA1COp80
|
||||
mov dword[edi+81h*4],SA1COp81m8
|
||||
mov dword[edi+82h*4],SA1COp82
|
||||
mov dword[edi+83h*4],SA1COp83m8
|
||||
mov dword[edi+84h*4],SA1COp84x8
|
||||
mov dword[edi+85h*4],SA1COp85m8
|
||||
mov dword[edi+86h*4],SA1COp86x8
|
||||
mov dword[edi+87h*4],SA1COp87m8
|
||||
mov dword[edi+88h*4],SA1COp88x8
|
||||
mov dword[edi+89h*4],SA1COp89m8
|
||||
mov dword[edi+8Ah*4],SA1COp8Am8
|
||||
mov dword[edi+8Bh*4],SA1COp8B
|
||||
mov dword[edi+8Ch*4],SA1COp8Cx8
|
||||
mov dword[edi+8Dh*4],SA1COp8Dm8
|
||||
mov dword[edi+8Eh*4],SA1COp8Ex8
|
||||
mov dword[edi+8Fh*4],SA1COp8Fm8
|
||||
mov dword[edi+90h*4],SA1COp90
|
||||
mov dword[edi+91h*4],SA1COp91m8
|
||||
mov dword[edi+92h*4],SA1COp92m8
|
||||
mov dword[edi+93h*4],SA1COp93m8
|
||||
mov dword[edi+94h*4],SA1COp94x8
|
||||
mov dword[edi+95h*4],SA1COp95m8
|
||||
mov dword[edi+96h*4],SA1COp96x8
|
||||
mov dword[edi+97h*4],SA1COp97m8
|
||||
mov dword[edi+98h*4],SA1COp98m8
|
||||
mov dword[edi+99h*4],SA1COp99m8
|
||||
mov dword[edi+9Ah*4],SA1COp9A
|
||||
mov dword[edi+9Bh*4],SA1COp9Bx8
|
||||
mov dword[edi+9Ch*4],SA1COp9Cm8
|
||||
mov dword[edi+9Dh*4],SA1COp9Dm8
|
||||
mov dword[edi+9Eh*4],SA1COp9Em8
|
||||
mov dword[edi+9Fh*4],SA1COp9Fm8
|
||||
mov dword[edi+0A0h*4],SA1COpA0x8
|
||||
mov dword[edi+0A1h*4],SA1COpA1m8
|
||||
mov dword[edi+0A2h*4],SA1COpA2x8
|
||||
mov dword[edi+0A3h*4],SA1COpA3m8
|
||||
mov dword[edi+0A4h*4],SA1COpA4x8
|
||||
mov dword[edi+0A5h*4],SA1COpA5m8
|
||||
mov dword[edi+0A6h*4],SA1COpA6x8
|
||||
mov dword[edi+0A7h*4],SA1COpA7m8
|
||||
mov dword[edi+0A8h*4],SA1COpA8x8
|
||||
mov dword[edi+0A9h*4],SA1COpA9m8
|
||||
mov dword[edi+0AAh*4],SA1COpAAx8
|
||||
mov dword[edi+0ABh*4],SA1COpAB
|
||||
mov dword[edi+0ACh*4],SA1COpACx8
|
||||
mov dword[edi+0ADh*4],SA1COpADm8
|
||||
mov dword[edi+0AEh*4],SA1COpAEx8
|
||||
mov dword[edi+0AFh*4],SA1COpAFm8
|
||||
mov dword[edi+0B0h*4],SA1COpB0
|
||||
mov dword[edi+0B1h*4],SA1COpB1m8
|
||||
mov dword[edi+0B2h*4],SA1COpB2m8
|
||||
mov dword[edi+0B3h*4],SA1COpB3m8
|
||||
mov dword[edi+0B4h*4],SA1COpB4x8
|
||||
mov dword[edi+0B5h*4],SA1COpB5m8
|
||||
mov dword[edi+0B6h*4],SA1COpB6x8
|
||||
mov dword[edi+0B7h*4],SA1COpB7m8
|
||||
mov dword[edi+0B8h*4],SA1COpB8
|
||||
mov dword[edi+0B9h*4],SA1COpB9m8
|
||||
mov dword[edi+0BAh*4],SA1COpBAx8
|
||||
mov dword[edi+0BBh*4],SA1COpBBx8
|
||||
mov dword[edi+0BCh*4],SA1COpBCx8
|
||||
mov dword[edi+0BDh*4],SA1COpBDm8
|
||||
mov dword[edi+0BEh*4],SA1COpBEx8
|
||||
mov dword[edi+0BFh*4],SA1COpBFm8
|
||||
mov dword[edi+0C0h*4],SA1COpC0x8
|
||||
mov dword[edi+0C1h*4],SA1COpC1m8
|
||||
mov dword[edi+0C2h*4],SA1COpC2
|
||||
mov dword[edi+0C3h*4],SA1COpC3m8
|
||||
mov dword[edi+0C4h*4],SA1COpC4x8
|
||||
mov dword[edi+0C5h*4],SA1COpC5m8
|
||||
mov dword[edi+0C6h*4],SA1COpC6m8
|
||||
mov dword[edi+0C7h*4],SA1COpC7m8
|
||||
mov dword[edi+0C8h*4],SA1COpC8x8
|
||||
mov dword[edi+0C9h*4],SA1COpC9m8
|
||||
mov dword[edi+0CAh*4],SA1COpCAx8
|
||||
mov dword[edi+0CBh*4],SA1COpCB
|
||||
mov dword[edi+0CCh*4],SA1COpCCx8
|
||||
mov dword[edi+0CDh*4],SA1COpCDm8
|
||||
mov dword[edi+0CEh*4],SA1COpCEm8
|
||||
mov dword[edi+0CFh*4],SA1COpCFm8
|
||||
mov dword[edi+0D0h*4],SA1COpD0
|
||||
mov dword[edi+0D1h*4],SA1COpD1m8
|
||||
mov dword[edi+0D2h*4],SA1COpD2m8
|
||||
mov dword[edi+0D3h*4],SA1COpD3m8
|
||||
mov dword[edi+0D4h*4],SA1COpD4
|
||||
mov dword[edi+0D5h*4],SA1COpD5m8
|
||||
mov dword[edi+0D6h*4],SA1COpD6m8
|
||||
mov dword[edi+0D7h*4],SA1COpD7m8
|
||||
mov dword[edi+0D8h*4],SA1COpD8
|
||||
mov dword[edi+0D9h*4],SA1COpD9m8
|
||||
mov dword[edi+0DAh*4],SA1COpDAx8
|
||||
mov dword[edi+0DBh*4],SA1COpDB
|
||||
mov dword[edi+0DCh*4],SA1COpDC
|
||||
mov dword[edi+0DDh*4],SA1COpDDm8
|
||||
mov dword[edi+0DEh*4],SA1COpDEm8
|
||||
mov dword[edi+0DFh*4],SA1COpDFm8
|
||||
mov dword[edi+0E0h*4],SA1COpE0x8
|
||||
mov dword[edi+0E1h*4],SA1COpE1m8nd
|
||||
mov dword[edi+0E2h*4],SA1COpE2
|
||||
mov dword[edi+0E3h*4],SA1COpE3m8nd
|
||||
mov dword[edi+0E4h*4],SA1COpE4x8
|
||||
mov dword[edi+0E5h*4],SA1COpE5m8nd
|
||||
mov dword[edi+0E6h*4],SA1COpE6m8
|
||||
mov dword[edi+0E7h*4],SA1COpE7m8nd
|
||||
mov dword[edi+0E8h*4],SA1COpE8x8
|
||||
mov dword[edi+0E9h*4],SA1COpE9m8nd
|
||||
mov dword[edi+0EAh*4],SA1COpEA
|
||||
mov dword[edi+0EBh*4],SA1COpEB
|
||||
mov dword[edi+0ECh*4],SA1COpECx8
|
||||
mov dword[edi+0EDh*4],SA1COpEDm8nd
|
||||
mov dword[edi+0EEh*4],SA1COpEEm8
|
||||
mov dword[edi+0EFh*4],SA1COpEFm8nd
|
||||
mov dword[edi+0F0h*4],SA1COpF0
|
||||
mov dword[edi+0F1h*4],SA1COpF1m8nd
|
||||
mov dword[edi+0F2h*4],SA1COpF2m8nd
|
||||
mov dword[edi+0F3h*4],SA1COpF3m8nd
|
||||
mov dword[edi+0F4h*4],SA1COpF4
|
||||
mov dword[edi+0F5h*4],SA1COpF5m8nd
|
||||
mov dword[edi+0F6h*4],SA1COpF6m8
|
||||
mov dword[edi+0F7h*4],SA1COpF7m8nd
|
||||
mov dword[edi+0F8h*4],SA1COpF8
|
||||
mov dword[edi+0F9h*4],SA1COpF9m8nd
|
||||
mov dword[edi+0FAh*4],SA1COpFAx8
|
||||
mov dword[edi+0FBh*4],SA1COpFB
|
||||
mov dword[edi+0FCh*4],SA1COpFC
|
||||
mov dword[edi+0FDh*4],SA1COpFDm8nd
|
||||
mov dword[edi+0FEh*4],SA1COpFEm8
|
||||
mov dword[edi+0FFh*4],SA1COpFFm8nd
|
||||
ret
|
||||
|
||||
NEWSYM SA1settablem16
|
||||
mov dword[edi+01h*4],SA1COp01m16
|
||||
mov dword[edi+03h*4],SA1COp03m16
|
||||
mov dword[edi+04h*4],SA1COp04m16
|
||||
mov dword[edi+05h*4],SA1COp05m16
|
||||
mov dword[edi+06h*4],SA1COp06m16
|
||||
mov dword[edi+07h*4],SA1COp07m16
|
||||
mov dword[edi+09h*4],SA1COp09m16
|
||||
mov dword[edi+0Ah*4],SA1COp0Am16
|
||||
mov dword[edi+0Ch*4],SA1COp0Cm16
|
||||
mov dword[edi+0Dh*4],SA1COp0Dm16
|
||||
mov dword[edi+0Eh*4],SA1COp0Em16
|
||||
mov dword[edi+0Fh*4],SA1COp0Fm16
|
||||
mov dword[edi+11h*4],SA1COp11m16
|
||||
mov dword[edi+12h*4],SA1COp12m16
|
||||
mov dword[edi+13h*4],SA1COp13m16
|
||||
mov dword[edi+14h*4],SA1COp14m16
|
||||
mov dword[edi+15h*4],SA1COp15m16
|
||||
mov dword[edi+16h*4],SA1COp16m16
|
||||
mov dword[edi+17h*4],SA1COp17m16
|
||||
mov dword[edi+19h*4],SA1COp19m16
|
||||
mov dword[edi+1Ah*4],SA1COp1Am16
|
||||
mov dword[edi+1Ch*4],SA1COp1Cm16
|
||||
mov dword[edi+1Dh*4],SA1COp1Dm16
|
||||
mov dword[edi+1Eh*4],SA1COp1Em16
|
||||
mov dword[edi+1Fh*4],SA1COp1Fm16
|
||||
mov dword[edi+21h*4],SA1COp21m16
|
||||
mov dword[edi+23h*4],SA1COp23m16
|
||||
mov dword[edi+24h*4],SA1COp24m16
|
||||
mov dword[edi+25h*4],SA1COp25m16
|
||||
mov dword[edi+26h*4],SA1COp26m16
|
||||
mov dword[edi+27h*4],SA1COp27m16
|
||||
mov dword[edi+29h*4],SA1COp29m16
|
||||
mov dword[edi+2Ah*4],SA1COp2Am16
|
||||
mov dword[edi+2Ch*4],SA1COp2Cm16
|
||||
mov dword[edi+2Dh*4],SA1COp2Dm16
|
||||
mov dword[edi+2Eh*4],SA1COp2Em16
|
||||
mov dword[edi+2Fh*4],SA1COp2Fm16
|
||||
mov dword[edi+31h*4],SA1COp31m16
|
||||
mov dword[edi+32h*4],SA1COp32m16
|
||||
mov dword[edi+33h*4],SA1COp33m16
|
||||
mov dword[edi+34h*4],SA1COp34m16
|
||||
mov dword[edi+35h*4],SA1COp35m16
|
||||
mov dword[edi+36h*4],SA1COp36m16
|
||||
mov dword[edi+37h*4],SA1COp37m16
|
||||
mov dword[edi+39h*4],SA1COp39m16
|
||||
mov dword[edi+3Ah*4],SA1COp3Am16
|
||||
mov dword[edi+3Ch*4],SA1COp3Cm16
|
||||
mov dword[edi+3Dh*4],SA1COp3Dm16
|
||||
mov dword[edi+3Eh*4],SA1COp3Em16
|
||||
mov dword[edi+3Fh*4],SA1COp3Fm16
|
||||
mov dword[edi+41h*4],SA1COp41m16
|
||||
mov dword[edi+43h*4],SA1COp43m16
|
||||
mov dword[edi+45h*4],SA1COp45m16
|
||||
mov dword[edi+46h*4],SA1COp46m16
|
||||
mov dword[edi+47h*4],SA1COp47m16
|
||||
mov dword[edi+48h*4],SA1COp48m16
|
||||
mov dword[edi+49h*4],SA1COp49m16
|
||||
mov dword[edi+4Ah*4],SA1COp4Am16
|
||||
mov dword[edi+4Dh*4],SA1COp4Dm16
|
||||
mov dword[edi+4Eh*4],SA1COp4Em16
|
||||
mov dword[edi+4Fh*4],SA1COp4Fm16
|
||||
mov dword[edi+51h*4],SA1COp51m16
|
||||
mov dword[edi+52h*4],SA1COp52m16
|
||||
mov dword[edi+53h*4],SA1COp53m16
|
||||
mov dword[edi+55h*4],SA1COp55m16
|
||||
mov dword[edi+56h*4],SA1COp56m16
|
||||
mov dword[edi+57h*4],SA1COp57m16
|
||||
mov dword[edi+59h*4],SA1COp59m16
|
||||
mov dword[edi+5Dh*4],SA1COp5Dm16
|
||||
mov dword[edi+5Eh*4],SA1COp5Em16
|
||||
mov dword[edi+5Fh*4],SA1COp5Fm16
|
||||
mov dword[edi+61h*4],SA1COp61m16nd
|
||||
mov dword[edi+63h*4],SA1COp63m16nd
|
||||
mov dword[edi+64h*4],SA1COp64m16
|
||||
mov dword[edi+65h*4],SA1COp65m16nd
|
||||
mov dword[edi+66h*4],SA1COp66m16
|
||||
mov dword[edi+67h*4],SA1COp67m16nd
|
||||
mov dword[edi+68h*4],SA1COp68m16
|
||||
mov dword[edi+69h*4],SA1COp69m16nd
|
||||
mov dword[edi+6Ah*4],SA1COp6Am16
|
||||
mov dword[edi+6Dh*4],SA1COp6Dm16nd
|
||||
mov dword[edi+6Eh*4],SA1COp6Em16
|
||||
mov dword[edi+6Fh*4],SA1COp6Fm16nd
|
||||
mov dword[edi+71h*4],SA1COp71m16nd
|
||||
mov dword[edi+72h*4],SA1COp72m16nd
|
||||
mov dword[edi+73h*4],SA1COp73m16nd
|
||||
mov dword[edi+74h*4],SA1COp74m16
|
||||
mov dword[edi+75h*4],SA1COp75m16nd
|
||||
mov dword[edi+76h*4],SA1COp76m16
|
||||
mov dword[edi+77h*4],SA1COp77m16nd
|
||||
mov dword[edi+79h*4],SA1COp79m16nd
|
||||
mov dword[edi+7Dh*4],SA1COp7Dm16nd
|
||||
mov dword[edi+7Eh*4],SA1COp7Em16
|
||||
mov dword[edi+7Fh*4],SA1COp7Fm16nd
|
||||
mov dword[edi+81h*4],SA1COp81m16
|
||||
mov dword[edi+83h*4],SA1COp83m16
|
||||
mov dword[edi+85h*4],SA1COp85m16
|
||||
mov dword[edi+87h*4],SA1COp87m16
|
||||
mov dword[edi+89h*4],SA1COp89m16
|
||||
mov dword[edi+8Ah*4],SA1COp8Am16
|
||||
mov dword[edi+8Dh*4],SA1COp8Dm16
|
||||
mov dword[edi+8Fh*4],SA1COp8Fm16
|
||||
mov dword[edi+91h*4],SA1COp91m16
|
||||
mov dword[edi+92h*4],SA1COp92m16
|
||||
mov dword[edi+93h*4],SA1COp93m16
|
||||
mov dword[edi+95h*4],SA1COp95m16
|
||||
mov dword[edi+97h*4],SA1COp97m16
|
||||
mov dword[edi+98h*4],SA1COp98m16
|
||||
mov dword[edi+99h*4],SA1COp99m16
|
||||
mov dword[edi+9Ch*4],SA1COp9Cm16
|
||||
mov dword[edi+9Dh*4],SA1COp9Dm16
|
||||
mov dword[edi+9Eh*4],SA1COp9Em16
|
||||
mov dword[edi+9Fh*4],SA1COp9Fm16
|
||||
mov dword[edi+0A1h*4],SA1COpA1m16
|
||||
mov dword[edi+0A3h*4],SA1COpA3m16
|
||||
mov dword[edi+0A5h*4],SA1COpA5m16
|
||||
mov dword[edi+0A7h*4],SA1COpA7m16
|
||||
mov dword[edi+0A9h*4],SA1COpA9m16
|
||||
mov dword[edi+0ADh*4],SA1COpADm16
|
||||
mov dword[edi+0AFh*4],SA1COpAFm16
|
||||
mov dword[edi+0B1h*4],SA1COpB1m16
|
||||
mov dword[edi+0B2h*4],SA1COpB2m16
|
||||
mov dword[edi+0B3h*4],SA1COpB3m16
|
||||
mov dword[edi+0B5h*4],SA1COpB5m16
|
||||
mov dword[edi+0B7h*4],SA1COpB7m16
|
||||
mov dword[edi+0B9h*4],SA1COpB9m16
|
||||
mov dword[edi+0BDh*4],SA1COpBDm16
|
||||
mov dword[edi+0BFh*4],SA1COpBFm16
|
||||
mov dword[edi+0C1h*4],SA1COpC1m16
|
||||
mov dword[edi+0C3h*4],SA1COpC3m16
|
||||
mov dword[edi+0C5h*4],SA1COpC5m16
|
||||
mov dword[edi+0C6h*4],SA1COpC6m16
|
||||
mov dword[edi+0C7h*4],SA1COpC7m16
|
||||
mov dword[edi+0C9h*4],SA1COpC9m16
|
||||
mov dword[edi+0CDh*4],SA1COpCDm16
|
||||
mov dword[edi+0CEh*4],SA1COpCEm16
|
||||
mov dword[edi+0CFh*4],SA1COpCFm16
|
||||
mov dword[edi+0D1h*4],SA1COpD1m16
|
||||
mov dword[edi+0D2h*4],SA1COpD2m16
|
||||
mov dword[edi+0D3h*4],SA1COpD3m16
|
||||
mov dword[edi+0D5h*4],SA1COpD5m16
|
||||
mov dword[edi+0D6h*4],SA1COpD6m16
|
||||
mov dword[edi+0D7h*4],SA1COpD7m16
|
||||
mov dword[edi+0D9h*4],SA1COpD9m16
|
||||
mov dword[edi+0DDh*4],SA1COpDDm16
|
||||
mov dword[edi+0DEh*4],SA1COpDEm16
|
||||
mov dword[edi+0DFh*4],SA1COpDFm16
|
||||
mov dword[edi+0E1h*4],SA1COpE1m16nd
|
||||
mov dword[edi+0E3h*4],SA1COpE3m16nd
|
||||
mov dword[edi+0E5h*4],SA1COpE5m16nd
|
||||
mov dword[edi+0E6h*4],SA1COpE6m16
|
||||
mov dword[edi+0E7h*4],SA1COpE7m16nd
|
||||
mov dword[edi+0E9h*4],SA1COpE9m16nd
|
||||
mov dword[edi+0EDh*4],SA1COpEDm16nd
|
||||
mov dword[edi+0EEh*4],SA1COpEEm16
|
||||
mov dword[edi+0EFh*4],SA1COpEFm16nd
|
||||
mov dword[edi+0F1h*4],SA1COpF1m16nd
|
||||
mov dword[edi+0F2h*4],SA1COpF2m16nd
|
||||
mov dword[edi+0F3h*4],SA1COpF3m16nd
|
||||
mov dword[edi+0F5h*4],SA1COpF5m16nd
|
||||
mov dword[edi+0F6h*4],SA1COpF6m16
|
||||
mov dword[edi+0F7h*4],SA1COpF7m16nd
|
||||
mov dword[edi+0F9h*4],SA1COpF9m16nd
|
||||
mov dword[edi+0FDh*4],SA1COpFDm16nd
|
||||
mov dword[edi+0FEh*4],SA1COpFEm16
|
||||
mov dword[edi+0FFh*4],SA1COpFFm16nd
|
||||
ret
|
||||
|
||||
NEWSYM SA1settablex16
|
||||
mov dword[edi+5Ah*4],SA1COp5Ax16
|
||||
mov dword[edi+7Ah*4],SA1COp7Ax16
|
||||
mov dword[edi+84h*4],SA1COp84x16
|
||||
mov dword[edi+86h*4],SA1COp86x16
|
||||
mov dword[edi+88h*4],SA1COp88x16
|
||||
mov dword[edi+8Ch*4],SA1COp8Cx16
|
||||
mov dword[edi+8Eh*4],SA1COp8Ex16
|
||||
mov dword[edi+94h*4],SA1COp94x16
|
||||
mov dword[edi+96h*4],SA1COp96x16
|
||||
mov dword[edi+9Bh*4],SA1COp9Bx16
|
||||
mov dword[edi+0A0h*4],SA1COpA0x16
|
||||
mov dword[edi+0A2h*4],SA1COpA2x16
|
||||
mov dword[edi+0A4h*4],SA1COpA4x16
|
||||
mov dword[edi+0A6h*4],SA1COpA6x16
|
||||
mov dword[edi+0A8h*4],SA1COpA8x16
|
||||
mov dword[edi+0AAh*4],SA1COpAAx16
|
||||
mov dword[edi+0ACh*4],SA1COpACx16
|
||||
mov dword[edi+0AEh*4],SA1COpAEx16
|
||||
mov dword[edi+0B4h*4],SA1COpB4x16
|
||||
mov dword[edi+0B6h*4],SA1COpB6x16
|
||||
mov dword[edi+0BAh*4],SA1COpBAx16
|
||||
mov dword[edi+0BBh*4],SA1COpBBx16
|
||||
mov dword[edi+0BCh*4],SA1COpBCx16
|
||||
mov dword[edi+0BEh*4],SA1COpBEx16
|
||||
mov dword[edi+0C0h*4],SA1COpC0x16
|
||||
mov dword[edi+0C4h*4],SA1COpC4x16
|
||||
mov dword[edi+0C8h*4],SA1COpC8x16
|
||||
mov dword[edi+0CAh*4],SA1COpCAx16
|
||||
mov dword[edi+0CCh*4],SA1COpCCx16
|
||||
mov dword[edi+0DAh*4],SA1COpDAx16
|
||||
mov dword[edi+0E0h*4],SA1COpE0x16
|
||||
mov dword[edi+0E4h*4],SA1COpE4x16
|
||||
mov dword[edi+0E8h*4],SA1COpE8x16
|
||||
mov dword[edi+0ECh*4],SA1COpECx16
|
||||
mov dword[edi+0FAh*4],SA1COpFAx16
|
||||
ret
|
||||
|
||||
NEWSYM SA1settableDm8
|
||||
mov dword[edi+61h*4],SA1COp61m8d
|
||||
mov dword[edi+63h*4],SA1COp63m8d
|
||||
mov dword[edi+65h*4],SA1COp65m8d
|
||||
mov dword[edi+67h*4],SA1COp67m8d
|
||||
mov dword[edi+69h*4],SA1COp69m8d
|
||||
mov dword[edi+6Dh*4],SA1COp6Dm8d
|
||||
mov dword[edi+6Fh*4],SA1COp6Fm8d
|
||||
mov dword[edi+71h*4],SA1COp71m8d
|
||||
mov dword[edi+72h*4],SA1COp72m8d
|
||||
mov dword[edi+73h*4],SA1COp73m8d
|
||||
mov dword[edi+75h*4],SA1COp75m8d
|
||||
mov dword[edi+77h*4],SA1COp77m8d
|
||||
mov dword[edi+79h*4],SA1COp79m8d
|
||||
mov dword[edi+7Dh*4],SA1COp7Dm8d
|
||||
mov dword[edi+7Fh*4],SA1COp7Fm8d
|
||||
mov dword[edi+0E1h*4],SA1COpE1m8d
|
||||
mov dword[edi+0E3h*4],SA1COpE3m8d
|
||||
mov dword[edi+0E5h*4],SA1COpE5m8d
|
||||
mov dword[edi+0E7h*4],SA1COpE7m8d
|
||||
mov dword[edi+0E9h*4],SA1COpE9m8d
|
||||
mov dword[edi+0EDh*4],SA1COpEDm8d
|
||||
mov dword[edi+0EFh*4],SA1COpEFm8d
|
||||
mov dword[edi+0F1h*4],SA1COpF1m8d
|
||||
mov dword[edi+0F2h*4],SA1COpF2m8d
|
||||
mov dword[edi+0F3h*4],SA1COpF3m8d
|
||||
mov dword[edi+0F5h*4],SA1COpF5m8d
|
||||
mov dword[edi+0F7h*4],SA1COpF7m8d
|
||||
mov dword[edi+0F9h*4],SA1COpF9m8d
|
||||
mov dword[edi+0FDh*4],SA1COpFDm8d
|
||||
mov dword[edi+0FFh*4],SA1COpFFm8d
|
||||
ret
|
||||
|
||||
NEWSYM SA1settableDm16
|
||||
mov dword[edi+61h*4],SA1COp61m16d
|
||||
mov dword[edi+63h*4],SA1COp63m16d
|
||||
mov dword[edi+65h*4],SA1COp65m16d
|
||||
mov dword[edi+67h*4],SA1COp67m16d
|
||||
mov dword[edi+69h*4],SA1COp69m16d
|
||||
mov dword[edi+6Dh*4],SA1COp6Dm16d
|
||||
mov dword[edi+6Fh*4],SA1COp6Fm16d
|
||||
mov dword[edi+71h*4],SA1COp71m16d
|
||||
mov dword[edi+72h*4],SA1COp72m16d
|
||||
mov dword[edi+73h*4],SA1COp73m16d
|
||||
mov dword[edi+75h*4],SA1COp75m16d
|
||||
mov dword[edi+77h*4],SA1COp77m16d
|
||||
mov dword[edi+79h*4],SA1COp79m16d
|
||||
mov dword[edi+7Dh*4],SA1COp7Dm16d
|
||||
mov dword[edi+7Fh*4],SA1COp7Fm16d
|
||||
mov dword[edi+0E1h*4],SA1COpE1m16d
|
||||
mov dword[edi+0E3h*4],SA1COpE3m16d
|
||||
mov dword[edi+0E5h*4],SA1COpE5m16d
|
||||
mov dword[edi+0E7h*4],SA1COpE7m16d
|
||||
mov dword[edi+0E9h*4],SA1COpE9m16d
|
||||
mov dword[edi+0EDh*4],SA1COpEDm16d
|
||||
mov dword[edi+0EFh*4],SA1COpEFm16d
|
||||
mov dword[edi+0F1h*4],SA1COpF1m16d
|
||||
mov dword[edi+0F2h*4],SA1COpF2m16d
|
||||
mov dword[edi+0F3h*4],SA1COpF3m16d
|
||||
mov dword[edi+0F5h*4],SA1COpF5m16d
|
||||
mov dword[edi+0F7h*4],SA1COpF7m16d
|
||||
mov dword[edi+0F9h*4],SA1COpF9m16d
|
||||
mov dword[edi+0FDh*4],SA1COpFDm16d
|
||||
mov dword[edi+0FFh*4],SA1COpFFm16d
|
||||
ret
|
||||
|
||||
|
||||
1191
zsnes/src/cpu/table.asm
Normal file
1191
zsnes/src/cpu/table.asm
Normal file
File diff suppressed because it is too large
Load Diff
723
zsnes/src/cpu/tableb.asm
Normal file
723
zsnes/src/cpu/tableb.asm
Normal file
@@ -0,0 +1,723 @@
|
||||
;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 eramaccessbankr16,eramaccessbankr8,eramaccessbankw16
|
||||
EXTSYM eramaccessbankw8,memaccessbankr16,memaccessbankr8
|
||||
EXTSYM memaccessbankw16,memaccessbankw8
|
||||
EXTSYM mosjmptab,mosdraw10,mosdraw11,mosdraw12,mosdraw13
|
||||
EXTSYM mosdraw14,mosdraw15,mosdraw16,mosdraw2,mosdraw3
|
||||
EXTSYM mosdraw4,mosdraw5,mosdraw6,mosdraw7,mosdraw8
|
||||
EXTSYM mosdraw9,ngpalcon2b,ngpalcon4b
|
||||
EXTSYM regaccessbankr16,regaccessbankw16,regaccessbankw8
|
||||
EXTSYM sramaccessbankr16,sramaccessbankr8,sramaccessbankw16
|
||||
EXTSYM sramaccessbankw8,tableAb,tableBb,tableCb,tableDb,tableEb
|
||||
EXTSYM tableFb,tableGb,tableHb,wramaccessbankr16
|
||||
EXTSYM wramaccessbankr8,wramaccessbankw16,wramaccessbankw8,tableadb
|
||||
|
||||
%include "cpu/65816db.inc"
|
||||
%include "cpu/address.inc"
|
||||
%include "cpu/addrni.inc"
|
||||
%include "cpu/e65816b.inc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; global variables
|
||||
|
||||
;*******************************************************
|
||||
; Generate OpCode Table
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM inittableb
|
||||
; set tablead (NVMXDIZC) ( MXD )
|
||||
push es
|
||||
xor ecx,ecx
|
||||
xor al,al
|
||||
mov cx,256
|
||||
mov edi,tableadb
|
||||
.loopa
|
||||
test al,08h ; D flag
|
||||
jnz .decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon
|
||||
mov esi,tableAb
|
||||
jmp .done
|
||||
.mon
|
||||
mov esi,tableBb
|
||||
jmp .done
|
||||
|
||||
.xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon2
|
||||
mov esi,tableCb
|
||||
jmp .done
|
||||
.mon2
|
||||
mov esi,tableDb
|
||||
jmp .done
|
||||
|
||||
.decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon3
|
||||
test al,20h ; M flag
|
||||
jnz .mon3
|
||||
mov esi,tableEb
|
||||
jmp .done
|
||||
.mon3
|
||||
mov esi,tableFb
|
||||
jmp .done
|
||||
|
||||
.xon3
|
||||
test al,20h
|
||||
jnz .mon4
|
||||
mov esi,tableGb
|
||||
jmp .done
|
||||
.mon4
|
||||
mov esi,tableHb
|
||||
.done
|
||||
inc al
|
||||
push eax
|
||||
mov eax,esi
|
||||
stosd
|
||||
pop eax
|
||||
loop .loopa
|
||||
|
||||
; Set CPU addresses
|
||||
; First, set all addresses to invalid
|
||||
mov eax,eopINVALID
|
||||
mov edi,tableAb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableBb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableCb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableDb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableEb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableFb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableGb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableHb
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableAb
|
||||
call settables
|
||||
mov edi,tableBb
|
||||
call settables
|
||||
mov edi,tableCb
|
||||
call settables
|
||||
mov edi,tableDb
|
||||
call settables
|
||||
mov edi,tableEb
|
||||
call settables
|
||||
mov edi,tableFb
|
||||
call settables
|
||||
mov edi,tableGb
|
||||
call settables
|
||||
mov edi,tableHb
|
||||
call settables
|
||||
|
||||
; set proper functions
|
||||
mov edi,tableAb ; Table addresses (M:0,X:0,D:0)
|
||||
call settablem16
|
||||
mov edi,tableAb
|
||||
call settablex16
|
||||
|
||||
mov edi,tableBb ; Table addresses (M:1,X:0,D:0)
|
||||
call settablex16
|
||||
|
||||
mov edi,tableCb ; Table addresses (M:0,X:1,D:0)
|
||||
call settablem16
|
||||
|
||||
mov edi,tableEb ; Table addresses (M:0,X:0,D:1)
|
||||
call settablem16
|
||||
mov edi,tableEb
|
||||
call settableDm16
|
||||
mov edi,tableEb
|
||||
call settablex16
|
||||
|
||||
mov edi,tableFb ; Table addresses (M:1,X:0,D:1)
|
||||
call settablex16
|
||||
mov edi,tableFb
|
||||
call settableDm8
|
||||
|
||||
mov edi,tableGb ; Table addresses (M:0,X:1,D:1)
|
||||
call settablem16
|
||||
mov edi,tableGb
|
||||
call settableDm16
|
||||
|
||||
mov edi,tableHb ; Table addresses (M:1,X:1,D:1)
|
||||
call settableDm8
|
||||
pop es
|
||||
ret
|
||||
|
||||
eopINVALID
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; Set Tables Sets the opcode tables according to EDI
|
||||
;*******************************************************
|
||||
; This function sets all the non-multiple entries
|
||||
settables:
|
||||
;row 0
|
||||
mov dword[edi+00h*4],COp00
|
||||
mov dword[edi+01h*4],COp01m8
|
||||
mov dword[edi+02h*4],COp02
|
||||
mov dword[edi+03h*4],COp03m8
|
||||
mov dword[edi+04h*4],COp04m8
|
||||
mov dword[edi+05h*4],COp05m8
|
||||
mov dword[edi+06h*4],COp06m8
|
||||
mov dword[edi+07h*4],COp07m8
|
||||
mov dword[edi+08h*4],COp08
|
||||
mov dword[edi+09h*4],COp09m8
|
||||
mov dword[edi+0Ah*4],COp0Am8
|
||||
mov dword[edi+0Bh*4],COp0B
|
||||
mov dword[edi+0Ch*4],COp0Cm8
|
||||
mov dword[edi+0Dh*4],COp0Dm8
|
||||
mov dword[edi+0Eh*4],COp0Em8
|
||||
mov dword[edi+0Fh*4],COp0Fm8
|
||||
mov dword[edi+10h*4],COp10
|
||||
mov dword[edi+11h*4],COp11m8
|
||||
mov dword[edi+12h*4],COp12m8
|
||||
mov dword[edi+13h*4],COp13m8
|
||||
mov dword[edi+14h*4],COp14m8
|
||||
mov dword[edi+15h*4],COp15m8
|
||||
mov dword[edi+16h*4],COp16m8
|
||||
mov dword[edi+17h*4],COp17m8
|
||||
mov dword[edi+18h*4],COp18
|
||||
mov dword[edi+19h*4],COp19m8
|
||||
mov dword[edi+1Ah*4],COp1Am8
|
||||
mov dword[edi+1Bh*4],COp1B
|
||||
mov dword[edi+1Ch*4],COp1Cm8
|
||||
mov dword[edi+1Dh*4],COp1Dm8
|
||||
mov dword[edi+1Eh*4],COp1Em8
|
||||
mov dword[edi+1Fh*4],COp1Fm8
|
||||
mov dword[edi+20h*4],COp20
|
||||
mov dword[edi+21h*4],COp21m8
|
||||
mov dword[edi+22h*4],COp22
|
||||
mov dword[edi+23h*4],COp23m8
|
||||
mov dword[edi+24h*4],COp24m8
|
||||
mov dword[edi+25h*4],COp25m8
|
||||
mov dword[edi+26h*4],COp26m8
|
||||
mov dword[edi+27h*4],COp27m8
|
||||
mov dword[edi+28h*4],COp28
|
||||
mov dword[edi+29h*4],COp29m8
|
||||
mov dword[edi+2Ah*4],COp2Am8
|
||||
mov dword[edi+2Bh*4],COp2B
|
||||
mov dword[edi+2Ch*4],COp2Cm8
|
||||
mov dword[edi+2Dh*4],COp2Dm8
|
||||
mov dword[edi+2Eh*4],COp2Em8
|
||||
mov dword[edi+2Fh*4],COp2Fm8
|
||||
mov dword[edi+30h*4],COp30
|
||||
mov dword[edi+31h*4],COp31m8
|
||||
mov dword[edi+32h*4],COp32m8
|
||||
mov dword[edi+33h*4],COp33m8
|
||||
mov dword[edi+34h*4],COp34m8
|
||||
mov dword[edi+35h*4],COp35m8
|
||||
mov dword[edi+36h*4],COp36m8
|
||||
mov dword[edi+37h*4],COp37m8
|
||||
mov dword[edi+38h*4],COp38
|
||||
mov dword[edi+39h*4],COp39m8
|
||||
mov dword[edi+3Ah*4],COp3Am8
|
||||
mov dword[edi+3Bh*4],COp3B
|
||||
mov dword[edi+3Ch*4],COp3Cm8
|
||||
mov dword[edi+3Dh*4],COp3Dm8
|
||||
mov dword[edi+3Eh*4],COp3Em8
|
||||
mov dword[edi+3Fh*4],COp3Fm8
|
||||
mov dword[edi+40h*4],COp40
|
||||
mov dword[edi+41h*4],COp41m8
|
||||
mov dword[edi+42h*4],COp42
|
||||
mov dword[edi+43h*4],COp43m8
|
||||
mov dword[edi+44h*4],COp44
|
||||
mov dword[edi+45h*4],COp45m8
|
||||
mov dword[edi+46h*4],COp46m8
|
||||
mov dword[edi+47h*4],COp47m8
|
||||
mov dword[edi+48h*4],COp48m8
|
||||
mov dword[edi+49h*4],COp49m8
|
||||
mov dword[edi+4Ah*4],COp4Am8
|
||||
mov dword[edi+4Bh*4],COp4B
|
||||
mov dword[edi+4Ch*4],COp4C
|
||||
mov dword[edi+4Dh*4],COp4Dm8
|
||||
mov dword[edi+4Eh*4],COp4Em8
|
||||
mov dword[edi+4Fh*4],COp4Fm8
|
||||
mov dword[edi+50h*4],COp50
|
||||
mov dword[edi+51h*4],COp51m8
|
||||
mov dword[edi+52h*4],COp52m8
|
||||
mov dword[edi+53h*4],COp53m8
|
||||
mov dword[edi+54h*4],COp54
|
||||
mov dword[edi+55h*4],COp55m8
|
||||
mov dword[edi+56h*4],COp56m8
|
||||
mov dword[edi+57h*4],COp57m8
|
||||
mov dword[edi+58h*4],COp58
|
||||
mov dword[edi+59h*4],COp59m8
|
||||
mov dword[edi+5Ah*4],COp5Ax8
|
||||
mov dword[edi+5Bh*4],COp5B
|
||||
mov dword[edi+5Ch*4],COp5C
|
||||
mov dword[edi+5Dh*4],COp5Dm8
|
||||
mov dword[edi+5Eh*4],COp5Em8
|
||||
mov dword[edi+5Fh*4],COp5Fm8
|
||||
mov dword[edi+60h*4],COp60
|
||||
mov dword[edi+61h*4],COp61m8nd
|
||||
mov dword[edi+62h*4],COp62
|
||||
mov dword[edi+63h*4],COp63m8nd
|
||||
mov dword[edi+64h*4],COp64m8
|
||||
mov dword[edi+65h*4],COp65m8nd
|
||||
mov dword[edi+66h*4],COp66m8
|
||||
mov dword[edi+67h*4],COp67m8nd
|
||||
mov dword[edi+68h*4],COp68m8
|
||||
mov dword[edi+69h*4],COp69m8nd
|
||||
mov dword[edi+6Ah*4],COp6Am8
|
||||
mov dword[edi+6Bh*4],COp6B
|
||||
mov dword[edi+6Ch*4],COp6C
|
||||
mov dword[edi+6Dh*4],COp6Dm8nd
|
||||
mov dword[edi+6Eh*4],COp6Em8
|
||||
mov dword[edi+6Fh*4],COp6Fm8nd
|
||||
mov dword[edi+70h*4],COp70
|
||||
mov dword[edi+71h*4],COp71m8nd
|
||||
mov dword[edi+72h*4],COp72m8nd
|
||||
mov dword[edi+73h*4],COp73m8nd
|
||||
mov dword[edi+74h*4],COp74m8
|
||||
mov dword[edi+75h*4],COp75m8nd
|
||||
mov dword[edi+76h*4],COp76m8
|
||||
mov dword[edi+77h*4],COp77m8nd
|
||||
mov dword[edi+78h*4],COp78
|
||||
mov dword[edi+79h*4],COp79m8nd
|
||||
mov dword[edi+7Ah*4],COp7Ax8
|
||||
mov dword[edi+7Bh*4],COp7B
|
||||
mov dword[edi+7Ch*4],COp7C
|
||||
mov dword[edi+7Dh*4],COp7Dm8nd
|
||||
mov dword[edi+7Eh*4],COp7Em8
|
||||
mov dword[edi+7Fh*4],COp7Fm8nd
|
||||
mov dword[edi+80h*4],COp80
|
||||
mov dword[edi+81h*4],COp81m8
|
||||
mov dword[edi+82h*4],COp82
|
||||
mov dword[edi+83h*4],COp83m8
|
||||
mov dword[edi+84h*4],COp84x8
|
||||
mov dword[edi+85h*4],COp85m8
|
||||
mov dword[edi+86h*4],COp86x8
|
||||
mov dword[edi+87h*4],COp87m8
|
||||
mov dword[edi+88h*4],COp88x8
|
||||
mov dword[edi+89h*4],COp89m8
|
||||
mov dword[edi+8Ah*4],COp8Am8
|
||||
mov dword[edi+8Bh*4],COp8B
|
||||
mov dword[edi+8Ch*4],COp8Cx8
|
||||
mov dword[edi+8Dh*4],COp8Dm8
|
||||
mov dword[edi+8Eh*4],COp8Ex8
|
||||
mov dword[edi+8Fh*4],COp8Fm8
|
||||
mov dword[edi+90h*4],COp90
|
||||
mov dword[edi+91h*4],COp91m8
|
||||
mov dword[edi+92h*4],COp92m8
|
||||
mov dword[edi+93h*4],COp93m8
|
||||
mov dword[edi+94h*4],COp94x8
|
||||
mov dword[edi+95h*4],COp95m8
|
||||
mov dword[edi+96h*4],COp96x8
|
||||
mov dword[edi+97h*4],COp97m8
|
||||
mov dword[edi+98h*4],COp98m8
|
||||
mov dword[edi+99h*4],COp99m8
|
||||
mov dword[edi+9Ah*4],COp9A
|
||||
mov dword[edi+9Bh*4],COp9Bx8
|
||||
mov dword[edi+9Ch*4],COp9Cm8
|
||||
mov dword[edi+9Dh*4],COp9Dm8
|
||||
mov dword[edi+9Eh*4],COp9Em8
|
||||
mov dword[edi+9Fh*4],COp9Fm8
|
||||
mov dword[edi+0A0h*4],COpA0x8
|
||||
mov dword[edi+0A1h*4],COpA1m8
|
||||
mov dword[edi+0A2h*4],COpA2x8
|
||||
mov dword[edi+0A3h*4],COpA3m8
|
||||
mov dword[edi+0A4h*4],COpA4x8
|
||||
mov dword[edi+0A5h*4],COpA5m8
|
||||
mov dword[edi+0A6h*4],COpA6x8
|
||||
mov dword[edi+0A7h*4],COpA7m8
|
||||
mov dword[edi+0A8h*4],COpA8x8
|
||||
mov dword[edi+0A9h*4],COpA9m8
|
||||
mov dword[edi+0AAh*4],COpAAx8
|
||||
mov dword[edi+0ABh*4],COpAB
|
||||
mov dword[edi+0ACh*4],COpACx8
|
||||
mov dword[edi+0ADh*4],COpADm8
|
||||
mov dword[edi+0AEh*4],COpAEx8
|
||||
mov dword[edi+0AFh*4],COpAFm8
|
||||
mov dword[edi+0B0h*4],COpB0
|
||||
mov dword[edi+0B1h*4],COpB1m8
|
||||
mov dword[edi+0B2h*4],COpB2m8
|
||||
mov dword[edi+0B3h*4],COpB3m8
|
||||
mov dword[edi+0B4h*4],COpB4x8
|
||||
mov dword[edi+0B5h*4],COpB5m8
|
||||
mov dword[edi+0B6h*4],COpB6x8
|
||||
mov dword[edi+0B7h*4],COpB7m8
|
||||
mov dword[edi+0B8h*4],COpB8
|
||||
mov dword[edi+0B9h*4],COpB9m8
|
||||
mov dword[edi+0BAh*4],COpBAx8
|
||||
mov dword[edi+0BBh*4],COpBBx8
|
||||
mov dword[edi+0BCh*4],COpBCx8
|
||||
mov dword[edi+0BDh*4],COpBDm8
|
||||
mov dword[edi+0BEh*4],COpBEx8
|
||||
mov dword[edi+0BFh*4],COpBFm8
|
||||
mov dword[edi+0C0h*4],COpC0x8
|
||||
mov dword[edi+0C1h*4],COpC1m8
|
||||
mov dword[edi+0C2h*4],COpC2
|
||||
mov dword[edi+0C3h*4],COpC3m8
|
||||
mov dword[edi+0C4h*4],COpC4x8
|
||||
mov dword[edi+0C5h*4],COpC5m8
|
||||
mov dword[edi+0C6h*4],COpC6m8
|
||||
mov dword[edi+0C7h*4],COpC7m8
|
||||
mov dword[edi+0C8h*4],COpC8x8
|
||||
mov dword[edi+0C9h*4],COpC9m8
|
||||
mov dword[edi+0CAh*4],COpCAx8
|
||||
mov dword[edi+0CBh*4],COpCB
|
||||
mov dword[edi+0CCh*4],COpCCx8
|
||||
mov dword[edi+0CDh*4],COpCDm8
|
||||
mov dword[edi+0CEh*4],COpCEm8
|
||||
mov dword[edi+0CFh*4],COpCFm8
|
||||
mov dword[edi+0D0h*4],COpD0
|
||||
mov dword[edi+0D1h*4],COpD1m8
|
||||
mov dword[edi+0D2h*4],COpD2m8
|
||||
mov dword[edi+0D3h*4],COpD3m8
|
||||
mov dword[edi+0D4h*4],COpD4
|
||||
mov dword[edi+0D5h*4],COpD5m8
|
||||
mov dword[edi+0D6h*4],COpD6m8
|
||||
mov dword[edi+0D7h*4],COpD7m8
|
||||
mov dword[edi+0D8h*4],COpD8
|
||||
mov dword[edi+0D9h*4],COpD9m8
|
||||
mov dword[edi+0DAh*4],COpDAx8
|
||||
mov dword[edi+0DBh*4],COpDB
|
||||
mov dword[edi+0DCh*4],COpDC
|
||||
mov dword[edi+0DDh*4],COpDDm8
|
||||
mov dword[edi+0DEh*4],COpDEm8
|
||||
mov dword[edi+0DFh*4],COpDFm8
|
||||
mov dword[edi+0E0h*4],COpE0x8
|
||||
mov dword[edi+0E1h*4],COpE1m8nd
|
||||
mov dword[edi+0E2h*4],COpE2
|
||||
mov dword[edi+0E3h*4],COpE3m8nd
|
||||
mov dword[edi+0E4h*4],COpE4x8
|
||||
mov dword[edi+0E5h*4],COpE5m8nd
|
||||
mov dword[edi+0E6h*4],COpE6m8
|
||||
mov dword[edi+0E7h*4],COpE7m8nd
|
||||
mov dword[edi+0E8h*4],COpE8x8
|
||||
mov dword[edi+0E9h*4],COpE9m8nd
|
||||
mov dword[edi+0EAh*4],COpEA
|
||||
mov dword[edi+0EBh*4],COpEB
|
||||
mov dword[edi+0ECh*4],COpECx8
|
||||
mov dword[edi+0EDh*4],COpEDm8nd
|
||||
mov dword[edi+0EEh*4],COpEEm8
|
||||
mov dword[edi+0EFh*4],COpEFm8nd
|
||||
mov dword[edi+0F0h*4],COpF0
|
||||
mov dword[edi+0F1h*4],COpF1m8nd
|
||||
mov dword[edi+0F2h*4],COpF2m8nd
|
||||
mov dword[edi+0F3h*4],COpF3m8nd
|
||||
mov dword[edi+0F4h*4],COpF4
|
||||
mov dword[edi+0F5h*4],COpF5m8nd
|
||||
mov dword[edi+0F6h*4],COpF6m8
|
||||
mov dword[edi+0F7h*4],COpF7m8nd
|
||||
mov dword[edi+0F8h*4],COpF8
|
||||
mov dword[edi+0F9h*4],COpF9m8nd
|
||||
mov dword[edi+0FAh*4],COpFAx8
|
||||
mov dword[edi+0FBh*4],COpFB
|
||||
mov dword[edi+0FCh*4],COpFC
|
||||
mov dword[edi+0FDh*4],COpFDm8nd
|
||||
mov dword[edi+0FEh*4],COpFEm8
|
||||
mov dword[edi+0FFh*4],COpFFm8nd
|
||||
ret
|
||||
|
||||
settablem16:
|
||||
mov dword[edi+01h*4],COp01m16
|
||||
mov dword[edi+03h*4],COp03m16
|
||||
mov dword[edi+04h*4],COp04m16
|
||||
mov dword[edi+05h*4],COp05m16
|
||||
mov dword[edi+06h*4],COp06m16
|
||||
mov dword[edi+07h*4],COp07m16
|
||||
mov dword[edi+09h*4],COp09m16
|
||||
mov dword[edi+0Ah*4],COp0Am16
|
||||
mov dword[edi+0Ch*4],COp0Cm16
|
||||
mov dword[edi+0Dh*4],COp0Dm16
|
||||
mov dword[edi+0Eh*4],COp0Em16
|
||||
mov dword[edi+0Fh*4],COp0Fm16
|
||||
mov dword[edi+11h*4],COp11m16
|
||||
mov dword[edi+12h*4],COp12m16
|
||||
mov dword[edi+13h*4],COp13m16
|
||||
mov dword[edi+14h*4],COp14m16
|
||||
mov dword[edi+15h*4],COp15m16
|
||||
mov dword[edi+16h*4],COp16m16
|
||||
mov dword[edi+17h*4],COp17m16
|
||||
mov dword[edi+19h*4],COp19m16
|
||||
mov dword[edi+1Ah*4],COp1Am16
|
||||
mov dword[edi+1Ch*4],COp1Cm16
|
||||
mov dword[edi+1Dh*4],COp1Dm16
|
||||
mov dword[edi+1Eh*4],COp1Em16
|
||||
mov dword[edi+1Fh*4],COp1Fm16
|
||||
mov dword[edi+21h*4],COp21m16
|
||||
mov dword[edi+23h*4],COp23m16
|
||||
mov dword[edi+24h*4],COp24m16
|
||||
mov dword[edi+25h*4],COp25m16
|
||||
mov dword[edi+26h*4],COp26m16
|
||||
mov dword[edi+27h*4],COp27m16
|
||||
mov dword[edi+29h*4],COp29m16
|
||||
mov dword[edi+2Ah*4],COp2Am16
|
||||
mov dword[edi+2Ch*4],COp2Cm16
|
||||
mov dword[edi+2Dh*4],COp2Dm16
|
||||
mov dword[edi+2Eh*4],COp2Em16
|
||||
mov dword[edi+2Fh*4],COp2Fm16
|
||||
mov dword[edi+31h*4],COp31m16
|
||||
mov dword[edi+32h*4],COp32m16
|
||||
mov dword[edi+33h*4],COp33m16
|
||||
mov dword[edi+34h*4],COp34m16
|
||||
mov dword[edi+35h*4],COp35m16
|
||||
mov dword[edi+36h*4],COp36m16
|
||||
mov dword[edi+37h*4],COp37m16
|
||||
mov dword[edi+39h*4],COp39m16
|
||||
mov dword[edi+3Ah*4],COp3Am16
|
||||
mov dword[edi+3Ch*4],COp3Cm16
|
||||
mov dword[edi+3Dh*4],COp3Dm16
|
||||
mov dword[edi+3Eh*4],COp3Em16
|
||||
mov dword[edi+3Fh*4],COp3Fm16
|
||||
mov dword[edi+41h*4],COp41m16
|
||||
mov dword[edi+43h*4],COp43m16
|
||||
mov dword[edi+45h*4],COp45m16
|
||||
mov dword[edi+46h*4],COp46m16
|
||||
mov dword[edi+47h*4],COp47m16
|
||||
mov dword[edi+48h*4],COp48m16
|
||||
mov dword[edi+49h*4],COp49m16
|
||||
mov dword[edi+4Ah*4],COp4Am16
|
||||
mov dword[edi+4Dh*4],COp4Dm16
|
||||
mov dword[edi+4Eh*4],COp4Em16
|
||||
mov dword[edi+4Fh*4],COp4Fm16
|
||||
mov dword[edi+51h*4],COp51m16
|
||||
mov dword[edi+52h*4],COp52m16
|
||||
mov dword[edi+53h*4],COp53m16
|
||||
mov dword[edi+55h*4],COp55m16
|
||||
mov dword[edi+56h*4],COp56m16
|
||||
mov dword[edi+57h*4],COp57m16
|
||||
mov dword[edi+59h*4],COp59m16
|
||||
mov dword[edi+5Dh*4],COp5Dm16
|
||||
mov dword[edi+5Eh*4],COp5Em16
|
||||
mov dword[edi+5Fh*4],COp5Fm16
|
||||
mov dword[edi+61h*4],COp61m16nd
|
||||
mov dword[edi+63h*4],COp63m16nd
|
||||
mov dword[edi+64h*4],COp64m16
|
||||
mov dword[edi+65h*4],COp65m16nd
|
||||
mov dword[edi+66h*4],COp66m16
|
||||
mov dword[edi+67h*4],COp67m16nd
|
||||
mov dword[edi+68h*4],COp68m16
|
||||
mov dword[edi+69h*4],COp69m16nd
|
||||
mov dword[edi+6Ah*4],COp6Am16
|
||||
mov dword[edi+6Dh*4],COp6Dm16nd
|
||||
mov dword[edi+6Eh*4],COp6Em16
|
||||
mov dword[edi+6Fh*4],COp6Fm16nd
|
||||
mov dword[edi+71h*4],COp71m16nd
|
||||
mov dword[edi+72h*4],COp72m16nd
|
||||
mov dword[edi+73h*4],COp73m16nd
|
||||
mov dword[edi+74h*4],COp74m16
|
||||
mov dword[edi+75h*4],COp75m16nd
|
||||
mov dword[edi+76h*4],COp76m16
|
||||
mov dword[edi+77h*4],COp77m16nd
|
||||
mov dword[edi+79h*4],COp79m16nd
|
||||
mov dword[edi+7Dh*4],COp7Dm16nd
|
||||
mov dword[edi+7Eh*4],COp7Em16
|
||||
mov dword[edi+7Fh*4],COp7Fm16nd
|
||||
mov dword[edi+81h*4],COp81m16
|
||||
mov dword[edi+83h*4],COp83m16
|
||||
mov dword[edi+85h*4],COp85m16
|
||||
mov dword[edi+87h*4],COp87m16
|
||||
mov dword[edi+89h*4],COp89m16
|
||||
mov dword[edi+8Ah*4],COp8Am16
|
||||
mov dword[edi+8Dh*4],COp8Dm16
|
||||
mov dword[edi+8Fh*4],COp8Fm16
|
||||
mov dword[edi+91h*4],COp91m16
|
||||
mov dword[edi+92h*4],COp92m16
|
||||
mov dword[edi+93h*4],COp93m16
|
||||
mov dword[edi+95h*4],COp95m16
|
||||
mov dword[edi+97h*4],COp97m16
|
||||
mov dword[edi+98h*4],COp98m16
|
||||
mov dword[edi+99h*4],COp99m16
|
||||
mov dword[edi+9Ch*4],COp9Cm16
|
||||
mov dword[edi+9Dh*4],COp9Dm16
|
||||
mov dword[edi+9Eh*4],COp9Em16
|
||||
mov dword[edi+9Fh*4],COp9Fm16
|
||||
mov dword[edi+0A1h*4],COpA1m16
|
||||
mov dword[edi+0A3h*4],COpA3m16
|
||||
mov dword[edi+0A5h*4],COpA5m16
|
||||
mov dword[edi+0A7h*4],COpA7m16
|
||||
mov dword[edi+0A9h*4],COpA9m16
|
||||
mov dword[edi+0ADh*4],COpADm16
|
||||
mov dword[edi+0AFh*4],COpAFm16
|
||||
mov dword[edi+0B1h*4],COpB1m16
|
||||
mov dword[edi+0B2h*4],COpB2m16
|
||||
mov dword[edi+0B3h*4],COpB3m16
|
||||
mov dword[edi+0B5h*4],COpB5m16
|
||||
mov dword[edi+0B7h*4],COpB7m16
|
||||
mov dword[edi+0B9h*4],COpB9m16
|
||||
mov dword[edi+0BDh*4],COpBDm16
|
||||
mov dword[edi+0BFh*4],COpBFm16
|
||||
mov dword[edi+0C1h*4],COpC1m16
|
||||
mov dword[edi+0C3h*4],COpC3m16
|
||||
mov dword[edi+0C5h*4],COpC5m16
|
||||
mov dword[edi+0C6h*4],COpC6m16
|
||||
mov dword[edi+0C7h*4],COpC7m16
|
||||
mov dword[edi+0C9h*4],COpC9m16
|
||||
mov dword[edi+0CDh*4],COpCDm16
|
||||
mov dword[edi+0CEh*4],COpCEm16
|
||||
mov dword[edi+0CFh*4],COpCFm16
|
||||
mov dword[edi+0D1h*4],COpD1m16
|
||||
mov dword[edi+0D2h*4],COpD2m16
|
||||
mov dword[edi+0D3h*4],COpD3m16
|
||||
mov dword[edi+0D5h*4],COpD5m16
|
||||
mov dword[edi+0D6h*4],COpD6m16
|
||||
mov dword[edi+0D7h*4],COpD7m16
|
||||
mov dword[edi+0D9h*4],COpD9m16
|
||||
mov dword[edi+0DDh*4],COpDDm16
|
||||
mov dword[edi+0DEh*4],COpDEm16
|
||||
mov dword[edi+0DFh*4],COpDFm16
|
||||
mov dword[edi+0E1h*4],COpE1m16nd
|
||||
mov dword[edi+0E3h*4],COpE3m16nd
|
||||
mov dword[edi+0E5h*4],COpE5m16nd
|
||||
mov dword[edi+0E6h*4],COpE6m16
|
||||
mov dword[edi+0E7h*4],COpE7m16nd
|
||||
mov dword[edi+0E9h*4],COpE9m16nd
|
||||
mov dword[edi+0EDh*4],COpEDm16nd
|
||||
mov dword[edi+0EEh*4],COpEEm16
|
||||
mov dword[edi+0EFh*4],COpEFm16nd
|
||||
mov dword[edi+0F1h*4],COpF1m16nd
|
||||
mov dword[edi+0F2h*4],COpF2m16nd
|
||||
mov dword[edi+0F3h*4],COpF3m16nd
|
||||
mov dword[edi+0F5h*4],COpF5m16nd
|
||||
mov dword[edi+0F6h*4],COpF6m16
|
||||
mov dword[edi+0F7h*4],COpF7m16nd
|
||||
mov dword[edi+0F9h*4],COpF9m16nd
|
||||
mov dword[edi+0FDh*4],COpFDm16nd
|
||||
mov dword[edi+0FEh*4],COpFEm16
|
||||
mov dword[edi+0FFh*4],COpFFm16nd
|
||||
ret
|
||||
|
||||
settablex16:
|
||||
mov dword[edi+5Ah*4],COp5Ax16
|
||||
mov dword[edi+7Ah*4],COp7Ax16
|
||||
mov dword[edi+84h*4],COp84x16
|
||||
mov dword[edi+86h*4],COp86x16
|
||||
mov dword[edi+88h*4],COp88x16
|
||||
mov dword[edi+8Ch*4],COp8Cx16
|
||||
mov dword[edi+8Eh*4],COp8Ex16
|
||||
mov dword[edi+94h*4],COp94x16
|
||||
mov dword[edi+96h*4],COp96x16
|
||||
mov dword[edi+9Bh*4],COp9Bx16
|
||||
mov dword[edi+0A0h*4],COpA0x16
|
||||
mov dword[edi+0A2h*4],COpA2x16
|
||||
mov dword[edi+0A4h*4],COpA4x16
|
||||
mov dword[edi+0A6h*4],COpA6x16
|
||||
mov dword[edi+0A8h*4],COpA8x16
|
||||
mov dword[edi+0AAh*4],COpAAx16
|
||||
mov dword[edi+0ACh*4],COpACx16
|
||||
mov dword[edi+0AEh*4],COpAEx16
|
||||
mov dword[edi+0B4h*4],COpB4x16
|
||||
mov dword[edi+0B6h*4],COpB6x16
|
||||
mov dword[edi+0BAh*4],COpBAx16
|
||||
mov dword[edi+0BBh*4],COpBBx16
|
||||
mov dword[edi+0BCh*4],COpBCx16
|
||||
mov dword[edi+0BEh*4],COpBEx16
|
||||
mov dword[edi+0C0h*4],COpC0x16
|
||||
mov dword[edi+0C4h*4],COpC4x16
|
||||
mov dword[edi+0C8h*4],COpC8x16
|
||||
mov dword[edi+0CAh*4],COpCAx16
|
||||
mov dword[edi+0CCh*4],COpCCx16
|
||||
mov dword[edi+0DAh*4],COpDAx16
|
||||
mov dword[edi+0E0h*4],COpE0x16
|
||||
mov dword[edi+0E4h*4],COpE4x16
|
||||
mov dword[edi+0E8h*4],COpE8x16
|
||||
mov dword[edi+0ECh*4],COpECx16
|
||||
mov dword[edi+0FAh*4],COpFAx16
|
||||
ret
|
||||
|
||||
settableDm8:
|
||||
mov dword[edi+61h*4],COp61m8d
|
||||
mov dword[edi+63h*4],COp63m8d
|
||||
mov dword[edi+65h*4],COp65m8d
|
||||
mov dword[edi+67h*4],COp67m8d
|
||||
mov dword[edi+69h*4],COp69m8d
|
||||
mov dword[edi+6Dh*4],COp6Dm8d
|
||||
mov dword[edi+6Fh*4],COp6Fm8d
|
||||
mov dword[edi+71h*4],COp71m8d
|
||||
mov dword[edi+72h*4],COp72m8d
|
||||
mov dword[edi+73h*4],COp73m8d
|
||||
mov dword[edi+75h*4],COp75m8d
|
||||
mov dword[edi+77h*4],COp77m8d
|
||||
mov dword[edi+79h*4],COp79m8d
|
||||
mov dword[edi+7Dh*4],COp7Dm8d
|
||||
mov dword[edi+7Fh*4],COp7Fm8d
|
||||
mov dword[edi+0E1h*4],COpE1m8d
|
||||
mov dword[edi+0E3h*4],COpE3m8d
|
||||
mov dword[edi+0E5h*4],COpE5m8d
|
||||
mov dword[edi+0E7h*4],COpE7m8d
|
||||
mov dword[edi+0E9h*4],COpE9m8d
|
||||
mov dword[edi+0EDh*4],COpEDm8d
|
||||
mov dword[edi+0EFh*4],COpEFm8d
|
||||
mov dword[edi+0F1h*4],COpF1m8d
|
||||
mov dword[edi+0F2h*4],COpF2m8d
|
||||
mov dword[edi+0F3h*4],COpF3m8d
|
||||
mov dword[edi+0F5h*4],COpF5m8d
|
||||
mov dword[edi+0F7h*4],COpF7m8d
|
||||
mov dword[edi+0F9h*4],COpF9m8d
|
||||
mov dword[edi+0FDh*4],COpFDm8d
|
||||
mov dword[edi+0FFh*4],COpFFm8d
|
||||
ret
|
||||
|
||||
settableDm16:
|
||||
mov dword[edi+61h*4],COp61m16d
|
||||
mov dword[edi+63h*4],COp63m16d
|
||||
mov dword[edi+65h*4],COp65m16d
|
||||
mov dword[edi+67h*4],COp67m16d
|
||||
mov dword[edi+69h*4],COp69m16d
|
||||
mov dword[edi+6Dh*4],COp6Dm16d
|
||||
mov dword[edi+6Fh*4],COp6Fm16d
|
||||
mov dword[edi+71h*4],COp71m16d
|
||||
mov dword[edi+72h*4],COp72m16d
|
||||
mov dword[edi+73h*4],COp73m16d
|
||||
mov dword[edi+75h*4],COp75m16d
|
||||
mov dword[edi+77h*4],COp77m16d
|
||||
mov dword[edi+79h*4],COp79m16d
|
||||
mov dword[edi+7Dh*4],COp7Dm16d
|
||||
mov dword[edi+7Fh*4],COp7Fm16d
|
||||
mov dword[edi+0E1h*4],COpE1m16d
|
||||
mov dword[edi+0E3h*4],COpE3m16d
|
||||
mov dword[edi+0E5h*4],COpE5m16d
|
||||
mov dword[edi+0E7h*4],COpE7m16d
|
||||
mov dword[edi+0E9h*4],COpE9m16d
|
||||
mov dword[edi+0EDh*4],COpEDm16d
|
||||
mov dword[edi+0EFh*4],COpEFm16d
|
||||
mov dword[edi+0F1h*4],COpF1m16d
|
||||
mov dword[edi+0F2h*4],COpF2m16d
|
||||
mov dword[edi+0F3h*4],COpF3m16d
|
||||
mov dword[edi+0F5h*4],COpF5m16d
|
||||
mov dword[edi+0F7h*4],COpF7m16d
|
||||
mov dword[edi+0F9h*4],COpF9m16d
|
||||
mov dword[edi+0FDh*4],COpFDm16d
|
||||
mov dword[edi+0FFh*4],COpFFm16d
|
||||
ret
|
||||
|
||||
|
||||
723
zsnes/src/cpu/tablec.asm
Normal file
723
zsnes/src/cpu/tablec.asm
Normal file
@@ -0,0 +1,723 @@
|
||||
;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 eramaccessbankr16,eramaccessbankr8,eramaccessbankw16
|
||||
EXTSYM eramaccessbankw8,memaccessbankr16,memaccessbankr8
|
||||
EXTSYM memaccessbankw16,memaccessbankw8
|
||||
EXTSYM mosjmptab,mosdraw10,mosdraw11,mosdraw12,mosdraw13
|
||||
EXTSYM mosdraw14,mosdraw15,mosdraw16,mosdraw2,mosdraw3
|
||||
EXTSYM mosdraw4,mosdraw5,mosdraw6,mosdraw7,mosdraw8
|
||||
EXTSYM mosdraw9,ngpalcon2b,ngpalcon4b
|
||||
EXTSYM regaccessbankr16,regaccessbankw16,regaccessbankw8
|
||||
EXTSYM sramaccessbankr16,sramaccessbankr8,sramaccessbankw16
|
||||
EXTSYM sramaccessbankw8,tableAc,tableBc,tableCc,tableDc,tableEc
|
||||
EXTSYM tableFc,tableGc,tableHc,wramaccessbankr16
|
||||
EXTSYM wramaccessbankr8,wramaccessbankw16,wramaccessbankw8,tableadc
|
||||
|
||||
%include "cpu/65816dc.inc"
|
||||
%include "cpu/address.inc"
|
||||
%include "cpu/addrni.inc"
|
||||
%include "cpu/e65816c.inc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; global variables
|
||||
|
||||
;*******************************************************
|
||||
; Generate OpCode Table
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM inittablec
|
||||
; set tablead (NVMXDIZC) ( MXD )
|
||||
push es
|
||||
xor ecx,ecx
|
||||
xor al,al
|
||||
mov cx,256
|
||||
mov edi,tableadc
|
||||
.loopa
|
||||
test al,08h ; D flag
|
||||
jnz .decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon
|
||||
mov esi,tableAc
|
||||
jmp .done
|
||||
.mon
|
||||
mov esi,tableBc
|
||||
jmp .done
|
||||
|
||||
.xon
|
||||
test al,20h ; M flag
|
||||
jnz .mon2
|
||||
mov esi,tableCc
|
||||
jmp .done
|
||||
.mon2
|
||||
mov esi,tableDc
|
||||
jmp .done
|
||||
|
||||
.decon
|
||||
test al,10h ; X flag
|
||||
jnz .xon3
|
||||
test al,20h ; M flag
|
||||
jnz .mon3
|
||||
mov esi,tableEc
|
||||
jmp .done
|
||||
.mon3
|
||||
mov esi,tableFc
|
||||
jmp .done
|
||||
|
||||
.xon3
|
||||
test al,20h
|
||||
jnz .mon4
|
||||
mov esi,tableGc
|
||||
jmp .done
|
||||
.mon4
|
||||
mov esi,tableHc
|
||||
.done
|
||||
inc al
|
||||
push eax
|
||||
mov eax,esi
|
||||
stosd
|
||||
pop eax
|
||||
loop .loopa
|
||||
|
||||
; Set CPU addresses
|
||||
; First, set all addresses to invalid
|
||||
mov eax,eopINVALID
|
||||
mov edi,tableAc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableBc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableCc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableDc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableEc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableFc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableGc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableHc
|
||||
mov ecx,256
|
||||
rep stosd
|
||||
mov edi,tableAc
|
||||
call settables
|
||||
mov edi,tableBc
|
||||
call settables
|
||||
mov edi,tableCc
|
||||
call settables
|
||||
mov edi,tableDc
|
||||
call settables
|
||||
mov edi,tableEc
|
||||
call settables
|
||||
mov edi,tableFc
|
||||
call settables
|
||||
mov edi,tableGc
|
||||
call settables
|
||||
mov edi,tableHc
|
||||
call settables
|
||||
|
||||
; set proper functions
|
||||
mov edi,tableAc ; Table addresses (M:0,X:0,D:0)
|
||||
call settablem16
|
||||
mov edi,tableAc
|
||||
call settablex16
|
||||
|
||||
mov edi,tableBc ; Table addresses (M:1,X:0,D:0)
|
||||
call settablex16
|
||||
|
||||
mov edi,tableCc ; Table addresses (M:0,X:1,D:0)
|
||||
call settablem16
|
||||
|
||||
mov edi,tableEc ; Table addresses (M:0,X:0,D:1)
|
||||
call settablem16
|
||||
mov edi,tableEc
|
||||
call settableDm16
|
||||
mov edi,tableEc
|
||||
call settablex16
|
||||
|
||||
mov edi,tableFc ; Table addresses (M:1,X:0,D:1)
|
||||
call settablex16
|
||||
mov edi,tableFc
|
||||
call settableDm8
|
||||
|
||||
mov edi,tableGc ; Table addresses (M:0,X:1,D:1)
|
||||
call settablem16
|
||||
mov edi,tableGc
|
||||
call settableDm16
|
||||
|
||||
mov edi,tableHc ; Table addresses (M:1,X:1,D:1)
|
||||
call settableDm8
|
||||
pop es
|
||||
ret
|
||||
|
||||
eopINVALID
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; Set Tables Sets the opcode tables according to EDI
|
||||
;*******************************************************
|
||||
; This function sets all the non-multiple entries
|
||||
settables:
|
||||
;row 0
|
||||
mov dword[edi+00h*4],COp00
|
||||
mov dword[edi+01h*4],COp01m8
|
||||
mov dword[edi+02h*4],COp02
|
||||
mov dword[edi+03h*4],COp03m8
|
||||
mov dword[edi+04h*4],COp04m8
|
||||
mov dword[edi+05h*4],COp05m8
|
||||
mov dword[edi+06h*4],COp06m8
|
||||
mov dword[edi+07h*4],COp07m8
|
||||
mov dword[edi+08h*4],COp08
|
||||
mov dword[edi+09h*4],COp09m8
|
||||
mov dword[edi+0Ah*4],COp0Am8
|
||||
mov dword[edi+0Bh*4],COp0B
|
||||
mov dword[edi+0Ch*4],COp0Cm8
|
||||
mov dword[edi+0Dh*4],COp0Dm8
|
||||
mov dword[edi+0Eh*4],COp0Em8
|
||||
mov dword[edi+0Fh*4],COp0Fm8
|
||||
mov dword[edi+10h*4],COp10
|
||||
mov dword[edi+11h*4],COp11m8
|
||||
mov dword[edi+12h*4],COp12m8
|
||||
mov dword[edi+13h*4],COp13m8
|
||||
mov dword[edi+14h*4],COp14m8
|
||||
mov dword[edi+15h*4],COp15m8
|
||||
mov dword[edi+16h*4],COp16m8
|
||||
mov dword[edi+17h*4],COp17m8
|
||||
mov dword[edi+18h*4],COp18
|
||||
mov dword[edi+19h*4],COp19m8
|
||||
mov dword[edi+1Ah*4],COp1Am8
|
||||
mov dword[edi+1Bh*4],COp1B
|
||||
mov dword[edi+1Ch*4],COp1Cm8
|
||||
mov dword[edi+1Dh*4],COp1Dm8
|
||||
mov dword[edi+1Eh*4],COp1Em8
|
||||
mov dword[edi+1Fh*4],COp1Fm8
|
||||
mov dword[edi+20h*4],COp20
|
||||
mov dword[edi+21h*4],COp21m8
|
||||
mov dword[edi+22h*4],COp22
|
||||
mov dword[edi+23h*4],COp23m8
|
||||
mov dword[edi+24h*4],COp24m8
|
||||
mov dword[edi+25h*4],COp25m8
|
||||
mov dword[edi+26h*4],COp26m8
|
||||
mov dword[edi+27h*4],COp27m8
|
||||
mov dword[edi+28h*4],COp28
|
||||
mov dword[edi+29h*4],COp29m8
|
||||
mov dword[edi+2Ah*4],COp2Am8
|
||||
mov dword[edi+2Bh*4],COp2B
|
||||
mov dword[edi+2Ch*4],COp2Cm8
|
||||
mov dword[edi+2Dh*4],COp2Dm8
|
||||
mov dword[edi+2Eh*4],COp2Em8
|
||||
mov dword[edi+2Fh*4],COp2Fm8
|
||||
mov dword[edi+30h*4],COp30
|
||||
mov dword[edi+31h*4],COp31m8
|
||||
mov dword[edi+32h*4],COp32m8
|
||||
mov dword[edi+33h*4],COp33m8
|
||||
mov dword[edi+34h*4],COp34m8
|
||||
mov dword[edi+35h*4],COp35m8
|
||||
mov dword[edi+36h*4],COp36m8
|
||||
mov dword[edi+37h*4],COp37m8
|
||||
mov dword[edi+38h*4],COp38
|
||||
mov dword[edi+39h*4],COp39m8
|
||||
mov dword[edi+3Ah*4],COp3Am8
|
||||
mov dword[edi+3Bh*4],COp3B
|
||||
mov dword[edi+3Ch*4],COp3Cm8
|
||||
mov dword[edi+3Dh*4],COp3Dm8
|
||||
mov dword[edi+3Eh*4],COp3Em8
|
||||
mov dword[edi+3Fh*4],COp3Fm8
|
||||
mov dword[edi+40h*4],COp40
|
||||
mov dword[edi+41h*4],COp41m8
|
||||
mov dword[edi+42h*4],COp42
|
||||
mov dword[edi+43h*4],COp43m8
|
||||
mov dword[edi+44h*4],COp44
|
||||
mov dword[edi+45h*4],COp45m8
|
||||
mov dword[edi+46h*4],COp46m8
|
||||
mov dword[edi+47h*4],COp47m8
|
||||
mov dword[edi+48h*4],COp48m8
|
||||
mov dword[edi+49h*4],COp49m8
|
||||
mov dword[edi+4Ah*4],COp4Am8
|
||||
mov dword[edi+4Bh*4],COp4B
|
||||
mov dword[edi+4Ch*4],COp4C
|
||||
mov dword[edi+4Dh*4],COp4Dm8
|
||||
mov dword[edi+4Eh*4],COp4Em8
|
||||
mov dword[edi+4Fh*4],COp4Fm8
|
||||
mov dword[edi+50h*4],COp50
|
||||
mov dword[edi+51h*4],COp51m8
|
||||
mov dword[edi+52h*4],COp52m8
|
||||
mov dword[edi+53h*4],COp53m8
|
||||
mov dword[edi+54h*4],COp54
|
||||
mov dword[edi+55h*4],COp55m8
|
||||
mov dword[edi+56h*4],COp56m8
|
||||
mov dword[edi+57h*4],COp57m8
|
||||
mov dword[edi+58h*4],COp58
|
||||
mov dword[edi+59h*4],COp59m8
|
||||
mov dword[edi+5Ah*4],COp5Ax8
|
||||
mov dword[edi+5Bh*4],COp5B
|
||||
mov dword[edi+5Ch*4],COp5C
|
||||
mov dword[edi+5Dh*4],COp5Dm8
|
||||
mov dword[edi+5Eh*4],COp5Em8
|
||||
mov dword[edi+5Fh*4],COp5Fm8
|
||||
mov dword[edi+60h*4],COp60
|
||||
mov dword[edi+61h*4],COp61m8nd
|
||||
mov dword[edi+62h*4],COp62
|
||||
mov dword[edi+63h*4],COp63m8nd
|
||||
mov dword[edi+64h*4],COp64m8
|
||||
mov dword[edi+65h*4],COp65m8nd
|
||||
mov dword[edi+66h*4],COp66m8
|
||||
mov dword[edi+67h*4],COp67m8nd
|
||||
mov dword[edi+68h*4],COp68m8
|
||||
mov dword[edi+69h*4],COp69m8nd
|
||||
mov dword[edi+6Ah*4],COp6Am8
|
||||
mov dword[edi+6Bh*4],COp6B
|
||||
mov dword[edi+6Ch*4],COp6C
|
||||
mov dword[edi+6Dh*4],COp6Dm8nd
|
||||
mov dword[edi+6Eh*4],COp6Em8
|
||||
mov dword[edi+6Fh*4],COp6Fm8nd
|
||||
mov dword[edi+70h*4],COp70
|
||||
mov dword[edi+71h*4],COp71m8nd
|
||||
mov dword[edi+72h*4],COp72m8nd
|
||||
mov dword[edi+73h*4],COp73m8nd
|
||||
mov dword[edi+74h*4],COp74m8
|
||||
mov dword[edi+75h*4],COp75m8nd
|
||||
mov dword[edi+76h*4],COp76m8
|
||||
mov dword[edi+77h*4],COp77m8nd
|
||||
mov dword[edi+78h*4],COp78
|
||||
mov dword[edi+79h*4],COp79m8nd
|
||||
mov dword[edi+7Ah*4],COp7Ax8
|
||||
mov dword[edi+7Bh*4],COp7B
|
||||
mov dword[edi+7Ch*4],COp7C
|
||||
mov dword[edi+7Dh*4],COp7Dm8nd
|
||||
mov dword[edi+7Eh*4],COp7Em8
|
||||
mov dword[edi+7Fh*4],COp7Fm8nd
|
||||
mov dword[edi+80h*4],COp80
|
||||
mov dword[edi+81h*4],COp81m8
|
||||
mov dword[edi+82h*4],COp82
|
||||
mov dword[edi+83h*4],COp83m8
|
||||
mov dword[edi+84h*4],COp84x8
|
||||
mov dword[edi+85h*4],COp85m8
|
||||
mov dword[edi+86h*4],COp86x8
|
||||
mov dword[edi+87h*4],COp87m8
|
||||
mov dword[edi+88h*4],COp88x8
|
||||
mov dword[edi+89h*4],COp89m8
|
||||
mov dword[edi+8Ah*4],COp8Am8
|
||||
mov dword[edi+8Bh*4],COp8B
|
||||
mov dword[edi+8Ch*4],COp8Cx8
|
||||
mov dword[edi+8Dh*4],COp8Dm8
|
||||
mov dword[edi+8Eh*4],COp8Ex8
|
||||
mov dword[edi+8Fh*4],COp8Fm8
|
||||
mov dword[edi+90h*4],COp90
|
||||
mov dword[edi+91h*4],COp91m8
|
||||
mov dword[edi+92h*4],COp92m8
|
||||
mov dword[edi+93h*4],COp93m8
|
||||
mov dword[edi+94h*4],COp94x8
|
||||
mov dword[edi+95h*4],COp95m8
|
||||
mov dword[edi+96h*4],COp96x8
|
||||
mov dword[edi+97h*4],COp97m8
|
||||
mov dword[edi+98h*4],COp98m8
|
||||
mov dword[edi+99h*4],COp99m8
|
||||
mov dword[edi+9Ah*4],COp9A
|
||||
mov dword[edi+9Bh*4],COp9Bx8
|
||||
mov dword[edi+9Ch*4],COp9Cm8
|
||||
mov dword[edi+9Dh*4],COp9Dm8
|
||||
mov dword[edi+9Eh*4],COp9Em8
|
||||
mov dword[edi+9Fh*4],COp9Fm8
|
||||
mov dword[edi+0A0h*4],COpA0x8
|
||||
mov dword[edi+0A1h*4],COpA1m8
|
||||
mov dword[edi+0A2h*4],COpA2x8
|
||||
mov dword[edi+0A3h*4],COpA3m8
|
||||
mov dword[edi+0A4h*4],COpA4x8
|
||||
mov dword[edi+0A5h*4],COpA5m8
|
||||
mov dword[edi+0A6h*4],COpA6x8
|
||||
mov dword[edi+0A7h*4],COpA7m8
|
||||
mov dword[edi+0A8h*4],COpA8x8
|
||||
mov dword[edi+0A9h*4],COpA9m8
|
||||
mov dword[edi+0AAh*4],COpAAx8
|
||||
mov dword[edi+0ABh*4],COpAB
|
||||
mov dword[edi+0ACh*4],COpACx8
|
||||
mov dword[edi+0ADh*4],COpADm8
|
||||
mov dword[edi+0AEh*4],COpAEx8
|
||||
mov dword[edi+0AFh*4],COpAFm8
|
||||
mov dword[edi+0B0h*4],COpB0
|
||||
mov dword[edi+0B1h*4],COpB1m8
|
||||
mov dword[edi+0B2h*4],COpB2m8
|
||||
mov dword[edi+0B3h*4],COpB3m8
|
||||
mov dword[edi+0B4h*4],COpB4x8
|
||||
mov dword[edi+0B5h*4],COpB5m8
|
||||
mov dword[edi+0B6h*4],COpB6x8
|
||||
mov dword[edi+0B7h*4],COpB7m8
|
||||
mov dword[edi+0B8h*4],COpB8
|
||||
mov dword[edi+0B9h*4],COpB9m8
|
||||
mov dword[edi+0BAh*4],COpBAx8
|
||||
mov dword[edi+0BBh*4],COpBBx8
|
||||
mov dword[edi+0BCh*4],COpBCx8
|
||||
mov dword[edi+0BDh*4],COpBDm8
|
||||
mov dword[edi+0BEh*4],COpBEx8
|
||||
mov dword[edi+0BFh*4],COpBFm8
|
||||
mov dword[edi+0C0h*4],COpC0x8
|
||||
mov dword[edi+0C1h*4],COpC1m8
|
||||
mov dword[edi+0C2h*4],COpC2
|
||||
mov dword[edi+0C3h*4],COpC3m8
|
||||
mov dword[edi+0C4h*4],COpC4x8
|
||||
mov dword[edi+0C5h*4],COpC5m8
|
||||
mov dword[edi+0C6h*4],COpC6m8
|
||||
mov dword[edi+0C7h*4],COpC7m8
|
||||
mov dword[edi+0C8h*4],COpC8x8
|
||||
mov dword[edi+0C9h*4],COpC9m8
|
||||
mov dword[edi+0CAh*4],COpCAx8
|
||||
mov dword[edi+0CBh*4],COpCB
|
||||
mov dword[edi+0CCh*4],COpCCx8
|
||||
mov dword[edi+0CDh*4],COpCDm8
|
||||
mov dword[edi+0CEh*4],COpCEm8
|
||||
mov dword[edi+0CFh*4],COpCFm8
|
||||
mov dword[edi+0D0h*4],COpD0
|
||||
mov dword[edi+0D1h*4],COpD1m8
|
||||
mov dword[edi+0D2h*4],COpD2m8
|
||||
mov dword[edi+0D3h*4],COpD3m8
|
||||
mov dword[edi+0D4h*4],COpD4
|
||||
mov dword[edi+0D5h*4],COpD5m8
|
||||
mov dword[edi+0D6h*4],COpD6m8
|
||||
mov dword[edi+0D7h*4],COpD7m8
|
||||
mov dword[edi+0D8h*4],COpD8
|
||||
mov dword[edi+0D9h*4],COpD9m8
|
||||
mov dword[edi+0DAh*4],COpDAx8
|
||||
mov dword[edi+0DBh*4],COpDB
|
||||
mov dword[edi+0DCh*4],COpDC
|
||||
mov dword[edi+0DDh*4],COpDDm8
|
||||
mov dword[edi+0DEh*4],COpDEm8
|
||||
mov dword[edi+0DFh*4],COpDFm8
|
||||
mov dword[edi+0E0h*4],COpE0x8
|
||||
mov dword[edi+0E1h*4],COpE1m8nd
|
||||
mov dword[edi+0E2h*4],COpE2
|
||||
mov dword[edi+0E3h*4],COpE3m8nd
|
||||
mov dword[edi+0E4h*4],COpE4x8
|
||||
mov dword[edi+0E5h*4],COpE5m8nd
|
||||
mov dword[edi+0E6h*4],COpE6m8
|
||||
mov dword[edi+0E7h*4],COpE7m8nd
|
||||
mov dword[edi+0E8h*4],COpE8x8
|
||||
mov dword[edi+0E9h*4],COpE9m8nd
|
||||
mov dword[edi+0EAh*4],COpEA
|
||||
mov dword[edi+0EBh*4],COpEB
|
||||
mov dword[edi+0ECh*4],COpECx8
|
||||
mov dword[edi+0EDh*4],COpEDm8nd
|
||||
mov dword[edi+0EEh*4],COpEEm8
|
||||
mov dword[edi+0EFh*4],COpEFm8nd
|
||||
mov dword[edi+0F0h*4],COpF0
|
||||
mov dword[edi+0F1h*4],COpF1m8nd
|
||||
mov dword[edi+0F2h*4],COpF2m8nd
|
||||
mov dword[edi+0F3h*4],COpF3m8nd
|
||||
mov dword[edi+0F4h*4],COpF4
|
||||
mov dword[edi+0F5h*4],COpF5m8nd
|
||||
mov dword[edi+0F6h*4],COpF6m8
|
||||
mov dword[edi+0F7h*4],COpF7m8nd
|
||||
mov dword[edi+0F8h*4],COpF8
|
||||
mov dword[edi+0F9h*4],COpF9m8nd
|
||||
mov dword[edi+0FAh*4],COpFAx8
|
||||
mov dword[edi+0FBh*4],COpFB
|
||||
mov dword[edi+0FCh*4],COpFC
|
||||
mov dword[edi+0FDh*4],COpFDm8nd
|
||||
mov dword[edi+0FEh*4],COpFEm8
|
||||
mov dword[edi+0FFh*4],COpFFm8nd
|
||||
ret
|
||||
|
||||
settablem16:
|
||||
mov dword[edi+01h*4],COp01m16
|
||||
mov dword[edi+03h*4],COp03m16
|
||||
mov dword[edi+04h*4],COp04m16
|
||||
mov dword[edi+05h*4],COp05m16
|
||||
mov dword[edi+06h*4],COp06m16
|
||||
mov dword[edi+07h*4],COp07m16
|
||||
mov dword[edi+09h*4],COp09m16
|
||||
mov dword[edi+0Ah*4],COp0Am16
|
||||
mov dword[edi+0Ch*4],COp0Cm16
|
||||
mov dword[edi+0Dh*4],COp0Dm16
|
||||
mov dword[edi+0Eh*4],COp0Em16
|
||||
mov dword[edi+0Fh*4],COp0Fm16
|
||||
mov dword[edi+11h*4],COp11m16
|
||||
mov dword[edi+12h*4],COp12m16
|
||||
mov dword[edi+13h*4],COp13m16
|
||||
mov dword[edi+14h*4],COp14m16
|
||||
mov dword[edi+15h*4],COp15m16
|
||||
mov dword[edi+16h*4],COp16m16
|
||||
mov dword[edi+17h*4],COp17m16
|
||||
mov dword[edi+19h*4],COp19m16
|
||||
mov dword[edi+1Ah*4],COp1Am16
|
||||
mov dword[edi+1Ch*4],COp1Cm16
|
||||
mov dword[edi+1Dh*4],COp1Dm16
|
||||
mov dword[edi+1Eh*4],COp1Em16
|
||||
mov dword[edi+1Fh*4],COp1Fm16
|
||||
mov dword[edi+21h*4],COp21m16
|
||||
mov dword[edi+23h*4],COp23m16
|
||||
mov dword[edi+24h*4],COp24m16
|
||||
mov dword[edi+25h*4],COp25m16
|
||||
mov dword[edi+26h*4],COp26m16
|
||||
mov dword[edi+27h*4],COp27m16
|
||||
mov dword[edi+29h*4],COp29m16
|
||||
mov dword[edi+2Ah*4],COp2Am16
|
||||
mov dword[edi+2Ch*4],COp2Cm16
|
||||
mov dword[edi+2Dh*4],COp2Dm16
|
||||
mov dword[edi+2Eh*4],COp2Em16
|
||||
mov dword[edi+2Fh*4],COp2Fm16
|
||||
mov dword[edi+31h*4],COp31m16
|
||||
mov dword[edi+32h*4],COp32m16
|
||||
mov dword[edi+33h*4],COp33m16
|
||||
mov dword[edi+34h*4],COp34m16
|
||||
mov dword[edi+35h*4],COp35m16
|
||||
mov dword[edi+36h*4],COp36m16
|
||||
mov dword[edi+37h*4],COp37m16
|
||||
mov dword[edi+39h*4],COp39m16
|
||||
mov dword[edi+3Ah*4],COp3Am16
|
||||
mov dword[edi+3Ch*4],COp3Cm16
|
||||
mov dword[edi+3Dh*4],COp3Dm16
|
||||
mov dword[edi+3Eh*4],COp3Em16
|
||||
mov dword[edi+3Fh*4],COp3Fm16
|
||||
mov dword[edi+41h*4],COp41m16
|
||||
mov dword[edi+43h*4],COp43m16
|
||||
mov dword[edi+45h*4],COp45m16
|
||||
mov dword[edi+46h*4],COp46m16
|
||||
mov dword[edi+47h*4],COp47m16
|
||||
mov dword[edi+48h*4],COp48m16
|
||||
mov dword[edi+49h*4],COp49m16
|
||||
mov dword[edi+4Ah*4],COp4Am16
|
||||
mov dword[edi+4Dh*4],COp4Dm16
|
||||
mov dword[edi+4Eh*4],COp4Em16
|
||||
mov dword[edi+4Fh*4],COp4Fm16
|
||||
mov dword[edi+51h*4],COp51m16
|
||||
mov dword[edi+52h*4],COp52m16
|
||||
mov dword[edi+53h*4],COp53m16
|
||||
mov dword[edi+55h*4],COp55m16
|
||||
mov dword[edi+56h*4],COp56m16
|
||||
mov dword[edi+57h*4],COp57m16
|
||||
mov dword[edi+59h*4],COp59m16
|
||||
mov dword[edi+5Dh*4],COp5Dm16
|
||||
mov dword[edi+5Eh*4],COp5Em16
|
||||
mov dword[edi+5Fh*4],COp5Fm16
|
||||
mov dword[edi+61h*4],COp61m16nd
|
||||
mov dword[edi+63h*4],COp63m16nd
|
||||
mov dword[edi+64h*4],COp64m16
|
||||
mov dword[edi+65h*4],COp65m16nd
|
||||
mov dword[edi+66h*4],COp66m16
|
||||
mov dword[edi+67h*4],COp67m16nd
|
||||
mov dword[edi+68h*4],COp68m16
|
||||
mov dword[edi+69h*4],COp69m16nd
|
||||
mov dword[edi+6Ah*4],COp6Am16
|
||||
mov dword[edi+6Dh*4],COp6Dm16nd
|
||||
mov dword[edi+6Eh*4],COp6Em16
|
||||
mov dword[edi+6Fh*4],COp6Fm16nd
|
||||
mov dword[edi+71h*4],COp71m16nd
|
||||
mov dword[edi+72h*4],COp72m16nd
|
||||
mov dword[edi+73h*4],COp73m16nd
|
||||
mov dword[edi+74h*4],COp74m16
|
||||
mov dword[edi+75h*4],COp75m16nd
|
||||
mov dword[edi+76h*4],COp76m16
|
||||
mov dword[edi+77h*4],COp77m16nd
|
||||
mov dword[edi+79h*4],COp79m16nd
|
||||
mov dword[edi+7Dh*4],COp7Dm16nd
|
||||
mov dword[edi+7Eh*4],COp7Em16
|
||||
mov dword[edi+7Fh*4],COp7Fm16nd
|
||||
mov dword[edi+81h*4],COp81m16
|
||||
mov dword[edi+83h*4],COp83m16
|
||||
mov dword[edi+85h*4],COp85m16
|
||||
mov dword[edi+87h*4],COp87m16
|
||||
mov dword[edi+89h*4],COp89m16
|
||||
mov dword[edi+8Ah*4],COp8Am16
|
||||
mov dword[edi+8Dh*4],COp8Dm16
|
||||
mov dword[edi+8Fh*4],COp8Fm16
|
||||
mov dword[edi+91h*4],COp91m16
|
||||
mov dword[edi+92h*4],COp92m16
|
||||
mov dword[edi+93h*4],COp93m16
|
||||
mov dword[edi+95h*4],COp95m16
|
||||
mov dword[edi+97h*4],COp97m16
|
||||
mov dword[edi+98h*4],COp98m16
|
||||
mov dword[edi+99h*4],COp99m16
|
||||
mov dword[edi+9Ch*4],COp9Cm16
|
||||
mov dword[edi+9Dh*4],COp9Dm16
|
||||
mov dword[edi+9Eh*4],COp9Em16
|
||||
mov dword[edi+9Fh*4],COp9Fm16
|
||||
mov dword[edi+0A1h*4],COpA1m16
|
||||
mov dword[edi+0A3h*4],COpA3m16
|
||||
mov dword[edi+0A5h*4],COpA5m16
|
||||
mov dword[edi+0A7h*4],COpA7m16
|
||||
mov dword[edi+0A9h*4],COpA9m16
|
||||
mov dword[edi+0ADh*4],COpADm16
|
||||
mov dword[edi+0AFh*4],COpAFm16
|
||||
mov dword[edi+0B1h*4],COpB1m16
|
||||
mov dword[edi+0B2h*4],COpB2m16
|
||||
mov dword[edi+0B3h*4],COpB3m16
|
||||
mov dword[edi+0B5h*4],COpB5m16
|
||||
mov dword[edi+0B7h*4],COpB7m16
|
||||
mov dword[edi+0B9h*4],COpB9m16
|
||||
mov dword[edi+0BDh*4],COpBDm16
|
||||
mov dword[edi+0BFh*4],COpBFm16
|
||||
mov dword[edi+0C1h*4],COpC1m16
|
||||
mov dword[edi+0C3h*4],COpC3m16
|
||||
mov dword[edi+0C5h*4],COpC5m16
|
||||
mov dword[edi+0C6h*4],COpC6m16
|
||||
mov dword[edi+0C7h*4],COpC7m16
|
||||
mov dword[edi+0C9h*4],COpC9m16
|
||||
mov dword[edi+0CDh*4],COpCDm16
|
||||
mov dword[edi+0CEh*4],COpCEm16
|
||||
mov dword[edi+0CFh*4],COpCFm16
|
||||
mov dword[edi+0D1h*4],COpD1m16
|
||||
mov dword[edi+0D2h*4],COpD2m16
|
||||
mov dword[edi+0D3h*4],COpD3m16
|
||||
mov dword[edi+0D5h*4],COpD5m16
|
||||
mov dword[edi+0D6h*4],COpD6m16
|
||||
mov dword[edi+0D7h*4],COpD7m16
|
||||
mov dword[edi+0D9h*4],COpD9m16
|
||||
mov dword[edi+0DDh*4],COpDDm16
|
||||
mov dword[edi+0DEh*4],COpDEm16
|
||||
mov dword[edi+0DFh*4],COpDFm16
|
||||
mov dword[edi+0E1h*4],COpE1m16nd
|
||||
mov dword[edi+0E3h*4],COpE3m16nd
|
||||
mov dword[edi+0E5h*4],COpE5m16nd
|
||||
mov dword[edi+0E6h*4],COpE6m16
|
||||
mov dword[edi+0E7h*4],COpE7m16nd
|
||||
mov dword[edi+0E9h*4],COpE9m16nd
|
||||
mov dword[edi+0EDh*4],COpEDm16nd
|
||||
mov dword[edi+0EEh*4],COpEEm16
|
||||
mov dword[edi+0EFh*4],COpEFm16nd
|
||||
mov dword[edi+0F1h*4],COpF1m16nd
|
||||
mov dword[edi+0F2h*4],COpF2m16nd
|
||||
mov dword[edi+0F3h*4],COpF3m16nd
|
||||
mov dword[edi+0F5h*4],COpF5m16nd
|
||||
mov dword[edi+0F6h*4],COpF6m16
|
||||
mov dword[edi+0F7h*4],COpF7m16nd
|
||||
mov dword[edi+0F9h*4],COpF9m16nd
|
||||
mov dword[edi+0FDh*4],COpFDm16nd
|
||||
mov dword[edi+0FEh*4],COpFEm16
|
||||
mov dword[edi+0FFh*4],COpFFm16nd
|
||||
ret
|
||||
|
||||
settablex16:
|
||||
mov dword[edi+5Ah*4],COp5Ax16
|
||||
mov dword[edi+7Ah*4],COp7Ax16
|
||||
mov dword[edi+84h*4],COp84x16
|
||||
mov dword[edi+86h*4],COp86x16
|
||||
mov dword[edi+88h*4],COp88x16
|
||||
mov dword[edi+8Ch*4],COp8Cx16
|
||||
mov dword[edi+8Eh*4],COp8Ex16
|
||||
mov dword[edi+94h*4],COp94x16
|
||||
mov dword[edi+96h*4],COp96x16
|
||||
mov dword[edi+9Bh*4],COp9Bx16
|
||||
mov dword[edi+0A0h*4],COpA0x16
|
||||
mov dword[edi+0A2h*4],COpA2x16
|
||||
mov dword[edi+0A4h*4],COpA4x16
|
||||
mov dword[edi+0A6h*4],COpA6x16
|
||||
mov dword[edi+0A8h*4],COpA8x16
|
||||
mov dword[edi+0AAh*4],COpAAx16
|
||||
mov dword[edi+0ACh*4],COpACx16
|
||||
mov dword[edi+0AEh*4],COpAEx16
|
||||
mov dword[edi+0B4h*4],COpB4x16
|
||||
mov dword[edi+0B6h*4],COpB6x16
|
||||
mov dword[edi+0BAh*4],COpBAx16
|
||||
mov dword[edi+0BBh*4],COpBBx16
|
||||
mov dword[edi+0BCh*4],COpBCx16
|
||||
mov dword[edi+0BEh*4],COpBEx16
|
||||
mov dword[edi+0C0h*4],COpC0x16
|
||||
mov dword[edi+0C4h*4],COpC4x16
|
||||
mov dword[edi+0C8h*4],COpC8x16
|
||||
mov dword[edi+0CAh*4],COpCAx16
|
||||
mov dword[edi+0CCh*4],COpCCx16
|
||||
mov dword[edi+0DAh*4],COpDAx16
|
||||
mov dword[edi+0E0h*4],COpE0x16
|
||||
mov dword[edi+0E4h*4],COpE4x16
|
||||
mov dword[edi+0E8h*4],COpE8x16
|
||||
mov dword[edi+0ECh*4],COpECx16
|
||||
mov dword[edi+0FAh*4],COpFAx16
|
||||
ret
|
||||
|
||||
settableDm8:
|
||||
mov dword[edi+61h*4],COp61m8d
|
||||
mov dword[edi+63h*4],COp63m8d
|
||||
mov dword[edi+65h*4],COp65m8d
|
||||
mov dword[edi+67h*4],COp67m8d
|
||||
mov dword[edi+69h*4],COp69m8d
|
||||
mov dword[edi+6Dh*4],COp6Dm8d
|
||||
mov dword[edi+6Fh*4],COp6Fm8d
|
||||
mov dword[edi+71h*4],COp71m8d
|
||||
mov dword[edi+72h*4],COp72m8d
|
||||
mov dword[edi+73h*4],COp73m8d
|
||||
mov dword[edi+75h*4],COp75m8d
|
||||
mov dword[edi+77h*4],COp77m8d
|
||||
mov dword[edi+79h*4],COp79m8d
|
||||
mov dword[edi+7Dh*4],COp7Dm8d
|
||||
mov dword[edi+7Fh*4],COp7Fm8d
|
||||
mov dword[edi+0E1h*4],COpE1m8d
|
||||
mov dword[edi+0E3h*4],COpE3m8d
|
||||
mov dword[edi+0E5h*4],COpE5m8d
|
||||
mov dword[edi+0E7h*4],COpE7m8d
|
||||
mov dword[edi+0E9h*4],COpE9m8d
|
||||
mov dword[edi+0EDh*4],COpEDm8d
|
||||
mov dword[edi+0EFh*4],COpEFm8d
|
||||
mov dword[edi+0F1h*4],COpF1m8d
|
||||
mov dword[edi+0F2h*4],COpF2m8d
|
||||
mov dword[edi+0F3h*4],COpF3m8d
|
||||
mov dword[edi+0F5h*4],COpF5m8d
|
||||
mov dword[edi+0F7h*4],COpF7m8d
|
||||
mov dword[edi+0F9h*4],COpF9m8d
|
||||
mov dword[edi+0FDh*4],COpFDm8d
|
||||
mov dword[edi+0FFh*4],COpFFm8d
|
||||
ret
|
||||
|
||||
settableDm16:
|
||||
mov dword[edi+61h*4],COp61m16d
|
||||
mov dword[edi+63h*4],COp63m16d
|
||||
mov dword[edi+65h*4],COp65m16d
|
||||
mov dword[edi+67h*4],COp67m16d
|
||||
mov dword[edi+69h*4],COp69m16d
|
||||
mov dword[edi+6Dh*4],COp6Dm16d
|
||||
mov dword[edi+6Fh*4],COp6Fm16d
|
||||
mov dword[edi+71h*4],COp71m16d
|
||||
mov dword[edi+72h*4],COp72m16d
|
||||
mov dword[edi+73h*4],COp73m16d
|
||||
mov dword[edi+75h*4],COp75m16d
|
||||
mov dword[edi+77h*4],COp77m16d
|
||||
mov dword[edi+79h*4],COp79m16d
|
||||
mov dword[edi+7Dh*4],COp7Dm16d
|
||||
mov dword[edi+7Fh*4],COp7Fm16d
|
||||
mov dword[edi+0E1h*4],COpE1m16d
|
||||
mov dword[edi+0E3h*4],COpE3m16d
|
||||
mov dword[edi+0E5h*4],COpE5m16d
|
||||
mov dword[edi+0E7h*4],COpE7m16d
|
||||
mov dword[edi+0E9h*4],COpE9m16d
|
||||
mov dword[edi+0EDh*4],COpEDm16d
|
||||
mov dword[edi+0EFh*4],COpEFm16d
|
||||
mov dword[edi+0F1h*4],COpF1m16d
|
||||
mov dword[edi+0F2h*4],COpF2m16d
|
||||
mov dword[edi+0F3h*4],COpF3m16d
|
||||
mov dword[edi+0F5h*4],COpF5m16d
|
||||
mov dword[edi+0F7h*4],COpF7m16d
|
||||
mov dword[edi+0F9h*4],COpF9m16d
|
||||
mov dword[edi+0FDh*4],COpFDm16d
|
||||
mov dword[edi+0FFh*4],COpFFm16d
|
||||
ret
|
||||
|
||||
|
||||
3849
zsnes/src/dos/debug.asm
Normal file
3849
zsnes/src/dos/debug.asm
Normal file
File diff suppressed because it is too large
Load Diff
1821
zsnes/src/dos/dosintrf.asm
Normal file
1821
zsnes/src/dos/dosintrf.asm
Normal file
File diff suppressed because it is too large
Load Diff
156
zsnes/src/dos/gppro.asm
Normal file
156
zsnes/src/dos/gppro.asm
Normal file
@@ -0,0 +1,156 @@
|
||||
;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"
|
||||
|
||||
section .data
|
||||
sample times 60 db 0
|
||||
clock_mask db 0
|
||||
data_mask db 0
|
||||
|
||||
section .text
|
||||
|
||||
NEWSYM read_gpp
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push edi
|
||||
push esi
|
||||
|
||||
cmp al,0
|
||||
jne GPP_L14
|
||||
mov byte [clock_mask],0x10
|
||||
mov byte [data_mask],0x20
|
||||
jmp GPP_L15
|
||||
GPP_L14:
|
||||
mov byte [clock_mask],0x40
|
||||
mov byte [data_mask],0x80
|
||||
GPP_L15:
|
||||
|
||||
|
||||
xor ebx,ebx
|
||||
xor edi,edi
|
||||
|
||||
cli
|
||||
in al,dx
|
||||
mov ah,al
|
||||
|
||||
GPP_L4:
|
||||
xor ecx,ecx
|
||||
GPP_L0:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
in al,dx
|
||||
cmp al,ah
|
||||
jne GPP_L1
|
||||
inc ecx
|
||||
cmp ecx,255
|
||||
jl GPP_L0
|
||||
GPP_L1:
|
||||
cmp ecx,255
|
||||
je near GPP_ERR
|
||||
|
||||
test [clock_mask],ah
|
||||
jz GPP_L2
|
||||
test [clock_mask],al
|
||||
jnz GPP_L2
|
||||
|
||||
test [data_mask],al
|
||||
jz GPP_L3
|
||||
mov byte [sample+edi],1
|
||||
jmp GPP_L12
|
||||
GPP_L3:
|
||||
mov byte [sample+edi],0
|
||||
GPP_L12:
|
||||
inc edi
|
||||
|
||||
GPP_L2:
|
||||
mov ah,al
|
||||
cmp ebx,200
|
||||
je GPP_L13
|
||||
inc ebx
|
||||
cmp edi,50
|
||||
jl GPP_L4
|
||||
|
||||
GPP_L13:
|
||||
sti
|
||||
xor ecx,ecx
|
||||
mov esi,1
|
||||
GPP_L7:
|
||||
cmp byte [sample+esi],1
|
||||
jg GPP_ERR
|
||||
jne GPP_L6
|
||||
inc ecx
|
||||
jmp GPP_L5
|
||||
GPP_L6:
|
||||
xor ecx,ecx
|
||||
|
||||
GPP_L5:
|
||||
cmp ecx,5
|
||||
je GPP_L8
|
||||
cmp esi,edi
|
||||
je GPP_L8
|
||||
inc esi
|
||||
jmp GPP_L7
|
||||
|
||||
GPP_L8:
|
||||
cmp ecx,5
|
||||
jne GPP_ERR
|
||||
add esi,2
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
|
||||
GPP_L10:
|
||||
inc ecx
|
||||
cmp ecx,5
|
||||
jne GPP_L11
|
||||
mov ecx,1
|
||||
inc esi
|
||||
GPP_L11:
|
||||
mov dl,[sample+esi]
|
||||
or eax,edx
|
||||
shl eax,1
|
||||
cmp ebx,13
|
||||
je GPP_L9
|
||||
inc ebx
|
||||
inc esi
|
||||
jmp GPP_L10
|
||||
|
||||
GPP_L9:
|
||||
pop esi
|
||||
pop edi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
GPP_ERR:
|
||||
sti
|
||||
pop esi
|
||||
pop edi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
mov eax,1
|
||||
ret
|
||||
|
||||
621
zsnes/src/dos/initvid.asm
Normal file
621
zsnes/src/dos/initvid.asm
Normal file
@@ -0,0 +1,621 @@
|
||||
;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 AddSub256,InitVesa2,cbitmode,cvidmode,makepal
|
||||
EXTSYM scanlines,selcA000,vesa2_bits,vesa2_bpos,vesa2_clbit
|
||||
EXTSYM vesa2_gpos,vesa2_rpos,vesa2_usbit,vesa2_x,vesa2_y
|
||||
EXTSYM vesa2selec,InitVesa12,videotroub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM clearfilter, dw 0
|
||||
NEWSYM res640, db 0
|
||||
NEWSYM res480, db 0
|
||||
|
||||
NEWSYM dosinitvideo2
|
||||
jmp dosinitvideo.noaddsub
|
||||
|
||||
;*******************************************************
|
||||
; InitVideo
|
||||
;*******************************************************
|
||||
NEWSYM dosinitvideo
|
||||
mov byte[cbitmode],0
|
||||
mov byte[res640],0
|
||||
mov byte[res480],0
|
||||
cmp byte[cvidmode],0
|
||||
je near .initmodex
|
||||
cmp byte[cvidmode],1
|
||||
je near .initmodeq
|
||||
cmp byte[cvidmode],2
|
||||
je near .initvesa2320x240x8
|
||||
cmp byte[cvidmode],3
|
||||
je near .initvesa2320x240x16
|
||||
cmp byte[cvidmode],4
|
||||
je near .initvesa2640x480x8
|
||||
cmp byte[cvidmode],5
|
||||
je near .initvesa2640x480x16
|
||||
cmp byte[cvidmode],6
|
||||
je near .initvesa2512x384x8
|
||||
cmp byte[cvidmode],7
|
||||
je near .initvesa2512x384x16
|
||||
cmp byte[cvidmode],8
|
||||
je near .initvesa12640x480x16
|
||||
cmp byte[cvidmode],9
|
||||
je near .initvesa2320x480x8
|
||||
cmp byte[cvidmode],10
|
||||
je near .initvesa2320x480x16
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeX Sets up 320x240 unchained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodex
|
||||
mov byte[cbitmode],0
|
||||
mov ax,0013h
|
||||
int 10h
|
||||
|
||||
mov dx,03C4h
|
||||
mov ax,0604h
|
||||
out dx,ax
|
||||
mov dx,03D4h
|
||||
mov ax,0E317h
|
||||
out dx,ax
|
||||
mov ax,0014h
|
||||
out dx,ax
|
||||
mov dx,03C4h
|
||||
mov ax,0F02h
|
||||
out dx,ax
|
||||
|
||||
mov dx,03C2h
|
||||
mov al,0E3h
|
||||
out dx,al
|
||||
mov dx,03D4h
|
||||
mov ax,2C11h
|
||||
out dx,ax
|
||||
mov ax,0D06h
|
||||
out dx,ax
|
||||
mov ax,3E07h
|
||||
out dx,ax
|
||||
mov ax,0EA10h
|
||||
out dx,ax
|
||||
mov ax,0AC11h
|
||||
out dx,ax
|
||||
mov ax,0DF12h
|
||||
out dx,ax
|
||||
mov ax,0E715h
|
||||
out dx,ax
|
||||
mov ax,0616h
|
||||
out dx,ax
|
||||
|
||||
mov dx,03C6h
|
||||
mov al,0FFh
|
||||
out dx,al
|
||||
mov dx,03C4h
|
||||
; select all 4 planes and clear
|
||||
mov ax,0F02h
|
||||
out dx,ax
|
||||
push es
|
||||
mov ax,[selcA000]
|
||||
mov es,ax
|
||||
xor edi,edi
|
||||
mov ecx,65536/4
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
pop es
|
||||
call makepal
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitModeQ Sets up 256x256 chained mode
|
||||
;*******************************************************
|
||||
|
||||
.initmodeq
|
||||
mov byte[cbitmode],0
|
||||
cmp byte[AddSub256],1
|
||||
jne .noaddsub
|
||||
mov byte[cbitmode],1
|
||||
.noaddsub
|
||||
mov byte[vesa2_rpos],11 ; Red bit position 128,256,512,1024,2048
|
||||
mov byte[vesa2_gpos],6 ; Green bit position 2^6 = 64
|
||||
mov byte[vesa2_bpos],0 ; Blue bit position
|
||||
mov word[vesa2_usbit],0020h ; Unused bit in proper bit location
|
||||
mov word[vesa2_clbit],0F7DFh ; clear all bit 0's if AND is used
|
||||
mov word[clearfilter],0F7DFh ; Filter out unnecessary bits
|
||||
|
||||
cmp byte[scanlines],1
|
||||
je near .scanlines
|
||||
mov ax,0013h
|
||||
int 10h
|
||||
mov dx,03D4h
|
||||
mov al,11h
|
||||
out dx,al
|
||||
|
||||
inc dx
|
||||
in al,dx
|
||||
and al,7Fh
|
||||
mov ah,al
|
||||
dec dx
|
||||
mov al,11h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
mov dx,03C2h
|
||||
mov al,0E3h
|
||||
out dx,al
|
||||
mov dx,03D4h
|
||||
mov ax,5F00h
|
||||
out dx,ax
|
||||
mov ax,3F01h
|
||||
out dx,ax
|
||||
mov ax,4002h
|
||||
out dx,ax
|
||||
mov ax,8203h
|
||||
out dx,ax
|
||||
mov ax,4A04h
|
||||
out dx,ax
|
||||
mov ax,9A05h
|
||||
out dx,ax
|
||||
mov ax,2306h
|
||||
out dx,ax
|
||||
mov ax,0B207h
|
||||
out dx,ax
|
||||
mov ax,0008h
|
||||
out dx,ax
|
||||
mov ax,6109h
|
||||
out dx,ax
|
||||
mov ax,0A10h
|
||||
out dx,ax
|
||||
mov ax,0AC11h
|
||||
out dx,ax
|
||||
mov ax,0FF12h
|
||||
out dx,ax
|
||||
mov ax,2013h
|
||||
out dx,ax
|
||||
mov ax,4014h
|
||||
out dx,ax
|
||||
mov ax,0715h
|
||||
out dx,ax
|
||||
mov ax,1A16h
|
||||
out dx,ax
|
||||
mov ax,0A317h
|
||||
out dx,ax
|
||||
mov dx,03C4h
|
||||
mov ax,0101h
|
||||
out dx,ax
|
||||
mov ax,0E04h
|
||||
out dx,ax
|
||||
mov dx,03CEh
|
||||
mov ax,4005h
|
||||
out dx,ax
|
||||
mov ax,0506h
|
||||
out dx,ax
|
||||
|
||||
mov dx,03DAh
|
||||
in al,dx
|
||||
mov dx,03C0h
|
||||
mov al,30h
|
||||
out dx,al
|
||||
mov al,41h
|
||||
out dx,al
|
||||
|
||||
mov dx,03DAh
|
||||
in al,dx
|
||||
mov dx,03C0h
|
||||
mov al,33h
|
||||
out dx,al
|
||||
mov al,0h
|
||||
out dx,al
|
||||
|
||||
mov dx,03C6h
|
||||
mov al,0FFh
|
||||
out dx,al
|
||||
cmp byte[cbitmode],1
|
||||
je .nopal
|
||||
call makepal
|
||||
.nopal
|
||||
; clear screen
|
||||
push es
|
||||
mov ax,[selcA000]
|
||||
mov es,ax
|
||||
xor edi,edi
|
||||
mov ecx,256*64
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
pop es
|
||||
ret
|
||||
|
||||
.scanlines
|
||||
mov ax,0013h
|
||||
int 10h
|
||||
mov dx,03D4h
|
||||
mov al,11h
|
||||
out dx,al
|
||||
|
||||
inc dx
|
||||
in al,dx
|
||||
and al,7Fh
|
||||
mov ah,al
|
||||
dec dx
|
||||
mov al,11h
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
mov dx,03C2h
|
||||
mov al,0E3h
|
||||
out dx,al
|
||||
mov dx,03D4h
|
||||
mov ax,5F00h
|
||||
out dx,ax
|
||||
mov ax,3F01h
|
||||
out dx,ax
|
||||
mov ax,4002h
|
||||
out dx,ax
|
||||
mov ax,8203h
|
||||
out dx,ax
|
||||
mov ax,4A04h
|
||||
out dx,ax
|
||||
mov ax,9A05h
|
||||
out dx,ax
|
||||
mov ax,2306h
|
||||
out dx,ax
|
||||
mov ax,01D07h
|
||||
out dx,ax
|
||||
mov ax,0008h
|
||||
out dx,ax
|
||||
mov ax,6009h
|
||||
out dx,ax
|
||||
mov ax,0A10h
|
||||
out dx,ax
|
||||
mov ax,0AC11h
|
||||
out dx,ax
|
||||
mov ax,0FF12h
|
||||
out dx,ax
|
||||
mov ax,2013h
|
||||
out dx,ax
|
||||
mov ax,4014h
|
||||
out dx,ax
|
||||
mov ax,0715h
|
||||
out dx,ax
|
||||
mov ax,1A16h
|
||||
out dx,ax
|
||||
mov ax,0A317h
|
||||
out dx,ax
|
||||
mov dx,03C4h
|
||||
mov ax,0101h
|
||||
out dx,ax
|
||||
mov ax,0E04h
|
||||
out dx,ax
|
||||
mov dx,03CEh
|
||||
mov ax,4005h
|
||||
out dx,ax
|
||||
mov ax,0506h
|
||||
out dx,ax
|
||||
|
||||
mov dx,03DAh
|
||||
in al,dx
|
||||
mov dx,03C0h
|
||||
mov al,30h
|
||||
out dx,al
|
||||
mov al,41h
|
||||
out dx,al
|
||||
|
||||
mov dx,03DAh
|
||||
in al,dx
|
||||
mov dx,03C0h
|
||||
mov al,33h
|
||||
out dx,al
|
||||
mov al,0h
|
||||
out dx,al
|
||||
|
||||
mov dx,03C6h
|
||||
mov al,0FFh
|
||||
out dx,al
|
||||
cmp byte[cbitmode],1
|
||||
je .nopalb
|
||||
call makepal
|
||||
.nopalb
|
||||
; clear screen
|
||||
push es
|
||||
mov ax,[selcA000]
|
||||
mov es,ax
|
||||
xor edi,edi
|
||||
mov ecx,256*64
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x240x8 Set up Linear 320x240x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x240x8
|
||||
mov byte[cbitmode],0
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],240
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble
|
||||
ret
|
||||
.notrouble
|
||||
call makepal
|
||||
; clear screen (320*240 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*240
|
||||
.loop
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loop
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x240x16 Set up Linear 320x240x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x240x16
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],240
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble2
|
||||
ret
|
||||
.notrouble2
|
||||
; clear screen (320*240*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*240*2
|
||||
.loopb
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopb
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x480x8 Set up Linear 640x480x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x480x8
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble3
|
||||
ret
|
||||
.notrouble3
|
||||
call makepal
|
||||
; clear screen (640*480 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*480
|
||||
.loopc3
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopc3
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 640x480x16 Set up Linear 640x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2640x480x16
|
||||
mov byte[res640],1
|
||||
mov byte[res480],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble4
|
||||
ret
|
||||
.notrouble4
|
||||
; clear screen (640*480*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,640*480*2
|
||||
.loopd3
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopd3
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x480x8 Set up Linear 320x480x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x480x8
|
||||
mov byte[res480],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble5
|
||||
ret
|
||||
.notrouble5
|
||||
call makepal
|
||||
; clear screen (320*480 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*480
|
||||
.loopc
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopc
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 320x480x16 Set up Linear 320x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2320x480x16
|
||||
mov byte[res480],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],320
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble6
|
||||
ret
|
||||
.notrouble6
|
||||
; clear screen (320*480*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,320*480*2
|
||||
.loopd
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopd
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 512x384x8 Set up Linear 512x384x8b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2512x384x8
|
||||
mov byte[res640],2
|
||||
mov word[vesa2_x],512
|
||||
mov word[vesa2_y],384
|
||||
mov byte[vesa2_bits],8
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble7
|
||||
ret
|
||||
.notrouble7
|
||||
call makepal
|
||||
; clear screen (512*384 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,512*384
|
||||
.loope
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loope
|
||||
pop es
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA2 512x384x16 Set up Linear 512x384x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa2512x384x16
|
||||
mov byte[res640],2
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],512
|
||||
mov word[vesa2_y],384
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa2
|
||||
cmp byte[videotroub],1
|
||||
jne .notrouble8
|
||||
ret
|
||||
.notrouble8
|
||||
; clear screen (512*384*2 bytes)
|
||||
push es
|
||||
mov ax,[vesa2selec]
|
||||
mov es,ax
|
||||
mov edi,0
|
||||
mov ecx,512*384*2
|
||||
.loopf
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopf
|
||||
pop es
|
||||
ret
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; InitVESA1.2 640x480x16 Set up 640x480x16b
|
||||
;*******************************************************
|
||||
|
||||
.initvesa12640x480x16
|
||||
mov byte[res640],1
|
||||
mov byte[cbitmode],1
|
||||
mov word[vesa2_x],640
|
||||
mov word[vesa2_y],480
|
||||
mov byte[vesa2_bits],16
|
||||
call InitVesa12
|
||||
ret
|
||||
|
||||
; clear screen (640*480*2 bytes)
|
||||
push es
|
||||
mov ax,[selcA000]
|
||||
mov es,ax
|
||||
mov ebx,9
|
||||
xor edx,edx
|
||||
.loopbanks
|
||||
|
||||
xor edi,edi
|
||||
mov ecx,16384
|
||||
.loopg
|
||||
mov byte[es:edi],0
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loopg
|
||||
dec ebx
|
||||
jnz .loopbanks
|
||||
|
||||
mov ecx,6144
|
||||
pop es
|
||||
ret
|
||||
|
||||
|
||||
1617
zsnes/src/dos/joy.asm
Normal file
1617
zsnes/src/dos/joy.asm
Normal file
File diff suppressed because it is too large
Load Diff
437
zsnes/src/dos/modemrtn.asm
Normal file
437
zsnes/src/dos/modemrtn.asm
Normal file
@@ -0,0 +1,437 @@
|
||||
;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 ComNum, ComIRQ, BaudRate
|
||||
EXTSYM dssel,FossilUse
|
||||
EXTSYM GUIinit18_2hz,GUIinit36_4hz
|
||||
EXTSYM GUIMenuItem
|
||||
EXTSYM delay
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM UartType, db 0
|
||||
NEWSYM cantinitmodem, db 1
|
||||
NEWSYM ModemInited, db 0
|
||||
|
||||
ComPort dw 2E8h ; 1=3F8,2=2F8,3=3E8,4=2E8
|
||||
PortData dw 0,3F8h,2F8h,3E8h,2E8h
|
||||
ComInt db 0
|
||||
BRateSel dw 000Ch,0008h,0006h,0004h,0003h,0002h,0001h
|
||||
oldhandmodems dw 0
|
||||
oldhandmodemo dd 0
|
||||
PICMaskPm db 21h
|
||||
PortNum dw 0
|
||||
CharStore db 0
|
||||
|
||||
NEWSYM ModemGetChar
|
||||
cmp byte[UartType],2
|
||||
je near FossilGetChar
|
||||
xor dh,dh
|
||||
mov eax,[modemhead]
|
||||
cmp eax,[modemtail]
|
||||
je .nonewchar
|
||||
mov dh,1
|
||||
mov dl,[modembuffer+eax]
|
||||
inc dword[modemhead]
|
||||
and dword[modemhead],2047
|
||||
.nonewchar
|
||||
ret
|
||||
|
||||
FossilGetChar:
|
||||
pushad
|
||||
mov ah,0Ch
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
cmp ax,0FFFFh
|
||||
je .nochar
|
||||
mov ah,02h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
mov [CharStore],al
|
||||
popad
|
||||
mov dh,1
|
||||
mov dl,[CharStore]
|
||||
ret
|
||||
.nochar
|
||||
popad
|
||||
xor dh,dh
|
||||
ret
|
||||
|
||||
NEWSYM ModemCheckRing
|
||||
cmp byte[UartType],2
|
||||
je near .fossil
|
||||
mov dx,[ComPort]
|
||||
add dx,6
|
||||
in al,dx
|
||||
shr al,6
|
||||
and al,01h
|
||||
ret
|
||||
.fossil
|
||||
pushad
|
||||
mov ah,03h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
test al,40h
|
||||
jnz .ring
|
||||
popad
|
||||
xor al,al
|
||||
ret
|
||||
.ring
|
||||
popad
|
||||
mov al,1
|
||||
ret
|
||||
|
||||
NEWSYM ModemCheckDCD
|
||||
cmp byte[UartType],2
|
||||
je near .fossil
|
||||
mov dx,[ComPort]
|
||||
add dx,6
|
||||
in al,dx
|
||||
shr al,7
|
||||
and al,01h
|
||||
ret
|
||||
.fossil
|
||||
pushad
|
||||
mov ah,03h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
test al,80h
|
||||
jnz .dcd
|
||||
popad
|
||||
xor al,al
|
||||
ret
|
||||
.dcd
|
||||
popad
|
||||
mov al,1
|
||||
ret
|
||||
|
||||
NEWSYM ModemSendChar
|
||||
cmp byte[UartType],2
|
||||
je near FossilSendChar
|
||||
push ecx
|
||||
push edx
|
||||
push ebx
|
||||
mov ecx,1000000
|
||||
mov bl,al
|
||||
.loop
|
||||
mov dx,[ComPort]
|
||||
add dx,5
|
||||
in al,dx
|
||||
test al,00100000b
|
||||
jnz .transokay
|
||||
loop .loop
|
||||
xor al,al
|
||||
pop ebx
|
||||
pop edx
|
||||
pop ecx
|
||||
ret
|
||||
.transokay
|
||||
mov al,bl
|
||||
mov dx,[ComPort] ; Send the char through the modem
|
||||
out dx,al
|
||||
pop ebx
|
||||
pop edx
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
FossilSendChar:
|
||||
pushad
|
||||
mov ah,01h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
NEWSYM InitModem
|
||||
mov byte[ModemInited],1
|
||||
cmp byte[FossilUse],0
|
||||
jne near InitFossil
|
||||
mov byte[cantinitmodem],0
|
||||
cli
|
||||
; Get Port value
|
||||
xor eax,eax
|
||||
mov al,[ComNum]
|
||||
mov ax,[PortData+eax*2]
|
||||
mov [ComPort],ax
|
||||
|
||||
mov dx,[ComPort]
|
||||
add dx,2
|
||||
xor al,al
|
||||
out dx,al
|
||||
|
||||
; Set IRQ PIC Mask Port
|
||||
mov byte[PICMaskPm],21h
|
||||
mov bl,[ComIRQ]
|
||||
cmp bl,7
|
||||
jbe .noupper
|
||||
add bl,60h
|
||||
add byte[PICMaskPm],80h
|
||||
.noupper
|
||||
add bl,8
|
||||
mov [ComInt],bl
|
||||
|
||||
; Get IRQ handler
|
||||
mov ax,204h
|
||||
mov bl,[ComInt]
|
||||
int 31h
|
||||
mov [oldhandmodems],cx
|
||||
mov [oldhandmodemo],edx
|
||||
; Set IRQ handler
|
||||
mov ax,205h
|
||||
mov bl,[ComInt]
|
||||
mov cx,cs
|
||||
mov edx,modemhandler
|
||||
int 31h
|
||||
|
||||
mov dx,[ComPort]
|
||||
add dx,3
|
||||
mov al,00000011b
|
||||
out dx,al
|
||||
|
||||
; Set Normal Modem functioning, User2 bit, and DTR
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
mov al,00001011b
|
||||
out dx,al
|
||||
|
||||
; Enable IRQ
|
||||
xor dh,dh
|
||||
mov dl,[PICMaskPm] ; Output to IRQ PIC Mask Port
|
||||
mov cl,[ComIRQ] ; Get proper bit
|
||||
and cl,07h
|
||||
mov al,01h
|
||||
shl al,cl
|
||||
not al ; Complement since clear bit = enable
|
||||
mov bl,al
|
||||
in al,dx ; input to preserve other bits
|
||||
and al,bl
|
||||
xor al,al
|
||||
out dx,al
|
||||
|
||||
; Enable interrupt to execute only on data available
|
||||
mov dx,[ComPort]
|
||||
inc dx
|
||||
mov al,00000001b
|
||||
out dx,al
|
||||
sti
|
||||
|
||||
; Write baudrate
|
||||
mov dx,[ComPort]
|
||||
add dx,3
|
||||
in al,dx
|
||||
or al,10000000b
|
||||
out dx,al
|
||||
mov eax,[BaudRate]
|
||||
mov ax,[BRateSel+eax*2]
|
||||
mov dx,[ComPort]
|
||||
inc dx
|
||||
push eax
|
||||
mov al,ah
|
||||
out dx,al
|
||||
pop eax
|
||||
dec dx
|
||||
out dx,al
|
||||
mov dx,[ComPort]
|
||||
add dx,3
|
||||
in al,dx
|
||||
and al,01111111b
|
||||
out dx,al
|
||||
|
||||
; Initialize 16550A UART chip
|
||||
mov dx,[ComPort]
|
||||
add dx,2
|
||||
mov al,0C7h
|
||||
out dx,al
|
||||
nop
|
||||
nop
|
||||
in al,dx
|
||||
mov byte[UartType],1
|
||||
test al,40h
|
||||
jnz .passed16550a
|
||||
xor al,al
|
||||
out dx,al
|
||||
mov byte[UartType],0
|
||||
.passed16550a
|
||||
ret
|
||||
|
||||
InitFossil:
|
||||
xor edx,edx
|
||||
mov dl,[ComNum]
|
||||
dec dl
|
||||
mov [PortNum],dx
|
||||
mov byte[cantinitmodem],0
|
||||
mov byte[UartType],2
|
||||
mov ah,04h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
cmp ax,1954h
|
||||
jne .notsuccess
|
||||
xor ah,ah
|
||||
mov al,00000011b ; 19200 baud, 81N
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
ret
|
||||
.notsuccess
|
||||
mov byte[cantinitmodem],1
|
||||
ret
|
||||
|
||||
modemhandler:
|
||||
push ds
|
||||
push eax
|
||||
mov ax,[cs:dssel]
|
||||
mov ds,ax
|
||||
push edx
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
in al,dx
|
||||
and al,11111101b
|
||||
out dx,al
|
||||
|
||||
.next
|
||||
mov dx,[ComPort]
|
||||
in al,dx
|
||||
mov edx,[modemtail]
|
||||
mov [modembuffer+edx],al
|
||||
inc dword[modemtail]
|
||||
and dword[modemtail],2047
|
||||
mov dx,[ComPort]
|
||||
add dx,2
|
||||
in al,dx
|
||||
test al,1
|
||||
jz .next
|
||||
|
||||
mov al,20h
|
||||
out 20h,al
|
||||
|
||||
cmp byte[ComIRQ],7
|
||||
jbe .nohighirq
|
||||
mov al,20h
|
||||
out 0A0h,al
|
||||
.nohighirq
|
||||
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
in al,dx
|
||||
or al,00000010b
|
||||
out dx,al
|
||||
|
||||
pop edx
|
||||
pop eax
|
||||
pop ds
|
||||
iretd
|
||||
|
||||
NEWSYM ModemClearBuffer
|
||||
mov dword[modemhead],0
|
||||
mov dword[modemtail],0
|
||||
ret
|
||||
|
||||
NEWSYM modembuffer, times 2048 db 0
|
||||
NEWSYM modemhead, dd 0
|
||||
NEWSYM modemtail, dd 0
|
||||
|
||||
NEWSYM DeInitModem
|
||||
cmp byte[ModemInited],1
|
||||
je .okaydeinit
|
||||
ret
|
||||
.okaydeinit
|
||||
mov byte[ModemInited],0
|
||||
cmp byte[UartType],2
|
||||
je near DeInitFossil
|
||||
cli
|
||||
mov dx,[ComPort]
|
||||
add dx,2
|
||||
xor al,al
|
||||
out dx,al
|
||||
|
||||
xor dh,dh
|
||||
mov dl,[PICMaskPm]
|
||||
mov cl,[ComIRQ]
|
||||
and cl,07h
|
||||
mov al,01h
|
||||
shl al,cl
|
||||
mov bl,al
|
||||
in al,dx
|
||||
or al,bl
|
||||
xor al,al
|
||||
out dx,al
|
||||
mov dx,[ComPort]
|
||||
inc dx
|
||||
mov al,00h
|
||||
out dx,al
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
out dx,al
|
||||
|
||||
mov cx,[oldhandmodems]
|
||||
mov edx,[oldhandmodemo]
|
||||
mov ax,205h
|
||||
mov bl,[ComInt]
|
||||
int 31h
|
||||
sti
|
||||
ret
|
||||
|
||||
DeInitFossil:
|
||||
mov byte[cantinitmodem],0
|
||||
jne .nodeinit
|
||||
mov ax,0600h
|
||||
mov dx,[PortNum]
|
||||
int 14h ; Lower DTR
|
||||
mov ah,05h
|
||||
mov dx,[PortNum]
|
||||
int 14h
|
||||
.nodeinit
|
||||
ret
|
||||
|
||||
NEWSYM DeInitModemC
|
||||
cmp byte[ModemInited],1
|
||||
je .okaydeinit
|
||||
ret
|
||||
.okaydeinit
|
||||
cmp byte[UartType],2
|
||||
je near DeInitFossil
|
||||
cli
|
||||
mov al,00h
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
out dx,al
|
||||
|
||||
mov al,13
|
||||
mov dx,[ComPort]
|
||||
out dx,al
|
||||
|
||||
mov ecx,16384
|
||||
call delay
|
||||
|
||||
out dx,al
|
||||
|
||||
mov al,00001001b
|
||||
mov dx,[ComPort]
|
||||
add dx,4
|
||||
out dx,al
|
||||
sti
|
||||
ret
|
||||
|
||||
|
||||
226
zsnes/src/dos/sw.asm
Normal file
226
zsnes/src/dos/sw.asm
Normal file
@@ -0,0 +1,226 @@
|
||||
;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 SidewinderFix
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%macro ParityCheckSW 1
|
||||
mov ecx,ebx
|
||||
xor cl,ch
|
||||
jpe %%ParChkSW
|
||||
mov [%1],ebx
|
||||
%%ParChkSW:
|
||||
%endmacro
|
||||
|
||||
section .data
|
||||
gDump times 256 db 0
|
||||
bDump times 128 db 0
|
||||
NEWSYM _SW1, dd 0
|
||||
NEWSYM _SW2, dd 0
|
||||
NEWSYM _SW3, dd 0
|
||||
NEWSYM _SW4, dd 0
|
||||
NEWSYM _SWCount, dd 0
|
||||
|
||||
section .text
|
||||
NEWSYM _readSideWinder
|
||||
pushad
|
||||
|
||||
mov ecx,200
|
||||
mov ebx,gDump
|
||||
|
||||
cli
|
||||
cmp byte[SidewinderFix],0
|
||||
je .write
|
||||
out dx,al
|
||||
.write
|
||||
GetSWDataLoop:
|
||||
cmp byte[SidewinderFix],0
|
||||
jne .nowrite
|
||||
out dx,al
|
||||
.nowrite
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
in al,dx
|
||||
mov [ebx],al
|
||||
inc ebx
|
||||
dec ecx
|
||||
jnz GetSWDataLoop
|
||||
sti
|
||||
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edi,edi
|
||||
mov esi,1
|
||||
|
||||
FindCycle:
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jnz WMFCS1
|
||||
xor ecx,ecx
|
||||
jmp FindCycle
|
||||
WMFCS1:
|
||||
inc ecx
|
||||
cmp ecx,15
|
||||
jne FindCycle
|
||||
|
||||
xor ebp,ebp
|
||||
|
||||
FindStrobeLow:
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jnz FindStrobeLow
|
||||
xor ecx,ecx
|
||||
|
||||
FindStrobeHigh:
|
||||
inc ecx
|
||||
cmp ecx,15
|
||||
je SWModeCheck
|
||||
mov al,[gDump+edi]
|
||||
inc edi
|
||||
cmp edi,200
|
||||
je SMWError
|
||||
test al,00010000b
|
||||
jz FindStrobeHigh
|
||||
|
||||
mov [bDump+ebp],al
|
||||
inc ebp
|
||||
jmp FindStrobeLow
|
||||
|
||||
SMWDone:
|
||||
popad
|
||||
mov eax,0
|
||||
ret
|
||||
|
||||
SMWError:
|
||||
popad
|
||||
mov eax,1
|
||||
ret
|
||||
|
||||
SWModeCheck:
|
||||
cmp ebp,5
|
||||
je near ModeB1
|
||||
cmp ebp,15
|
||||
je near ModeA1
|
||||
cmp ebp,10
|
||||
je near ModeB2
|
||||
cmp ebp,30
|
||||
je near ModeA2
|
||||
cmp ebp,45
|
||||
je near ModeA3
|
||||
cmp ebp,20
|
||||
je near ModeB4
|
||||
cmp ebp,60
|
||||
je near ModeA4
|
||||
jmp short SMWError
|
||||
|
||||
ModeA1:
|
||||
cmp dword [_SWCount],3
|
||||
je near ModeB3
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA4:
|
||||
mov ebp,45
|
||||
call DoModeA
|
||||
ParityCheckSW _SW4
|
||||
ModeA3:
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW _SW3
|
||||
ModeA2:
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW _SW2
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeB4:
|
||||
mov ebp,15
|
||||
call DoModeB
|
||||
ParityCheckSW _SW4
|
||||
ModeB3:
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW _SW3
|
||||
ModeB2:
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW _SW2
|
||||
ModeB1:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW _SW1
|
||||
jmp SMWDone
|
||||
|
||||
DoModeB:
|
||||
xor ebx,ebx
|
||||
mov eax,2
|
||||
mov ecx,5
|
||||
add ebp,bDump
|
||||
ModeBLoop:
|
||||
test byte [ebp],00100000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
test byte [ebp],01000000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
test byte [ebp],10000000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
inc ebp
|
||||
dec ecx
|
||||
jnz ModeBLoop
|
||||
ret
|
||||
|
||||
DoModeA:
|
||||
xor ebx,ebx
|
||||
mov eax,2
|
||||
mov ecx,15
|
||||
add ebp,bDump
|
||||
ModeALoop:
|
||||
test byte [ebp],00100000b
|
||||
jnz $+4
|
||||
or ebx,eax
|
||||
shl eax,1
|
||||
inc ebp
|
||||
dec ecx
|
||||
jnz ModeALoop
|
||||
ret
|
||||
|
||||
330
zsnes/src/dos/sw32.asm
Normal file
330
zsnes/src/dos/sw32.asm
Normal file
@@ -0,0 +1,330 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;32-bit DOS-Mode driver for the Microsoft Sidewinder Gamepad
|
||||
;Multi-SW Version 1.5
|
||||
;(C) 1997, 1998 Robert William Grubbs, All Rights Reserved
|
||||
;Latest revision 1/20/98
|
||||
; Driver Source code Include file
|
||||
|
||||
;C-linkable, rewrote decoder -sardu
|
||||
|
||||
;Flat memory mode (Protected mode extender required! Tested with DOS32)
|
||||
;Tested with TASM 4.0+
|
||||
|
||||
|
||||
SW1 dd 0 ;SW #1's button status
|
||||
SW2 dd 0 ;SW #2's button status
|
||||
SW3 dd 0 ;SW #3's button status
|
||||
SW4 dd 0 ;SW #4's button status
|
||||
SWCount dd 1 ;Tell the driver how many sidewinders are present
|
||||
SWSetup dd 0 ;Tell the driver what polling mode to use
|
||||
; 0=Interrupts disabled, Multiple OUT statements
|
||||
; 1=Interrupts disabled, Single OUT statement
|
||||
; 2=Interrupts enabled, Multiple OUT statements
|
||||
; 3=Interrupts enabled, Single OUT statement
|
||||
|
||||
gDump times 100h db 0 ;SW Status dump buffer (space for 256 bytes, uses 200)
|
||||
bDump times 80h db 0 ;buffer to hold button data (Modes A and B, all SW)
|
||||
|
||||
;This macro calculates parity for the buttons and compares it to the SW's
|
||||
; parity bit. If they don't match, the button data is discarded.
|
||||
%macro ParityCheckSW 1
|
||||
mov ecx,ebx ;duplicate button status
|
||||
xor cl,ch ;
|
||||
jpe %%ParChkSW
|
||||
mov [%1],ebx ;update button status for SW #n
|
||||
%%ParChkSW ;done
|
||||
%endmacro
|
||||
|
||||
;The main subroutine; this is the important one; bow down before it
|
||||
;IN: None
|
||||
;Out: SWx=buttons (bit 0=null 1=up 2=dn 3=rt 4=lt 5=A 6=B 7=C 8=X)
|
||||
; (9=Y 10=Z 11=L 12=R 13=St 14=M 15=Parity)
|
||||
;No registers destroyed
|
||||
|
||||
readSideWinder:
|
||||
pushad
|
||||
|
||||
mov ecx,200 ;dump buffer fill size
|
||||
mov ebx,gDump ;initial dump pointer
|
||||
mov edx,0201h ;joystick port
|
||||
|
||||
cmp dword[SWSetup],0
|
||||
jne NotSW0
|
||||
cli ;Disable interrupts (required to avoid jitter)
|
||||
GetSWDataLoop: ;
|
||||
out dx,al ;trigger joystick port
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop
|
||||
sti ;Re-enable interrupts
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW0:
|
||||
cmp dword[SWSetup],1
|
||||
jne NotSW1
|
||||
cli ;Disable interrupts (required to avoid jitter)
|
||||
out dx,al ;trigger joystick port
|
||||
GetSWDataLoop1: ;
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop1
|
||||
sti ;Re-enable interrupts
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW1:
|
||||
cmp dword[SWSetup],2
|
||||
jne NotSW2
|
||||
GetSWDataLoop2: ;
|
||||
out dx,al ;trigger joystick port
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop2
|
||||
jmp SWPollDone
|
||||
|
||||
NotSW2:
|
||||
;default all others to SWStatus=3
|
||||
out dx,al ;trigger joystick port
|
||||
GetSWDataLoop3: ;
|
||||
in al,dx ;read SW status byte
|
||||
mov [ebx],al ;dump status byte
|
||||
inc ebx ;increment dump pointer
|
||||
dec ecx
|
||||
jnz GetSWDataLoop3
|
||||
|
||||
SWPollDone:
|
||||
|
||||
mov ecx,0 ;tick count
|
||||
mov esi,1 ;initialize output mask
|
||||
mov ebx,0 ;initialize output
|
||||
mov edi,0 ;initialize input pointer
|
||||
|
||||
;My current method of cycle detection is to look for 15 highs in a row on
|
||||
; the strobe line. Cycle ends is detected by 15 lows in a row.
|
||||
;Mode A has 15 strobes in a cycle, Mode B has 5.
|
||||
; Note that the 15 highs/lows for cycle detection may be too high for slow
|
||||
; machines. I havn't seen a problem yet, but it may exist...
|
||||
;Multiple Sidewinder data complicates things. Each additional SW tags
|
||||
; another set of strobes to the cycle, 5 more in mode B, 15 more in mode A.
|
||||
; Detecting extra SW gamepad data is fairly simple: count the number of
|
||||
; strobes. If it is a multiple of 5, you're in mode B and can divide by 5
|
||||
; to get the total number of gamepads. If it's divisible by 15, use mode A.
|
||||
; However, this method cannot distinguish between mode A for one SW and mode
|
||||
; B for three SW. In that case, the SWCount variable must be set correctly.
|
||||
|
||||
FindCycle:
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;Check for nonzero bits
|
||||
jnz WMFCS1 ;
|
||||
xor ecx,ecx ;if zero, reset tick count
|
||||
jmp FindCycle ;can't be pre-cycle
|
||||
WMFCS1: ;Possibly pre-cycle
|
||||
inc ecx ;increment tick count
|
||||
cmp ecx,15 ;test for sufficient ticks for cycle start
|
||||
jne FindCycle ;if insufficient, get next status byte
|
||||
;Yippie! it found a (probable) cycle!
|
||||
|
||||
mov ebp,0 ;initialize bDump index (strobe count)
|
||||
|
||||
FindStrobeLow: ;Search for leading edge of data strobe
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;get "strobe" bit
|
||||
jnz SHORT FindStrobeLow ;if it isn't zero, we're not there yet
|
||||
xor ecx,ecx ;initialize cycle end test count
|
||||
|
||||
FindStrobeHigh:
|
||||
inc ecx ;increment zero count
|
||||
cmp ecx,0fh ;is it 15?
|
||||
je SWModeCheck ;if so, goto mode check
|
||||
mov al,[gDump+edi] ;get next status byte
|
||||
inc edi ;increment input pointer
|
||||
cmp edi,200 ;test for end of status block
|
||||
je SWNoFind ;if it's the end, quit sub with error
|
||||
test al,00010000b ;get "strobe" bit
|
||||
jz FindStrobeHigh ;if it is zero, we're not there yet
|
||||
;if not, we're there! data bit is valid (probably)
|
||||
mov [bDump+ebp],al ;preserve data for button decoding
|
||||
inc ebp ;increment strobe count/bDump index
|
||||
jmp FindStrobeLow ;wait for the next button
|
||||
|
||||
SMWDone:
|
||||
SWNoFind:
|
||||
popad
|
||||
ret ;return to calling procedure
|
||||
|
||||
SWModeCheck: ;Check strobe count to identify mode and # of SW
|
||||
cmp ebp,15 ;Is it Mode A with 1 Sidewinder or B with 3?
|
||||
je ModeA1
|
||||
cmp ebp,5 ;Is it Mode B with 1 Sidewinders?
|
||||
je ModeB1
|
||||
cmp ebp,30 ;Is it Mode A with 2 Sidewinders?
|
||||
je ModeA2
|
||||
cmp ebp,10 ;Is it Mode B with 2 Sidewinders?
|
||||
je near ModeB2
|
||||
cmp ebp,45 ;Is it Mode A with 3 Sidewinders?
|
||||
je near ModeA3
|
||||
cmp ebp,60 ;Is it Mode A with 4 Sidewinders?
|
||||
je near ModeA4
|
||||
cmp ebp,20 ;Is it Mode B with 4 Sidewinders?
|
||||
je near ModeB4
|
||||
jmp SHORT SWNoFind ;Any other # of strobes is invalid data
|
||||
|
||||
ModeB1:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA1:
|
||||
cmp dword [SWCount],3
|
||||
je near ModeB3
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
jmp SMWDone
|
||||
|
||||
ModeA2:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
jmp SMWDone
|
||||
|
||||
ModeA3:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW SW3
|
||||
jmp SMWDone
|
||||
|
||||
ModeA4:
|
||||
xor ebp,ebp
|
||||
call DoModeA
|
||||
ParityCheckSW SW1
|
||||
mov ebp,15
|
||||
call DoModeA
|
||||
ParityCheckSW SW2
|
||||
mov ebp,30
|
||||
call DoModeA
|
||||
ParityCheckSW SW3
|
||||
mov ebp,45
|
||||
call DoModeA
|
||||
ParityCheckSW SW4
|
||||
jmp SMWDone
|
||||
|
||||
ModeB2:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
jmp SMWDone
|
||||
|
||||
ModeB3:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW SW3
|
||||
jmp SMWDone
|
||||
|
||||
ModeB4:
|
||||
xor ebp,ebp
|
||||
call DoModeB
|
||||
ParityCheckSW SW1
|
||||
mov ebp,5
|
||||
call DoModeB
|
||||
ParityCheckSW SW2
|
||||
mov ebp,10
|
||||
call DoModeB
|
||||
ParityCheckSW SW3
|
||||
mov ebp,15
|
||||
call DoModeB
|
||||
ParityCheckSW SW4
|
||||
jmp SMWDone
|
||||
ENDP
|
||||
|
||||
%macro SWRepeat 1
|
||||
mov al,[bDump+ebp+%1]
|
||||
shr al,5 ;get upper 3 bits
|
||||
shl eax,1+3*%1 ;shift into place
|
||||
or ebx,eax ;or into output
|
||||
%endmacro
|
||||
|
||||
DoModeB:
|
||||
xor ebx,ebx ;Initialize output
|
||||
xor eax,eax
|
||||
|
||||
SWRepeat 0
|
||||
SWRepeat 1
|
||||
SWRepeat 2
|
||||
SWRepeat 3
|
||||
SWRepeat 4
|
||||
|
||||
xor ebx,0FFFEh
|
||||
ret
|
||||
|
||||
DoModeA:
|
||||
xor ebx,ebx ;Clear output
|
||||
mov ecx,15 ;bit count
|
||||
|
||||
ALP:
|
||||
mov al,[bDump+ebp]
|
||||
inc ebp
|
||||
shl al,3
|
||||
rcr ebx,1
|
||||
dec ecx
|
||||
jg ALP
|
||||
|
||||
shr ebx,16
|
||||
xor ebx,0FFFEh
|
||||
ret
|
||||
|
||||
|
||||
|
||||
555
zsnes/src/dos/vesa12.asm
Normal file
555
zsnes/src/dos/vesa12.asm
Normal file
@@ -0,0 +1,555 @@
|
||||
;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 vesa2_usbit,vesa2_clbit,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3
|
||||
EXTSYM vesa2_x,vesa2_y,vesa2selec,vesa2_bits,vesa2_rpos,vesa2_gpos,vesa2_bpos
|
||||
EXTSYM vesa2_rposng,vesa2_gposng,vesa2_bposng,vesa2_rtrcl,vesa2_rtrcla,vesa2_rfull
|
||||
EXTSYM vesa2_gtrcl,vesa2_gtrcla,vesa2_gfull,vesa2_btrcl,vesa2_btrcla,vesa2_bfull
|
||||
EXTSYM vesa2red10,dcolortab,videotroub,Change_Dir
|
||||
EXTSYM genfulladdtab,genfulladdtabng,DosExit
|
||||
EXTSYM InitDrive,gotoroot,InitDir,fulladdtab
|
||||
; EXTSYM printnum,DosExit
|
||||
EXTSYM LFBpointer,noblocks,bytesperscanline,vesamode,VESAmodelist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; add 0214h video mode
|
||||
|
||||
NEWSYM granularity, dw 0
|
||||
NEWSYM granadd, dd 0
|
||||
|
||||
NEWSYM VESA12EXITTODOS
|
||||
mov ax,0003h
|
||||
int 10h
|
||||
push edx
|
||||
mov edx,.exitfromvesa12
|
||||
mov ah,9
|
||||
int 21h
|
||||
pop edx
|
||||
mov ah,9
|
||||
int 21h
|
||||
mov edx,.return
|
||||
mov ah,9
|
||||
int 21h
|
||||
|
||||
mov dl,[InitDrive]
|
||||
mov ebx,InitDir
|
||||
call Change_Dir
|
||||
|
||||
mov byte[videotroub],1
|
||||
jmp DosExit
|
||||
|
||||
.exitfromvesa12 db 'Unable to Initialize VESA1.2 $'
|
||||
.return db 10,13,'$'
|
||||
|
||||
;*******************************************************
|
||||
; Set up Vesa 2
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM InitVesa12
|
||||
;-------------------------------------------------;
|
||||
; First - allocate some bytes in DOS memory for ;
|
||||
; communication with VBE ;
|
||||
;-------------------------------------------------;
|
||||
|
||||
mov eax,0100h
|
||||
mov ebx,512/16 ; 512 bytes
|
||||
int 31h ; Function 31h,100h - Allocate
|
||||
; DOS memory (512 bytes)
|
||||
jnc .gotmem
|
||||
mov edx,.nomemmessage
|
||||
jmp VESA12EXITTODOS
|
||||
.nomemmessage
|
||||
db ': Unable to locate DOS memory.$'
|
||||
|
||||
.gotmem
|
||||
mov fs,dx ; FS now points to the DOS
|
||||
; buffer
|
||||
|
||||
|
||||
;--------------------------------------------------;
|
||||
; Now, get information about the video card into ;
|
||||
; a data structure ;
|
||||
;--------------------------------------------------;
|
||||
|
||||
mov edi,RMREGS
|
||||
mov dword[fs:0],'VBE1' ; Request VBE 2.0 info
|
||||
mov dword[RMREGS.eax],4f00h
|
||||
mov word[RMREGS.es],ax ; Real mode segment of DOS
|
||||
; buffer
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
|
||||
jnc .int1ok
|
||||
mov edx,.noint1message
|
||||
jmp VESA12EXITTODOS
|
||||
.noint1message
|
||||
db ': Simulated real mode interrupt failed.$'
|
||||
|
||||
.int1ok ; Real mode int successful!!!
|
||||
mov eax,[RMREGS.eax]
|
||||
cmp al,4fh ; Check vbe interrupt went OK
|
||||
jz .vbedetected
|
||||
mov edx,.novbemessage
|
||||
jmp VESA12EXITTODOS
|
||||
.novbemessage
|
||||
db ': VBE not detected!!$'
|
||||
|
||||
.vbedetected
|
||||
cmp dword[fs:0000],'VESA'
|
||||
jz .vesadetected ; Check for presence of vesa
|
||||
mov edx,.novesamessage
|
||||
jmp VESA12EXITTODOS
|
||||
.novesamessage
|
||||
db ': VESA not detected!$'
|
||||
|
||||
.vesadetected
|
||||
cmp word[fs:0004],102h
|
||||
jae .vesa12detected ; Check we've got VESA 1.2 or greater
|
||||
mov edx,.novesa2message
|
||||
jmp VESA12EXITTODOS
|
||||
.novesa2message
|
||||
db ': VESA 1.2 or greater required!$'
|
||||
|
||||
|
||||
;-----------------------------------------------------;
|
||||
; OK - vesa 2.0 or greater has been detected. Copy ;
|
||||
; mode information into VESAmodelist ;
|
||||
;-----------------------------------------------------;
|
||||
|
||||
.vesa12detected
|
||||
mov ax,[fs:12h] ; Get no. of 64k blocks
|
||||
mov [noblocks],ax
|
||||
mov ax, 2
|
||||
mov bx,[fs:10h]
|
||||
int 31h
|
||||
|
||||
jnc .wegottheselector
|
||||
mov edx, .oopsnoselector
|
||||
jmp VESA12EXITTODOS
|
||||
.oopsnoselector
|
||||
db ': Failed to allocate vesa display selector!$'
|
||||
|
||||
.wegottheselector
|
||||
|
||||
mov gs,ax
|
||||
xor eax,eax
|
||||
mov ebp,VESAmodelist
|
||||
mov ecx,512
|
||||
mov ax,[fs:0eh]
|
||||
|
||||
.loopcopymodes
|
||||
mov bx,[gs:eax]
|
||||
mov [ebp],bx
|
||||
cmp bx,0ffffh
|
||||
jz .copiedmodes
|
||||
add ebp,2
|
||||
add eax,2
|
||||
dec ecx
|
||||
jz .outofmodelistspace
|
||||
jmp .loopcopymodes
|
||||
|
||||
.outofmodelistspace
|
||||
mov edx,.outofmodelistspacemessage
|
||||
jmp VESA12EXITTODOS
|
||||
.outofmodelistspacemessage
|
||||
db ': Out of VESA mode list space!$'
|
||||
|
||||
;----------------------------------------------;
|
||||
; OK - Scan the mode list to find a matching ;
|
||||
; mode for vesa2_x, vesa2_y and vesa2_depth ;
|
||||
;----------------------------------------------;
|
||||
|
||||
.copiedmodes
|
||||
|
||||
mov ebp,VESAmodelist
|
||||
xor ecx,ecx
|
||||
|
||||
.loopcheckmodes
|
||||
mov cx, [ebp]
|
||||
cmp cx, 0ffffh
|
||||
jnz .notendoflist
|
||||
|
||||
mov edx,.endoflist
|
||||
jmp VESA12EXITTODOS
|
||||
|
||||
.endoflist db ': VESA 1.2 mode does not work on your video card/driver.$'
|
||||
.whichwin db 0
|
||||
|
||||
.notendoflist
|
||||
|
||||
mov edi, RMREGS
|
||||
mov dword[RMREGS.eax],4f01h
|
||||
mov dword[RMREGS.ebx],0
|
||||
mov dword[RMREGS.ecx],ecx
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
jnc .modecheckok
|
||||
mov edx,.modecheckfail
|
||||
jmp VESA12EXITTODOS
|
||||
.modecheckfail
|
||||
db ': Real mode interrupt failure while checking vesa mode$'
|
||||
|
||||
.modecheckok
|
||||
add ebp,2
|
||||
|
||||
test word[fs:0000h],1b
|
||||
jz near .loopcheckmodes ; If mode is not available
|
||||
|
||||
;
|
||||
; xor eax,eax
|
||||
; mov ax,[fs:12h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; mov ax,[fs:14h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; xor ah,ah
|
||||
; mov al,[fs:19h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,13
|
||||
; int 21h
|
||||
; mov dl,10
|
||||
; int 21h
|
||||
|
||||
mov eax,[vesa2_x]
|
||||
cmp [fs:12h],ax ; Check that the height matches
|
||||
jnz near .loopcheckmodes
|
||||
mov eax,[vesa2_y]
|
||||
cmp [fs:14h],ax ; Check that the width matches
|
||||
jnz near .loopcheckmodes
|
||||
mov al,[vesa2_bits]
|
||||
cmp [fs:19h],al ; Check bits/pixel for match
|
||||
jnz near .loopcheckmodes
|
||||
|
||||
; mov ah,07h
|
||||
; int 21h
|
||||
|
||||
; D0 = Window supported
|
||||
; 0 = Window is not supported
|
||||
; 1 = Window is supported
|
||||
; D1 = Window readable
|
||||
; 0 = Window is not readable
|
||||
; 1 = Window is readable
|
||||
; D2 = Window writeable
|
||||
; 0 = Window is not writeable
|
||||
; 1 = Window is writeable
|
||||
; D3-D7 = Reserved
|
||||
|
||||
mov byte[.whichwin],0
|
||||
mov al,[fs:2] ; Get window A attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
je .foundwin ; Mode supported
|
||||
mov al,[fs:3] ; Get window B attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
jne .foundwin ; Mode not supported
|
||||
mov byte[.whichwin],1
|
||||
.foundwin
|
||||
|
||||
; Success - a match has been found!!
|
||||
|
||||
sub ebp,2
|
||||
mov ax,[ebp]
|
||||
mov [vesamode],ax ; Store vesa 1.2 mode number
|
||||
; and eax,0FFFFh
|
||||
; push eax
|
||||
; mov ax,0003h
|
||||
; int 10h
|
||||
; pop eax
|
||||
; call printnum
|
||||
; jmp DosExit
|
||||
|
||||
mov ax,[fs:10h]
|
||||
mov byte[vesa2red10],0
|
||||
mov byte[vesa2_rposng],11
|
||||
mov byte[vesa2_gposng],6
|
||||
mov byte[vesa2_bposng],0
|
||||
mov dword[vesa2_clbitng],1111011111011110b
|
||||
mov dword[vesa2_clbitng2],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng3],0111101111101111b
|
||||
mov [bytesperscanline],ax ; Store bytes per scan line
|
||||
cmp byte[fs:20h],10
|
||||
jne .nored10
|
||||
mov byte[fs:20h],11
|
||||
mov byte[vesa2red10],1
|
||||
mov byte[vesa2_rposng],10
|
||||
mov byte[vesa2_gposng],5
|
||||
mov dword[vesa2_clbitng],0111101111011110b
|
||||
mov dword[vesa2_clbitng2],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng3],0011110111101111b
|
||||
.nored10
|
||||
; fix up bit lengths
|
||||
mov al,16
|
||||
sub al,[fs:20h]
|
||||
mov ah,[fs:22h]
|
||||
sub ah,[fs:20h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:20h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1
|
||||
mov bh,ah
|
||||
.scheck1
|
||||
cmp bh,bl
|
||||
jb .scheck2
|
||||
mov bh,bl
|
||||
.scheck2
|
||||
mov byte[fs:19h],5
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:22h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:22h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:22h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1b
|
||||
mov bh,ah
|
||||
.scheck1b
|
||||
cmp bh,bl
|
||||
jb .scheck2b
|
||||
mov bh,bl
|
||||
.scheck2b
|
||||
mov [fs:21h],bh
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:24h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:24h]
|
||||
mov bl,[fs:22h]
|
||||
sub bl,[fs:24h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1c
|
||||
mov bh,ah
|
||||
.scheck1c
|
||||
cmp bh,bl
|
||||
jb .scheck2c
|
||||
mov bh,bl
|
||||
.scheck2c
|
||||
mov [fs:23h],bh
|
||||
|
||||
mov word[vesa2_clbit],0
|
||||
|
||||
cmp byte[fs:20h],10
|
||||
jne .nottopbit
|
||||
mov word[vesa2_usbit],8000h
|
||||
.nottopbit
|
||||
|
||||
; Process Red Stuff
|
||||
mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:19h],6
|
||||
jne .no6bit
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bit
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_rpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrr
|
||||
shl bx,cl
|
||||
jmp .shlr
|
||||
.shrr
|
||||
shr bx,1
|
||||
.shlr
|
||||
mov word[vesa2_rfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_rtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_rtrcla],bx
|
||||
|
||||
; Process Green Stuff
|
||||
mov al,[fs:22h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:21h],6
|
||||
jne .no6bitb
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitb
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_gpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrg
|
||||
shl bx,cl
|
||||
jmp .shlg
|
||||
.shrg
|
||||
shr bx,1
|
||||
.shlg
|
||||
mov word[vesa2_gfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_gtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_gtrcla],bx
|
||||
|
||||
; Process Blue Stuff
|
||||
mov al,[fs:24h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:23h],6
|
||||
jne .no6bitc
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitc
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_bpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrb
|
||||
shl bx,cl
|
||||
jmp .shlb
|
||||
.shrb
|
||||
shr bx,1
|
||||
.shlb
|
||||
mov word[vesa2_bfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_btrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_btrcla],bx
|
||||
|
||||
xor word[vesa2_clbit],0FFFFh
|
||||
|
||||
mov ax,[fs:4]
|
||||
mov [granularity],ax
|
||||
xor edx,edx
|
||||
mov ax,64
|
||||
mov bx,[granularity]
|
||||
div bx
|
||||
mov [granadd],ax
|
||||
|
||||
|
||||
;vesa2_rtrcl dw 0 ; red transparency clear (bit+4)
|
||||
;vesa2_rtrcla dw 0 ; red transparency (AND) clear (not(bit+4))
|
||||
;vesa2_rfull dw 0 ; red max (or (bit-1)*1Fh)
|
||||
|
||||
call genfulladdtab
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov ax,4f02h
|
||||
mov bx,[vesamode]
|
||||
int 10h ; Set the vesa mode
|
||||
cmp ax,004fh
|
||||
jz .modesetok
|
||||
mov edx,.unableset
|
||||
jmp VESA12EXITTODOS ; Failure!!!
|
||||
.unableset db 'Unable to initialize video mode.$'
|
||||
|
||||
.modesetok
|
||||
;******************************* EXTRA BIT ****************************
|
||||
|
||||
ret
|
||||
|
||||
; Check logical scanline length
|
||||
mov eax,4f06h
|
||||
mov ebx,1
|
||||
int 10h
|
||||
cmp cx,[vesa2_x]
|
||||
je .correctwidth
|
||||
|
||||
mov eax,4f06h ; VBE Set/Get logical scan line
|
||||
; length
|
||||
mov ebx,0 ; Set scan line length in
|
||||
; pixels
|
||||
mov ecx, [vesa2_x] ; Desired screen width
|
||||
int 10h
|
||||
cmp ax,04fh
|
||||
jz .correctwidth
|
||||
mov edx, .unablescan
|
||||
jmp VESA12EXITTODOS ; Failure!!!
|
||||
.unablescan db 'Unable to set scan line length.$'
|
||||
|
||||
.correctwidth
|
||||
|
||||
ret
|
||||
|
||||
|
||||
RMREGS
|
||||
.edi dd 0
|
||||
.esi dd 0
|
||||
.ebp dd 0
|
||||
.esp dd 0
|
||||
.ebx dd 0
|
||||
.edx dd 0
|
||||
.ecx dd 0
|
||||
.eax dd 0
|
||||
.flags dw 0
|
||||
.es dw 0
|
||||
.ds dw 0
|
||||
.fs dw 0
|
||||
.gs dw 0
|
||||
.ip dw 0
|
||||
.cs dw 0
|
||||
.sp dw 0
|
||||
.ss dw 0
|
||||
.spare times 20 dd 0
|
||||
|
||||
802
zsnes/src/dos/vesa2.asm
Normal file
802
zsnes/src/dos/vesa2.asm
Normal file
@@ -0,0 +1,802 @@
|
||||
;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 printnum
|
||||
EXTSYM DosExit,ZSNESBase,Change_Dir,PrintStr,newengen
|
||||
EXTSYM HalfTransB,HalfTransC
|
||||
EXTSYM InitDrive,gotoroot,InitDir,fulladdtab
|
||||
; EXTSYM printhex
|
||||
; EXTSYM printhex
|
||||
EXTSYM UnusedBit,HalfTrans,UnusedBitXor,ngrposng,nggposng,ngbposng
|
||||
; EXTSYM printhex
|
||||
EXTSYM Init_2xSaIMMX,Init_2xSaI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; add 0214h video mode
|
||||
anticrash times 10 db 0
|
||||
|
||||
|
||||
ALIGN32
|
||||
NEWSYM vesa2_usbit, dd 0 ; Unused bit in proper bit location
|
||||
NEWSYM vesa2_clbit, dd 0 ; clear all bit 0's if AND is used
|
||||
NEWSYM vesa2_clbitng, dd 0 ; clear all bit 0's if AND is used
|
||||
NEWSYM vesa2_clbitng2, dd 0,0 ; clear all bit 0's if AND is used
|
||||
NEWSYM vesa2_clbitng3, dd 0 ; clear all bit 0's if AND is used
|
||||
NEWSYM vesa2_x, dd 320 ; Desired screen width
|
||||
NEWSYM vesa2_y, dd 240 ; Height
|
||||
NEWSYM vesa2selec, dd 0 ; VESA2 Selector Location
|
||||
NEWSYM vesa2_bits, dd 8 ; Bits per pixel
|
||||
NEWSYM vesa2_rpos, dd 0 ; Red bit position
|
||||
NEWSYM vesa2_gpos, dd 0 ; Green bit position
|
||||
NEWSYM vesa2_bpos, dd 0 ; Blue bit position
|
||||
NEWSYM vesa2_rposng, dd 0 ; Red bit position
|
||||
NEWSYM vesa2_gposng, dd 0 ; Green bit position
|
||||
NEWSYM vesa2_bposng, dd 0 ; Blue bit position
|
||||
|
||||
NEWSYM vesa2_rtrcl, dd 0 ; red transparency clear (bit+4)
|
||||
NEWSYM vesa2_rtrcla, dd 0 ; red transparency (AND) clear (not(bit+4))
|
||||
NEWSYM vesa2_rfull, dd 0 ; red max (or bit*1Fh)
|
||||
NEWSYM vesa2_gtrcl, dd 0 ; red transparency clear (bit+4)
|
||||
NEWSYM vesa2_gtrcla, dd 0 ; red transparency (AND) clear (not(bit+4))
|
||||
NEWSYM vesa2_gfull, dd 0 ; red max (or bit*1Fh)
|
||||
NEWSYM vesa2_btrcl, dd 0 ; red transparency clear (bit+4)
|
||||
NEWSYM vesa2_btrcla, dd 0 ; red transparency (AND) clear (not(bit+4))
|
||||
NEWSYM vesa2_bfull, dd 0 ; red max (or bit*1Fh)
|
||||
NEWSYM vesa2red10, dd 0 ; red position at bit 10
|
||||
NEWSYM videotroub, dd 0 ; red position at bit 10
|
||||
NEWSYM vesa3en, dd 0
|
||||
NEWSYM VESAAddr, dd 0
|
||||
NEWSYM ExitFromGUI, db 0
|
||||
NEWSYM ErrorPointer, dd 0
|
||||
NEWSYM TripBufAvail, db 0
|
||||
|
||||
|
||||
NEWSYM dcolortab, times 256 dd 0
|
||||
|
||||
NEWSYM genfulladdtab
|
||||
; Write to buffer
|
||||
cmp byte[newengen],1
|
||||
jne .notneweng
|
||||
cmp byte[vesa2red10],0
|
||||
jne near genfulladdtabred
|
||||
.notneweng
|
||||
xor ecx,ecx
|
||||
.loopers
|
||||
mov ax,cx
|
||||
test [vesa2_rtrcl],cx
|
||||
jz .nor
|
||||
and ax,[vesa2_rtrcla]
|
||||
or ax,[vesa2_rfull]
|
||||
.nor
|
||||
test [vesa2_gtrcl],cx
|
||||
jz .nog
|
||||
and ax,[vesa2_gtrcla]
|
||||
or ax,[vesa2_gfull]
|
||||
.nog
|
||||
test [vesa2_btrcl],cx
|
||||
jz .nob
|
||||
and ax,[vesa2_btrcla]
|
||||
or ax,[vesa2_bfull]
|
||||
.nob
|
||||
shl ax,1
|
||||
mov [fulladdtab+ecx*2],ax
|
||||
dec cx
|
||||
jnz .loopers
|
||||
ret
|
||||
|
||||
NEWSYM genfulladdtabred
|
||||
NEWSYM genfulladdtabng
|
||||
; Write to buffer
|
||||
xor ecx,ecx
|
||||
.loopers
|
||||
mov ax,cx
|
||||
test cx,0100000000000000b
|
||||
jz .nor
|
||||
and ax,1011111111111111b
|
||||
or ax, 0011110000000000b
|
||||
.nor
|
||||
test cx,0000001000000000b
|
||||
jz .nog
|
||||
and ax,1111110111111111b
|
||||
or ax, 0000000111100000b
|
||||
.nog
|
||||
test cx,0000000000010000b
|
||||
jz .nob
|
||||
and ax,1111111111101111b
|
||||
or ax, 0000000000001111b
|
||||
.nob
|
||||
shl ax,1
|
||||
mov [fulladdtab+ecx*2],ax
|
||||
dec cx
|
||||
jnz .loopers
|
||||
ret
|
||||
|
||||
NEWSYM VESA2EXITTODOS
|
||||
mov byte[videotroub],1
|
||||
cmp byte[ExitFromGUI],0
|
||||
je .nogui
|
||||
mov [ErrorPointer],edx
|
||||
ret
|
||||
.nogui
|
||||
mov ax,0003h
|
||||
int 10h
|
||||
push edx
|
||||
mov edx,.exitfromvesa2
|
||||
call PrintStr
|
||||
pop edx
|
||||
call PrintStr
|
||||
mov edx,.return
|
||||
call PrintStr
|
||||
|
||||
mov dl,[InitDrive]
|
||||
mov ebx,InitDir
|
||||
call Change_Dir
|
||||
jmp DosExit
|
||||
|
||||
.exitfromvesa2 db 'Unable to Initialize VESA2 : ',0
|
||||
.return db 10,13,0
|
||||
|
||||
;*******************************************************
|
||||
; Set up Vesa 2
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM InitVesa2
|
||||
;-------------------------------------------------;
|
||||
; First - allocate some bytes in DOS memory for ;
|
||||
; communication with VBE ;
|
||||
;-------------------------------------------------;
|
||||
|
||||
mov eax,0100h
|
||||
mov ebx,512/16 ; 512 bytes
|
||||
int 31h ; Function 31h,100h - Allocate
|
||||
; DOS memory (512 bytes)
|
||||
jnc .gotmem
|
||||
mov edx,.nomemmessage
|
||||
jmp VESA2EXITTODOS
|
||||
.nomemmessage
|
||||
db 'Unable to locate DOS memory.',0
|
||||
|
||||
.gotmem
|
||||
mov fs,dx ; FS now points to the DOS
|
||||
; buffer
|
||||
|
||||
|
||||
;--------------------------------------------------;
|
||||
; Now, get information about the video card into ;
|
||||
; a data structure ;
|
||||
;--------------------------------------------------;
|
||||
|
||||
mov edi,RMREGS
|
||||
mov dword[fs:0],'VBE2' ; Request VBE 2.0 info
|
||||
mov dword[RMREGS.eax],4f00h
|
||||
mov word[RMREGS.es],ax ; Real mode segment of DOS
|
||||
; buffer
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
|
||||
jnc .int1ok
|
||||
mov edx,.noint1message
|
||||
jmp VESA2EXITTODOS
|
||||
.noint1message
|
||||
db 'Simulated real mode interrupt failed.',0
|
||||
|
||||
.int1ok ; Real mode int successful!!!
|
||||
mov eax,[RMREGS.eax]
|
||||
cmp al,4fh ; Check vbe interrupt went OK
|
||||
jz .vbedetected
|
||||
mov edx,.novbemessage
|
||||
jmp VESA2EXITTODOS
|
||||
.novbemessage
|
||||
db 'VBE not detected!!',0
|
||||
|
||||
.vbedetected
|
||||
cmp dword[fs:0000],'VESA'
|
||||
jz .vesadetected ; Check for presence of vesa
|
||||
mov edx,.novesamessage
|
||||
jmp VESA2EXITTODOS
|
||||
.novesamessage
|
||||
db 'VESA not detected!',0
|
||||
|
||||
.vesadetected
|
||||
cmp word[fs:0004],200h
|
||||
jae .vesa2detected ; Check we've got VESA 2.0 or greater
|
||||
mov edx,.novesa2message
|
||||
jmp VESA2EXITTODOS
|
||||
.novesa2message
|
||||
db 'VESA 2.0 or greater required!',0
|
||||
|
||||
|
||||
;-----------------------------------------------------;
|
||||
; OK - vesa 2.0 or greater has been detected. Copy ;
|
||||
; mode information into VESAmodelist ;
|
||||
;-----------------------------------------------------;
|
||||
|
||||
.vesa2detected
|
||||
mov dword[vesa3en],0
|
||||
cmp word[fs:004],300h
|
||||
jb .notvbe3
|
||||
mov dword[vesa3en],1
|
||||
.notvbe3
|
||||
mov ax,[fs:12h] ; Get no. of 64k blocks
|
||||
mov [noblocks],ax
|
||||
mov ax, 2
|
||||
mov bx,[fs:10h]
|
||||
int 31h
|
||||
|
||||
jnc .wegottheselector
|
||||
mov edx, .oopsnoselector
|
||||
jmp VESA2EXITTODOS
|
||||
.oopsnoselector
|
||||
db 'Failed to allocate vesa display selector!',0
|
||||
|
||||
.wegottheselector
|
||||
|
||||
mov gs,ax
|
||||
xor eax,eax
|
||||
mov ebp,VESAmodelist
|
||||
mov ecx,512
|
||||
mov ax,[fs:0eh]
|
||||
|
||||
.loopcopymodes
|
||||
mov bx,[gs:eax]
|
||||
mov [ebp],bx
|
||||
cmp bx,0ffffh
|
||||
jz .copiedmodes
|
||||
add ebp,2
|
||||
add eax,2
|
||||
dec ecx
|
||||
jz .outofmodelistspace
|
||||
jmp .loopcopymodes
|
||||
|
||||
.outofmodelistspace
|
||||
mov edx,.outofmodelistspacemessage
|
||||
jmp VESA2EXITTODOS
|
||||
.outofmodelistspacemessage
|
||||
db 'Out of VESA2 mode list space!',0
|
||||
|
||||
;----------------------------------------------;
|
||||
; OK - Scan the mode list to find a matching ;
|
||||
; mode for vesa2_x, vesa2_y and vesa2_depth ;
|
||||
;----------------------------------------------;
|
||||
|
||||
.copiedmodes
|
||||
|
||||
mov ebp,VESAmodelist
|
||||
xor ecx,ecx
|
||||
|
||||
.loopcheckmodes
|
||||
mov cx, [ebp]
|
||||
cmp cx, 0ffffh
|
||||
jnz .notendoflist
|
||||
|
||||
mov edx,.endoflist
|
||||
jmp VESA2EXITTODOS
|
||||
|
||||
.endoflist db 'This VESA2 mode does not work on your video card / driver.',0
|
||||
.whichwin db 0
|
||||
|
||||
.notendoflist
|
||||
|
||||
mov edi, RMREGS
|
||||
mov dword[RMREGS.eax],4f01h
|
||||
mov dword[RMREGS.ebx],0
|
||||
mov dword[RMREGS.ecx],ecx
|
||||
mov dword[RMREGS.edi],0
|
||||
|
||||
push es
|
||||
push ds
|
||||
pop es
|
||||
mov eax,300h
|
||||
mov ebx,10h
|
||||
xor ecx,ecx
|
||||
int 31h ; Simulate real mode interrupt
|
||||
pop es
|
||||
jnc .modecheckok
|
||||
mov edx,.modecheckfail
|
||||
jmp VESA2EXITTODOS
|
||||
.modecheckfail
|
||||
db 'Real mode interrupt failure while checking vesa mode',0
|
||||
|
||||
.modecheckok
|
||||
add ebp,2
|
||||
|
||||
test word[fs:0000h],1b
|
||||
jz near .loopcheckmodes ; If mode is not available
|
||||
|
||||
;
|
||||
; xor eax,eax
|
||||
; mov ax,[fs:12h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; mov ax,[fs:14h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,'x'
|
||||
; int 21h
|
||||
; xor ah,ah
|
||||
; mov al,[fs:19h]
|
||||
; call printnum
|
||||
; mov ah,02h
|
||||
; mov dl,13
|
||||
; int 21h
|
||||
; mov dl,10
|
||||
; int 21h
|
||||
|
||||
mov eax,[vesa2_x]
|
||||
cmp [fs:12h],ax ; Check that the height matches
|
||||
jnz near .loopcheckmodes
|
||||
mov eax,[vesa2_y]
|
||||
cmp [fs:14h],ax ; Check that the width matches
|
||||
jnz near .loopcheckmodes
|
||||
mov al,[vesa2_bits]
|
||||
cmp [fs:19h],al ; Check bits/pixel for match
|
||||
jnz near .loopcheckmodes
|
||||
|
||||
; mov ax,3
|
||||
; int 10h
|
||||
; xor eax,eax
|
||||
; mov ax,[fs:0h]
|
||||
; call printnum
|
||||
; jmp DosExit
|
||||
|
||||
mov byte[TripBufAvail],1
|
||||
test word[fs:0000h],400h
|
||||
jz .notbuf
|
||||
mov byte[TripBufAvail],1
|
||||
.notbuf
|
||||
|
||||
; jz .notvesa3
|
||||
; xor eax,eax
|
||||
; mov ax,[fs:0000h]
|
||||
; call printhex
|
||||
; jmp DosExit
|
||||
.notvesa3
|
||||
|
||||
; mov ah,07h
|
||||
; int 21h
|
||||
|
||||
; D0 = Window supported
|
||||
; 0 = Window is not supported
|
||||
; 1 = Window is supported
|
||||
; D1 = Window readable
|
||||
; 0 = Window is not readable
|
||||
; 1 = Window is readable
|
||||
; D2 = Window writeable
|
||||
; 0 = Window is not writeable
|
||||
; 1 = Window is writeable
|
||||
; D3-D7 = Reserved
|
||||
|
||||
mov byte[.whichwin],0
|
||||
mov al,[fs:2] ; Get window A attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
je .foundwin ; Mode supported
|
||||
mov al,[fs:3] ; Get window B attributes
|
||||
and al,0100b
|
||||
cmp al,0100b
|
||||
jne .foundwin ; Mode not supported
|
||||
mov byte[.whichwin],1
|
||||
.foundwin
|
||||
|
||||
; Success - a match has been found!!
|
||||
|
||||
sub ebp,2
|
||||
mov ax,[ebp]
|
||||
mov [vesamode],ax ; Store vesa 2 mode number
|
||||
|
||||
; call printhex
|
||||
; jmp DosExit
|
||||
|
||||
mov ax,[fs:10h]
|
||||
mov byte[vesa2red10],0
|
||||
mov byte[vesa2_rposng],11
|
||||
mov byte[vesa2_gposng],6
|
||||
mov byte[vesa2_bposng],0
|
||||
mov dword[vesa2_clbitng],1111011111011110b
|
||||
mov dword[vesa2_clbitng2],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b
|
||||
mov dword[vesa2_clbitng3],0111101111101111b
|
||||
mov [bytesperscanline],ax ; Store bytes per scan line
|
||||
cmp byte[fs:20h],10
|
||||
jne near .nored10
|
||||
mov byte[fs:20h],11
|
||||
mov byte[vesa2red10],1
|
||||
mov byte[vesa2_rposng],10
|
||||
mov byte[vesa2_gposng],5
|
||||
mov dword[vesa2_clbitng],0111101111011110b
|
||||
mov dword[vesa2_clbitng2],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b
|
||||
mov dword[vesa2_clbitng3],0011110111101111b
|
||||
|
||||
mov dword[UnusedBit], 10000000000000001000000000000000b
|
||||
mov dword[HalfTrans], 01111011110111100111101111011110b
|
||||
mov dword[UnusedBitXor], 01111111111111110111111111111111b
|
||||
mov dword[UnusedBit+4], 10000000000000001000000000000000b
|
||||
mov dword[HalfTrans+4], 01111011110111100111101111011110b
|
||||
mov dword[UnusedBitXor+4],01111111111111110111111111111111b
|
||||
mov dword[HalfTransB], 00000100001000010000010000100001b
|
||||
mov dword[HalfTransB+4], 00000100001000010000010000100001b
|
||||
mov dword[HalfTransC], 01111011110111100111101111011110b
|
||||
mov dword[HalfTransC+4], 01111011110111100111101111011110b
|
||||
mov dword[ngrposng],10
|
||||
mov dword[nggposng],5
|
||||
mov dword[ngbposng],0
|
||||
|
||||
.nored10
|
||||
; fix up bit lengths
|
||||
mov al,16
|
||||
sub al,[fs:20h]
|
||||
mov ah,[fs:22h]
|
||||
sub ah,[fs:20h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:20h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1
|
||||
mov bh,ah
|
||||
.scheck1
|
||||
cmp bh,bl
|
||||
jb .scheck2
|
||||
mov bh,bl
|
||||
.scheck2
|
||||
mov byte[fs:19h],5
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:22h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:22h]
|
||||
mov bl,[fs:24h]
|
||||
sub bl,[fs:22h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1b
|
||||
mov bh,ah
|
||||
.scheck1b
|
||||
cmp bh,bl
|
||||
jb .scheck2b
|
||||
mov bh,bl
|
||||
.scheck2b
|
||||
mov [fs:21h],bh
|
||||
|
||||
mov al,16
|
||||
sub al,[fs:24h]
|
||||
mov ah,[fs:20h]
|
||||
sub ah,[fs:24h]
|
||||
mov bl,[fs:22h]
|
||||
sub bl,[fs:24h]
|
||||
mov bh,al
|
||||
cmp bh,ah
|
||||
jb .scheck1c
|
||||
mov bh,ah
|
||||
.scheck1c
|
||||
cmp bh,bl
|
||||
jb .scheck2c
|
||||
mov bh,bl
|
||||
.scheck2c
|
||||
mov [fs:23h],bh
|
||||
|
||||
mov word[vesa2_clbit],0
|
||||
|
||||
cmp byte[fs:20h],10
|
||||
jne .nottopbit
|
||||
mov word[vesa2_usbit],8000h
|
||||
.nottopbit
|
||||
|
||||
; Process Red Stuff
|
||||
mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:19h],6
|
||||
jne .no6bit
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bit
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_rpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrr
|
||||
shl bx,cl
|
||||
jmp .shlr
|
||||
.shrr
|
||||
shr bx,1
|
||||
.shlr
|
||||
mov word[vesa2_rfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_rtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_rtrcla],bx
|
||||
|
||||
; mov ax,03h
|
||||
; int 10h
|
||||
; mov ax,[vesa2_rfull]
|
||||
; call printhex
|
||||
; jmp DosExit
|
||||
|
||||
; Process Green Stuff
|
||||
mov al,[fs:22h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:21h],6
|
||||
jne .no6bitb
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitb
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_gpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrg
|
||||
shl bx,cl
|
||||
jmp .shlg
|
||||
.shrg
|
||||
shr bx,1
|
||||
.shlg
|
||||
mov word[vesa2_gfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_gtrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_gtrcla],bx
|
||||
|
||||
; Process Blue Stuff
|
||||
mov al,[fs:24h]
|
||||
mov cl,al
|
||||
mov bx,1
|
||||
shl bx,cl
|
||||
cmp byte[fs:23h],6
|
||||
jne .no6bitc
|
||||
mov [vesa2_usbit],bx
|
||||
inc al
|
||||
.no6bitc
|
||||
or [vesa2_clbit],bx
|
||||
mov [vesa2_bpos],al
|
||||
dec al
|
||||
mov cl,al
|
||||
mov bx,001Fh
|
||||
cmp cl,0FFh
|
||||
je .shrb
|
||||
shl bx,cl
|
||||
jmp .shlb
|
||||
.shrb
|
||||
shr bx,1
|
||||
.shlb
|
||||
mov word[vesa2_bfull],bx
|
||||
add al,5
|
||||
mov bx,1
|
||||
mov cl,al
|
||||
shl bx,cl
|
||||
mov word[vesa2_btrcl],bx
|
||||
xor bx,0FFFFh
|
||||
mov word[vesa2_btrcla],bx
|
||||
|
||||
xor word[vesa2_clbit],0FFFFh
|
||||
|
||||
;vesa2_rtrcl dw 0 ; red transparency clear (bit+4)
|
||||
;vesa2_rtrcla dw 0 ; red transparency (AND) clear (not(bit+4))
|
||||
;vesa2_rfull dw 0 ; red max (or (bit-1)*1Fh)
|
||||
|
||||
call genfulladdtab
|
||||
|
||||
test word[fs:0h],10000000b ; Check if linear available
|
||||
jnz .linearavailable
|
||||
mov edx,.nolframebuffer
|
||||
jmp VESA2EXITTODOS ; None available
|
||||
.nolframebuffer db 'Linear Frame Buffer not Detected.',0
|
||||
|
||||
;---------------------------------------------;
|
||||
; OK - now set the vesa 2 mode based on the ;
|
||||
; information gleaned... ;
|
||||
;---------------------------------------------;
|
||||
|
||||
.linearavailable
|
||||
or word[vesamode],4000h ; Convert mode to its LFB
|
||||
; equivalent
|
||||
mov ebx,[fs:28h] ; Read in physical base ptr
|
||||
|
||||
mov cx,bx
|
||||
shr ebx,16
|
||||
mov si,[noblocks]
|
||||
xor edi,edi ; Since noblocks = number of
|
||||
; 64k blocks, these lines leave
|
||||
; si:di holding byte size
|
||||
mov eax,800h
|
||||
int 31h
|
||||
jnc .mappedphysicalarea
|
||||
mov edx,.unablemap
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
.unablemap db 'Unable to map physical area.',0
|
||||
|
||||
.mappedphysicalarea
|
||||
shl ebx,16
|
||||
mov bx,cx
|
||||
mov [LFBpointer],ebx
|
||||
mov eax,ebx
|
||||
sub eax,[ZSNESBase]
|
||||
mov [VESAAddr],eax
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov ax,4f02h
|
||||
mov bx,[vesamode]
|
||||
int 10h ; Set the vesa mode
|
||||
cmp ax,004fh
|
||||
jz .modesetok
|
||||
mov edx,.unableset
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
.unableset db 'Unable to initialize video mode.',0
|
||||
|
||||
.modesetok
|
||||
;******************************* EXTRA BIT ****************************
|
||||
|
||||
; cmp byte[.whichwin],1 ; Check if Write is at Window B
|
||||
; jne .nowinB
|
||||
;
|
||||
; mov ax,4F05h
|
||||
; mov bx,1
|
||||
; mov dx,0
|
||||
; int 10h
|
||||
;
|
||||
;.nowinB
|
||||
|
||||
; Check logical scanline length
|
||||
mov eax,4f06h
|
||||
mov ebx,1
|
||||
int 10h
|
||||
cmp cx,[vesa2_x]
|
||||
je .correctwidth
|
||||
|
||||
mov eax,4f06h ; VBE Set/Get logical scan line
|
||||
; length
|
||||
mov ebx,0 ; Set scan line length in
|
||||
; pixels
|
||||
mov ecx, [vesa2_x] ; Desired screen width
|
||||
int 10h
|
||||
cmp ax,04fh
|
||||
jz .correctwidth
|
||||
mov edx, .unablescan
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
.unablescan db 'Unable to set scan line length.',0
|
||||
|
||||
.correctwidth
|
||||
|
||||
;*************************** END OF EXTRA BIT *************************
|
||||
|
||||
xor eax,eax
|
||||
mov ecx,1
|
||||
int 31h ; Allocate a descriptor
|
||||
|
||||
mov bx,ax ; Move our selector into bx
|
||||
|
||||
mov ecx,[LFBpointer]
|
||||
mov dx,cx
|
||||
shr ecx,16
|
||||
mov eax,7
|
||||
int 31h ; Set our selector to LFB
|
||||
jnc .selectornowset
|
||||
mov edx,.unablelfb
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
.unablelfb db 'Unable to set selector to LFB.',0
|
||||
|
||||
.selectornowset
|
||||
|
||||
xor ecx,ecx
|
||||
mov cx,[noblocks]
|
||||
shl ecx,6 ; Multiply by 64
|
||||
shl ecx,10 ; And again by 1024
|
||||
sub ecx,1 ; Necessary!!!
|
||||
mov dx,cx
|
||||
shr ecx,16 ; CX:DX size of screen
|
||||
mov eax,8
|
||||
int 31h ; Set size of selector
|
||||
jnc .ok
|
||||
mov edx,.unablesets
|
||||
jmp VESA2EXITTODOS ; Failure!!!
|
||||
.unablesets db 'Unable to set size of selector.',0
|
||||
|
||||
.ok
|
||||
lar ecx,ebx
|
||||
shr ecx,8
|
||||
and cl,60h
|
||||
or cl,93h
|
||||
and ch,0c0h ; Keep granularity bit
|
||||
mov ax,9
|
||||
int 31h ; Set selector access rights
|
||||
jnc .accessrightsset
|
||||
mov edx,.unablesetar
|
||||
jmp VESA2EXITTODOS
|
||||
.unablesetar db 'Unable to set selector access rights.',0
|
||||
|
||||
.accessrightsset
|
||||
mov [vesa2selec],bx
|
||||
|
||||
cmp byte[vesa2red10],1
|
||||
je .red10
|
||||
mov eax,565
|
||||
jmp .red11
|
||||
.red10
|
||||
mov eax,555
|
||||
.red11
|
||||
push eax
|
||||
call Init_2xSaIMMX
|
||||
call Init_2xSaI
|
||||
pop eax
|
||||
ret
|
||||
|
||||
NEWSYM LFBpointer
|
||||
dd 0
|
||||
NEWSYM noblocks
|
||||
dw 0
|
||||
NEWSYM bytesperscanline
|
||||
dw 0
|
||||
NEWSYM vesamode
|
||||
dw 0
|
||||
;----------------------------------------------------------------------
|
||||
NEWSYM VESAmodelist
|
||||
times 512 dw 0
|
||||
;----------------------------------------------------------------------
|
||||
NEWSYM RMREGS
|
||||
.edi dd 0
|
||||
.esi dd 0
|
||||
.ebp dd 0
|
||||
.esp dd 0
|
||||
.ebx dd 0
|
||||
.edx dd 0
|
||||
.ecx dd 0
|
||||
.eax dd 0
|
||||
|
||||
.flags dw 0
|
||||
.es dw 0
|
||||
.ds dw 0
|
||||
.fs dw 0
|
||||
.gs dw 0
|
||||
.ip dw 0
|
||||
.cs dw 0
|
||||
.sp dw 0
|
||||
.ss dw 0
|
||||
.spare times 20 dd 0
|
||||
;----------------------------------------------------------------------
|
||||
|
||||
267
zsnes/src/dos/zfile.c
Normal file
267
zsnes/src/dos/zfile.c
Normal file
@@ -0,0 +1,267 @@
|
||||
//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 <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef ZDOS
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define DWORD unsigned int
|
||||
#define BYTE unsigned char
|
||||
|
||||
FILE *FILEHANDLE[16];
|
||||
DWORD CurrentHandle=0;
|
||||
|
||||
|
||||
|
||||
// ZFileSystemInit
|
||||
// return 0
|
||||
|
||||
// ZOpenFile info :
|
||||
BYTE * ZOpenFileName;
|
||||
DWORD ZOpenMode;
|
||||
// Open modes : 0 read/write in
|
||||
// 1 write (create file, overwrite)
|
||||
// return file handle if success, 0xFFFFFFFF if error
|
||||
|
||||
// ZCloseFile info :
|
||||
DWORD ZCloseFileHandle;
|
||||
// return 0
|
||||
|
||||
// ZFileSeek info :
|
||||
DWORD ZFileSeekHandle;
|
||||
DWORD ZFileSeekPos;
|
||||
DWORD ZFileSeekMode; // 0 start, 1 end
|
||||
// return 0
|
||||
|
||||
// ZFileReadBlock info :
|
||||
BYTE * ZFileReadBlock;
|
||||
DWORD ZFileReadSize;
|
||||
DWORD ZFileReadHandle;
|
||||
// return 0
|
||||
|
||||
// ZFileWriteBlock info :
|
||||
BYTE * ZFileWriteBlock;
|
||||
DWORD ZFileWriteSize;
|
||||
DWORD ZFileWriteHandle;
|
||||
// return 0
|
||||
|
||||
// ZFileTell
|
||||
DWORD ZFileTellHandle;
|
||||
|
||||
// ZFileGetftime
|
||||
BYTE * ZFFTimeFName;
|
||||
DWORD ZFTimeHandle;
|
||||
DWORD ZFDate;
|
||||
DWORD ZFTime;
|
||||
|
||||
// MKDir/CHDir
|
||||
BYTE * MKPath;
|
||||
BYTE * CHPath;
|
||||
BYTE * RMPath;
|
||||
|
||||
// GetDir
|
||||
BYTE * DirName;
|
||||
DWORD DriveNumber;
|
||||
|
||||
// ZFileDelete
|
||||
BYTE * ZFileDelFName;
|
||||
// return current position
|
||||
|
||||
DWORD ZFileSystemInit()
|
||||
{
|
||||
CurrentHandle=0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZOpenFile()
|
||||
{
|
||||
if(ZOpenMode==0)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"))!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
if(ZOpenMode==1)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"))!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
if(ZOpenMode==2)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"))!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
DWORD ZCloseFile()
|
||||
{
|
||||
fclose(FILEHANDLE[ZCloseFileHandle]);
|
||||
CurrentHandle-=1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZFileSeek()
|
||||
{
|
||||
if(ZFileSeekMode==0)
|
||||
{
|
||||
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
if(ZFileSeekMode==1)
|
||||
{
|
||||
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_END);
|
||||
return(0);
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
DWORD ZFileRead()
|
||||
{
|
||||
return(fread(ZFileReadBlock,1,ZFileReadSize,FILEHANDLE[ZFileReadHandle]));
|
||||
}
|
||||
|
||||
|
||||
DWORD ZFileWrite()
|
||||
{
|
||||
if((fwrite(ZFileWriteBlock,1,ZFileWriteSize,FILEHANDLE[ZFileWriteHandle]))!=ZFileWriteSize) return(0xFFFFFFFF);
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZFileTell()
|
||||
{
|
||||
return(ftell(FILEHANDLE[ZFileTellHandle]));
|
||||
}
|
||||
|
||||
DWORD ZFileDelete()
|
||||
{
|
||||
return(remove(ZFileDelFName));
|
||||
}
|
||||
|
||||
|
||||
DWORD ZFileGetFTime()
|
||||
{
|
||||
_dos_open(ZFFTimeFName, 0,&ZFTimeHandle);
|
||||
_dos_getftime(ZFTimeHandle,&ZFDate,&ZFTime);
|
||||
_dos_close(ZFTimeHandle);
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZFileMKDir()
|
||||
{
|
||||
return(mkdir(MKPath));
|
||||
}
|
||||
|
||||
DWORD ZFileCHDir()
|
||||
{
|
||||
return(chdir(CHPath));
|
||||
}
|
||||
|
||||
DWORD ZFileRMDir()
|
||||
{
|
||||
return(rmdir(RMPath));
|
||||
}
|
||||
|
||||
DWORD ZFileGetDir()
|
||||
{
|
||||
return(getcwd(DirName,128));
|
||||
}
|
||||
|
||||
BYTE * ZFileFindPATH;
|
||||
DWORD ZFileFindATTRIB;
|
||||
DWORD DTALocPos;
|
||||
|
||||
//struct _find_t {
|
||||
// char reserved[21] __attribute__((packed));
|
||||
// unsigned char attrib __attribute__((packed));
|
||||
// unsigned short wr_time __attribute__((packed));
|
||||
// unsigned short wr_date __attribute__((packed));
|
||||
// unsigned long size __attribute__((packed));
|
||||
// char name[256] __attribute__((packed));
|
||||
//};
|
||||
|
||||
DWORD ZFileFindFirst()
|
||||
{
|
||||
return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,DTALocPos));
|
||||
}
|
||||
|
||||
DWORD ZFileFindNext()
|
||||
{
|
||||
return(_dos_findnext(DTALocPos));
|
||||
}
|
||||
|
||||
DWORD ZFileFindEnd() // for compatibility with windows later
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
//BYTE * DirName;
|
||||
//DWORD DriveNumber;
|
||||
|
||||
//unsigned int _dos_findfirst(char *_name, unsigned int _attr, struct _find_t *_result);
|
||||
//unsigned int _dos_findnext(struct _find_t *_result);
|
||||
|
||||
|
||||
DWORD GetTime()
|
||||
{
|
||||
|
||||
DWORD value;
|
||||
struct tm *newtime;
|
||||
time_t long_time;
|
||||
|
||||
time( &long_time );
|
||||
newtime = localtime( &long_time );
|
||||
|
||||
value = ((newtime->tm_sec) % 10)+((newtime->tm_sec)/10)*16
|
||||
+((((newtime->tm_min) % 10)+((newtime->tm_min)/10)*16) << 8)
|
||||
+((((newtime->tm_hour) % 10)+((newtime->tm_hour)/10)*16) << 16);
|
||||
return(value);
|
||||
}
|
||||
|
||||
DWORD GetDate()
|
||||
{
|
||||
|
||||
DWORD value;
|
||||
struct tm *newtime;
|
||||
time_t long_time;
|
||||
|
||||
time( &long_time );
|
||||
newtime = localtime( &long_time );
|
||||
value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16
|
||||
+(((newtime->tm_mon)+1) << 8)
|
||||
+((((newtime->tm_year) % 10)+((newtime->tm_year)/10)*16) << 16);
|
||||
+((newtime->tm_wday) << 28);
|
||||
|
||||
return(value);
|
||||
}
|
||||
396
zsnes/src/dos/zloader.c
Normal file
396
zsnes/src/dos/zloader.c
Normal file
@@ -0,0 +1,396 @@
|
||||
//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 <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
extern void zstart(void);
|
||||
extern void DosExit(void);
|
||||
extern void ConvertJoyMap1(void);
|
||||
extern void ConvertJoyMap2(void);
|
||||
extern void displayparams(void);
|
||||
extern void makeextension(void);
|
||||
|
||||
extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
|
||||
FPUCopy, Force8b, ForcePal, GUIClick, MouseDis,
|
||||
MusicRelVol, ScreenScale, SoundCompD, SoundQuality,
|
||||
StereoSound, V8Mode, antienab, cvidmode, debugdisble,
|
||||
debugger, enterpress, finterleave, frameskip,
|
||||
gammalevel, guioff, per2exec, pl1contrl, pl2contrl,
|
||||
romtype, scanlines, showallext, smallscreenon, soundon,
|
||||
spcon, vsyncon, DisplayS, fname, filefound, SnowOn;
|
||||
|
||||
void ccmdline(void);
|
||||
|
||||
char *ers[] =
|
||||
{
|
||||
"Frame Skip must be a value of 0 to 9!\n",
|
||||
"Gamma Correction Level must be a value of 0 to 5!\n",
|
||||
"Sound Sampling Rate must be a value of 0 to 6!\n",
|
||||
"Invalid Video Mode!\n",
|
||||
"Percentage of instructions to execute must be a number from 50 to 150!\n",
|
||||
"Player Input must be a value from 0 to 6!\n",
|
||||
"Volume must be a number from 0 to 100!\n"
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
int argc;
|
||||
char **argv;
|
||||
int main(int margc, char **margv)
|
||||
{
|
||||
argc=margc;
|
||||
argv=margv;
|
||||
zstart();
|
||||
}
|
||||
|
||||
|
||||
int my_atoi(char *nptr)
|
||||
{
|
||||
int p,c;
|
||||
c=0;
|
||||
for(p=0;nptr[p];p++)
|
||||
{
|
||||
if( !isdigit(nptr[p]) ) c+=1;
|
||||
}
|
||||
if(c) return -1;
|
||||
else return atoi(nptr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ccmdline(void)
|
||||
{
|
||||
int p=0;
|
||||
p=pccmdline();
|
||||
if(p == 0) return;
|
||||
|
||||
if(p == 9)
|
||||
{
|
||||
displayparams();
|
||||
}
|
||||
if(p == 4)
|
||||
{
|
||||
// printf("Mangled command line, did you forget a parm?\n");
|
||||
printf("Invalid Commandline!\n");
|
||||
DosExit();
|
||||
}
|
||||
|
||||
if((p > 9) && (p < 17))
|
||||
{
|
||||
printf(ers[p-10]);
|
||||
DosExit();
|
||||
}
|
||||
if(p == 2)
|
||||
{
|
||||
DosExit();
|
||||
}
|
||||
|
||||
|
||||
printf("cmdline returned %i\n",p);
|
||||
DosExit();
|
||||
|
||||
}
|
||||
|
||||
int pccmdline(void)
|
||||
{
|
||||
int p;
|
||||
int gfnm=0;
|
||||
|
||||
for(p=1;p<argc;p++)
|
||||
{
|
||||
/*
|
||||
printf("(%i/%i): %s\n",p,argc,argv[p]);
|
||||
*/
|
||||
|
||||
if(argv[p][0] == '-')
|
||||
{
|
||||
int hasroom=0;
|
||||
int pp=1;
|
||||
int cp=p;
|
||||
int nn='_';
|
||||
for(pp=1;argv[cp][pp];pp++)
|
||||
{
|
||||
if( (p+1) < argc) hasroom=1;
|
||||
nn=tolower(argv[cp][pp+1]);
|
||||
switch(tolower(argv[cp][pp]))
|
||||
{
|
||||
case '1': /* Player 1 Input */
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
pl1contrl=my_atoi(argv[p+1]);
|
||||
if(pl1contrl > 6) return 15;
|
||||
p++;
|
||||
ConvertJoyMap1();
|
||||
break;
|
||||
}
|
||||
case '2': /* Player 2 Input */
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
pl2contrl=my_atoi(argv[p+1]);
|
||||
if(pl2contrl > 6) return 15;
|
||||
p++;
|
||||
ConvertJoyMap2();
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
frameskip=my_atoi(argv[p+1]);
|
||||
if(frameskip > 9) return 10;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
case 'g':
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
gammalevel=my_atoi(argv[p+1]);
|
||||
if(gammalevel > 5) return 11;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
case 'p':
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
per2exec=my_atoi(argv[p+1]);
|
||||
if(per2exec > 150) return 14;
|
||||
if(per2exec < 50) return 14;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
case 'r':
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
SoundQuality=my_atoi(argv[p+1]);
|
||||
if(SoundQuality > 6) return 12;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
case 'v':
|
||||
{
|
||||
if(nn == '8')
|
||||
{
|
||||
V8Mode=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
cvidmode=my_atoi(argv[p+1]);
|
||||
if(cvidmode > 10) return 13;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'k':
|
||||
{
|
||||
if(!hasroom) return 4;
|
||||
MusicRelVol=my_atoi(argv[p+1]);
|
||||
if(MusicRelVol > 100) return 16;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
case '8':
|
||||
{
|
||||
Force8b=1;
|
||||
break;
|
||||
}
|
||||
case '0': /* Palette 0 disable */
|
||||
{
|
||||
Palette0=1;
|
||||
break;
|
||||
}
|
||||
case '7': /* SPC700 speed hack disable */
|
||||
{
|
||||
SPC700sh=1;
|
||||
break;
|
||||
}
|
||||
case '9': /* Off by 1 line */
|
||||
{
|
||||
OffBy1Line=1;
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
{
|
||||
enterpress=1;
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
{
|
||||
romtype=2;
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
{
|
||||
romtype=1;
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
{
|
||||
guioff=1; /* disables GUI */
|
||||
break;
|
||||
}
|
||||
case 'n':
|
||||
{
|
||||
scanlines=1;
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
{
|
||||
if(nn == 'p')
|
||||
{
|
||||
DisplayS=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
if(nn == 'a')
|
||||
{
|
||||
showallext=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
if(nn == 'n')
|
||||
{
|
||||
SnowOn=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
spcon=1;
|
||||
soundon=1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
{
|
||||
ForcePal=1;
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
{
|
||||
ForcePal=2;
|
||||
break;
|
||||
}
|
||||
case 'w':
|
||||
{
|
||||
vsyncon=1;
|
||||
break;
|
||||
}
|
||||
case 'z':
|
||||
{
|
||||
StereoSound=1;
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
{
|
||||
if(nn == 'd')
|
||||
{
|
||||
DSPDisable=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
debugger=1;
|
||||
debugdisble=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'b':
|
||||
{
|
||||
SoundCompD=1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c':
|
||||
{
|
||||
if(nn == 'c')
|
||||
{
|
||||
smallscreenon=1;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScreenScale=1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'y':
|
||||
{
|
||||
antienab=1;
|
||||
break;
|
||||
}
|
||||
case 'o':
|
||||
{
|
||||
if(nn == 'm')
|
||||
{
|
||||
FPUCopy=2;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FPUCopy=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'i':
|
||||
{
|
||||
finterleave=1;
|
||||
break;
|
||||
}
|
||||
case 'j':
|
||||
{
|
||||
GUIClick=0;
|
||||
MouseDis=1;
|
||||
break;
|
||||
}
|
||||
case '?':
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gfnm > 0)
|
||||
{
|
||||
printf("Limit yourself to one filename\n");
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *fvar;
|
||||
fvar=&fname;
|
||||
fvar[0] = strlen(argv[p]);
|
||||
strncpy(&fvar[1],argv[p],127);
|
||||
gfnm++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(gfnm == 1)
|
||||
{
|
||||
filefound=0;
|
||||
makeextension();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
212
zsnes/src/dos/zsipx.asm
Normal file
212
zsnes/src/dos/zsipx.asm
Normal file
@@ -0,0 +1,212 @@
|
||||
;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 ipx_init ; To init ipx
|
||||
EXTSYM ipx_initcode ; return 0 if everything is ok (int)
|
||||
EXTSYM ipx_packet ; 80 bytes buffer to send
|
||||
EXTSYM ipx_packet_size ; size to send (max 80 bytes) (dword)
|
||||
EXTSYM sendpacket ; to send a packet
|
||||
EXTSYM checkpacket ; check if a packet is ready to receive
|
||||
EXTSYM ipx_packet_ready ; return 1 if there is a packet ready (byte)
|
||||
EXTSYM read_packet ; to read an incoming packet
|
||||
EXTSYM ipx_read_packet ; 80 bytes buffer of received packet
|
||||
EXTSYM ipx_deinit ; to deinit the ipx
|
||||
EXTSYM IPXInfoStr,IPXInfoStrR
|
||||
EXTSYM modembuffer, modemhead, modemtail
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM ipxinited, db 0
|
||||
|
||||
NEWSYM initipx
|
||||
mov dword[modemhead],0
|
||||
mov dword[modemtail],0
|
||||
xor ax,ax
|
||||
cmp byte[ipxinited],1
|
||||
je .notokay
|
||||
call ipx_init
|
||||
mov ax,[ipx_initcode]
|
||||
cmp ax,0
|
||||
jne .notokay
|
||||
mov byte[ipxinited],1
|
||||
.notokay
|
||||
ret
|
||||
|
||||
NEWSYM deinitipx
|
||||
cmp byte[ipxinited],0
|
||||
je .notinitialized
|
||||
mov byte[ipxinited],0
|
||||
call ipx_deinit
|
||||
.notinitialized
|
||||
ret
|
||||
|
||||
NEWSYM PacketPointer, dd 0
|
||||
|
||||
NEWSYM PreparePacketIPX
|
||||
cmp byte[ipxinited],1
|
||||
jne .noipx
|
||||
call ipxpp
|
||||
.noipx
|
||||
ret
|
||||
|
||||
NEWSYM SendPacketIPX
|
||||
cmp byte[ipxinited],1
|
||||
jne .noipx
|
||||
call ipxsp
|
||||
.noipx
|
||||
ret
|
||||
|
||||
NEWSYM ipxsendchar ; prepare packet
|
||||
push esi
|
||||
mov esi,[PacketPointer]
|
||||
mov [esi],al
|
||||
inc dword[PacketPointer]
|
||||
pop esi
|
||||
ret
|
||||
|
||||
NEWSYM IPXSearchval, db 0
|
||||
NEWSYM ipxlookforconnect
|
||||
cmp byte[ipxinited],0
|
||||
je .initialized
|
||||
ret
|
||||
.initialized
|
||||
pushad
|
||||
call checkpacket
|
||||
cmp byte[ipx_packet_ready],1
|
||||
jne near .nopacket
|
||||
call read_packet
|
||||
cmp dword[ipx_read_packet],'ZZ|Z'
|
||||
jne .nopacketf
|
||||
cmp byte[ipx_read_packet+6],'L'
|
||||
jne .nopacketf
|
||||
mov ax,[ipx_read_packet+4]
|
||||
cmp ax,[IPXInfoStr]
|
||||
je .nopacketf
|
||||
mov [IPXInfoStrR],ax
|
||||
mov eax,ipx_packet
|
||||
mov dword[eax],'ZY|Z'
|
||||
mov bx,[IPXInfoStr]
|
||||
mov [eax+4],bx
|
||||
mov bx,[IPXInfoStrR]
|
||||
mov [eax+6],bx
|
||||
mov dword[ipx_packet_size],8
|
||||
call sendpacket
|
||||
mov byte[IPXSearchval],1
|
||||
jmp .skipall
|
||||
.nopacketf
|
||||
cmp dword[ipx_read_packet],'ZY|Z'
|
||||
jne .nopacket
|
||||
mov bx,[IPXInfoStr]
|
||||
cmp [eax+6],bx
|
||||
jne .nopacket
|
||||
mov bx,[eax+4]
|
||||
cmp bx,[IPXInfoStr]
|
||||
je .nopacket
|
||||
mov [IPXInfoStrR],bx
|
||||
mov byte[IPXSearchval],1
|
||||
jmp .skipall
|
||||
.nopacket
|
||||
mov eax,ipx_packet
|
||||
mov dword[eax],'ZZ|Z'
|
||||
mov bx,[IPXInfoStr]
|
||||
mov [eax+4],bx
|
||||
mov byte[eax+6],'L'
|
||||
mov dword[ipx_packet_size],7
|
||||
call sendpacket
|
||||
.skipall
|
||||
popad
|
||||
ret
|
||||
|
||||
NEWSYM ipxpp ; prepare packet
|
||||
pushad
|
||||
mov eax,ipx_packet
|
||||
mov byte[eax],'Z'
|
||||
mov byte[eax+1],'|'
|
||||
mov byte[eax+2],'S'
|
||||
mov bx,[IPXInfoStr]
|
||||
mov [eax+3],bx
|
||||
add eax,6
|
||||
mov [PacketPointer],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
NEWSYM ipxsp ; send packet
|
||||
pushad
|
||||
mov eax,[PacketPointer]
|
||||
sub eax,ipx_packet
|
||||
mov [ipx_packet+5],al
|
||||
mov [ipx_packet_size],eax
|
||||
call sendpacket
|
||||
popad
|
||||
ret
|
||||
|
||||
NEWSYM ipxgetchar
|
||||
pushad
|
||||
call checkpacket
|
||||
cmp byte[ipx_packet_ready],1
|
||||
jne .nopacket
|
||||
call read_packet
|
||||
cmp byte[ipx_read_packet],'Z'
|
||||
jne .nopacket
|
||||
cmp byte[ipx_read_packet+1],'|'
|
||||
jne .nopacket
|
||||
cmp byte[ipx_read_packet+2],'S'
|
||||
jne .nopacket
|
||||
mov bx,[IPXInfoStrR]
|
||||
cmp [ipx_read_packet+3],bx
|
||||
jne .nopacket
|
||||
mov cl,[ipx_read_packet+5]
|
||||
sub cl,6
|
||||
mov esi,ipx_read_packet+6
|
||||
cmp cl,0
|
||||
je .nopacket
|
||||
.loop
|
||||
mov edi,[modemtail]
|
||||
mov al,[esi]
|
||||
mov [modembuffer+edi],al
|
||||
inc dword[modemtail]
|
||||
inc esi
|
||||
and dword[modemtail],2047
|
||||
dec cl
|
||||
jnz .loop
|
||||
.nopacket
|
||||
popad
|
||||
push eax
|
||||
xor dh,dh
|
||||
mov eax,[modemhead]
|
||||
cmp eax,[modemtail]
|
||||
je .nonewchar
|
||||
mov dh,1
|
||||
mov dl,[modembuffer+eax]
|
||||
inc dword[modemhead]
|
||||
and dword[modemhead],2047
|
||||
.nonewchar
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
250
zsnes/src/endmem.asm
Normal file
250
zsnes/src/endmem.asm
Normal file
@@ -0,0 +1,250 @@
|
||||
;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"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEWSYM romdatahere
|
||||
|
||||
; Much of this used to be in uninitialized space, until I discovered that
|
||||
; ZSNES was unstable because of them... Odd.
|
||||
|
||||
Stuff db 'ZSNES v?.??? / Freeware, programmed by zsKnight, _Demo_, and Pharos',13,10,0
|
||||
|
||||
ALIGN32
|
||||
|
||||
NEWSYM wramdataa, times 65536 db 0
|
||||
NEWSYM ram7fa, times 65536 db 0
|
||||
NEWSYM Inbetweendat, dd 0,0,0,0
|
||||
NEWSYM opcjmptab, times 256 dd 0
|
||||
|
||||
NEWSYM Bank0datr8 ,times 256 dd 0
|
||||
NEWSYM Bank0datr16,times 256 dd 0
|
||||
NEWSYM Bank0datw8 ,times 256 dd 0
|
||||
NEWSYM Bank0datw16,times 256 dd 0
|
||||
|
||||
NEWSYM tableA, times 256 dd 0
|
||||
NEWSYM tableB, times 256 dd 0
|
||||
NEWSYM tableC, times 256 dd 0
|
||||
NEWSYM tableD, times 256 dd 0
|
||||
NEWSYM tableE, times 256 dd 0
|
||||
NEWSYM tableF, times 256 dd 0
|
||||
NEWSYM tableG, times 256 dd 0
|
||||
NEWSYM tableH, times 256 dd 0
|
||||
|
||||
NEWSYM tableAb, times 256 dd 0
|
||||
NEWSYM tableBb, times 256 dd 0
|
||||
NEWSYM tableCb, times 256 dd 0
|
||||
NEWSYM tableDb, times 256 dd 0
|
||||
NEWSYM tableEb, times 256 dd 0
|
||||
NEWSYM tableFb, times 256 dd 0
|
||||
NEWSYM tableGb, times 256 dd 0
|
||||
NEWSYM tableHb, times 256 dd 0
|
||||
|
||||
NEWSYM tableAc, times 256 dd 0
|
||||
NEWSYM tableBc, times 256 dd 0
|
||||
NEWSYM tableCc, times 256 dd 0
|
||||
NEWSYM tableDc, times 256 dd 0
|
||||
NEWSYM tableEc, times 256 dd 0
|
||||
NEWSYM tableFc, times 256 dd 0
|
||||
NEWSYM tableGc, times 256 dd 0
|
||||
NEWSYM tableHc, times 256 dd 0
|
||||
|
||||
NEWSYM SA1tableA, times 256 dd 0
|
||||
NEWSYM SA1tableB, times 256 dd 0
|
||||
NEWSYM SA1tableC, times 256 dd 0
|
||||
NEWSYM SA1tableD, times 256 dd 0
|
||||
NEWSYM SA1tableE, times 256 dd 0
|
||||
NEWSYM SA1tableF, times 256 dd 0
|
||||
NEWSYM SA1tableG, times 256 dd 0
|
||||
NEWSYM SA1tableH, times 256 dd 0
|
||||
|
||||
NEWSYM tablead, times 256 dd 0
|
||||
NEWSYM tableadb, times 256 dd 0
|
||||
NEWSYM tableadc, times 256 dd 0
|
||||
NEWSYM SA1tablead, times 256 dd 0
|
||||
|
||||
NEWSYM memtabler8, times 256 dd 0
|
||||
NEWSYM memtablew8, times 256 dd 0
|
||||
NEWSYM memtabler16, times 256 dd 0
|
||||
NEWSYM memtablew16, times 256 dd 0
|
||||
NEWSYM vidmemch2, times 4096 db 0
|
||||
NEWSYM vidmemch4, times 4096 db 0
|
||||
NEWSYM vidmemch8, times 4096 db 0
|
||||
NEWSYM snesmmap, times 256 dd 0
|
||||
NEWSYM snesmap2, times 256 dd 0
|
||||
NEWSYM cachebg1, times 64 db 0
|
||||
NEWSYM cachebg2, times 64 db 0
|
||||
NEWSYM cachebg3, times 64 db 0
|
||||
NEWSYM cachebg4, times 64 db 0
|
||||
NEWSYM sprlefttot, times 256 db 0
|
||||
NEWSYM sprleftpr, times 256 db 0
|
||||
NEWSYM sprleftpr1, times 256 db 0
|
||||
NEWSYM sprleftpr2, times 256 db 0
|
||||
NEWSYM sprleftpr3, times 256 db 0
|
||||
NEWSYM sprpriodata, times 288 db 0
|
||||
NEWSYM sprprtabc, times 64 db 0
|
||||
NEWSYM sprprtabu, times 64 db 0
|
||||
NEWSYM prevpal, times 256 dw 0 ; previous palette buffer
|
||||
NEWSYM winbgdata, times 288 db 0 ; window buffer for backgrounds
|
||||
NEWSYM winspdata, times 288 db 0 ; window buffer for sprites
|
||||
NEWSYM FxTable, times 256 dd 0
|
||||
NEWSYM FxTableA1, times 256 dd 0
|
||||
NEWSYM FxTableA2, times 256 dd 0
|
||||
NEWSYM FxTableA3, times 256 dd 0
|
||||
NEWSYM FxTableb, times 256 dd 0
|
||||
NEWSYM FxTablebA1, times 256 dd 0
|
||||
NEWSYM FxTablebA2, times 256 dd 0
|
||||
NEWSYM FxTablebA3, times 256 dd 0
|
||||
NEWSYM FxTablec, times 256 dd 0
|
||||
NEWSYM FxTablecA1, times 256 dd 0
|
||||
NEWSYM FxTablecA2, times 256 dd 0
|
||||
NEWSYM FxTablecA3, times 256 dd 0
|
||||
NEWSYM FxTabled, times 256 dd 0
|
||||
NEWSYM FxTabledA1, times 256 dd 0
|
||||
NEWSYM FxTabledA2, times 256 dd 0
|
||||
NEWSYM FxTabledA3, times 256 dd 0
|
||||
NEWSYM SfxMemTable, times 256 dd 0
|
||||
NEWSYM fxxand, times 256 dd 0
|
||||
NEWSYM fxbit01, times 256 dd 0
|
||||
NEWSYM fxbit23, times 256 dd 0
|
||||
NEWSYM fxbit45, times 256 dd 0
|
||||
NEWSYM fxbit67, times 256 dd 0
|
||||
NEWSYM PLOTJmpa, times 64 dd 0
|
||||
NEWSYM PLOTJmpb, times 64 dd 0
|
||||
|
||||
NEWSYM pal16b, times 256 dd 0
|
||||
NEWSYM pal16bcl, times 256 dd 0
|
||||
NEWSYM pal16bclha, times 256 dd 0
|
||||
NEWSYM pal16bxcl, times 256 dd 0
|
||||
NEWSYM xtravbuf, times 576 db 0
|
||||
NEWSYM BG1SXl, times 256 dw 0
|
||||
NEWSYM BG2SXl, times 256 dw 0
|
||||
NEWSYM BG3SXl, times 256 dw 0
|
||||
NEWSYM BG4SXl, times 256 dw 0
|
||||
NEWSYM BG1SYl, times 256 dw 0
|
||||
NEWSYM BG2SYl, times 256 dw 0
|
||||
NEWSYM BG3SYl, times 256 dw 0
|
||||
NEWSYM BG4SYl, times 256 dw 0
|
||||
NEWSYM BGMA, times 256 db 0
|
||||
NEWSYM BGFB, times 256 db 0
|
||||
NEWSYM BG3PRI, times 256 db 0
|
||||
NEWSYM BGOPT1, times 256 dw 0
|
||||
NEWSYM BGOPT2, times 256 dw 0
|
||||
NEWSYM BGOPT3, times 256 dw 0
|
||||
NEWSYM BGOPT4, times 256 dw 0
|
||||
NEWSYM BGPT1, times 256 dw 0
|
||||
NEWSYM BGPT2, times 256 dw 0
|
||||
NEWSYM BGPT3, times 256 dw 0
|
||||
NEWSYM BGPT4, times 256 dw 0
|
||||
NEWSYM BGPT1X, times 256 dw 0
|
||||
NEWSYM BGPT2X, times 256 dw 0
|
||||
NEWSYM BGPT3X, times 256 dw 0
|
||||
NEWSYM BGPT4X, times 256 dw 0
|
||||
NEWSYM BGPT1Y, times 256 dw 0
|
||||
NEWSYM BGPT2Y, times 256 dw 0
|
||||
NEWSYM BGPT3Y, times 256 dw 0
|
||||
NEWSYM BGPT4Y, times 256 dw 0
|
||||
NEWSYM BGMS1, times 1024 dw 0
|
||||
NEWSYM prdata, times 256 db 0
|
||||
NEWSYM prdatb, times 256 db 0
|
||||
NEWSYM prdatc, times 256 db 0
|
||||
NEWSYM ngpalcon2b, times 20h dd 0
|
||||
NEWSYM ngpalcon4b, times 20h dd 0
|
||||
NEWSYM ngpalcon8b, times 20h dd 0
|
||||
NEWSYM tltype2b, times 4096 db 0
|
||||
NEWSYM tltype4b, times 2048 db 0
|
||||
NEWSYM tltype8b, times 1024 db 0
|
||||
|
||||
NEWSYM ngptrdat, times 1024 dd 0
|
||||
NEWSYM ngceax, times 1024 dd 0
|
||||
NEWSYM ngcedi, times 1024 dd 0
|
||||
NEWSYM bgtxad, times 1024 dw 0
|
||||
NEWSYM sprtbng, times 256 dd 0
|
||||
NEWSYM sprtlng, times 256 db 0
|
||||
NEWSYM mosszng, times 256 db 0
|
||||
NEWSYM mosenng, times 256 db 0
|
||||
|
||||
NEWSYM vidmemch2s, times 4096 db 0FFh
|
||||
NEWSYM vidmemch4s, times 2048 db 0FFh
|
||||
NEWSYM vidmemch8s, times 1024 db 0FFh
|
||||
|
||||
NEWSYM mode7ab, times 256 dd 0
|
||||
NEWSYM mode7cd, times 256 dd 0
|
||||
NEWSYM mode7xy, times 256 dd 0
|
||||
NEWSYM mode7st, times 256 db 0
|
||||
|
||||
NEWSYM t16x161, times 256 db 0
|
||||
NEWSYM t16x162, times 256 db 0
|
||||
NEWSYM t16x163, times 256 db 0
|
||||
NEWSYM t16x164, times 256 db 0
|
||||
|
||||
NEWSYM intrlng, times 256 db 0
|
||||
NEWSYM mode7hr, times 256 db 0
|
||||
|
||||
NEWSYM scadsng, times 256 db 0
|
||||
NEWSYM scadtng, times 256 db 0
|
||||
|
||||
NEWSYM scbcong, times 256 dw 0
|
||||
|
||||
NEWSYM cpalval, times 256 dd 0
|
||||
NEWSYM cgfxmod, times 256 db 0
|
||||
|
||||
NEWSYM winboundary, times 256 dd 0
|
||||
NEWSYM winbg1enval, times 256 db 0
|
||||
NEWSYM winbg2enval, times 256 db 0
|
||||
NEWSYM winbg3enval, times 256 db 0
|
||||
NEWSYM winbg4enval, times 256 db 0
|
||||
NEWSYM winbgobjenval, times 256 db 0
|
||||
NEWSYM winbgbackenval, times 256 db 0
|
||||
NEWSYM winlogicaval, times 256 dw 0
|
||||
|
||||
NEWSYM winbg1envals, times 256 db 0
|
||||
NEWSYM winbg2envals, times 256 db 0
|
||||
NEWSYM winbg3envals, times 256 db 0
|
||||
NEWSYM winbg4envals, times 256 db 0
|
||||
NEWSYM winbgobjenvals, times 256 db 0
|
||||
NEWSYM winbgbackenvals, times 256 db 0
|
||||
NEWSYM winbg1envalm, times 256 db 0
|
||||
NEWSYM winbg2envalm, times 256 db 0
|
||||
NEWSYM winbg3envalm, times 256 db 0
|
||||
NEWSYM winbg4envalm, times 256 db 0
|
||||
NEWSYM winbgobjenvalm, times 256 db 0
|
||||
NEWSYM winbgbackenvalm, times 256 db 0
|
||||
|
||||
NEWSYM FillSubScr, times 256 db 0
|
||||
|
||||
NEWSYM objclineptr, times 256 dd 0 ; l1,r1,l2,r2,en,log,ptr
|
||||
NEWSYM objwlrpos , times 256 dd 0FFFFFFFFh
|
||||
NEWSYM objwen , times 256 dw 0FFFFh ; en,log
|
||||
|
||||
NEWSYM SpecialLine, times 256 db 0
|
||||
|
||||
NEWSYM bgallchange, times 256 db 0
|
||||
NEWSYM bg1change, times 256 db 0
|
||||
NEWSYM bg2change, times 256 db 0
|
||||
NEWSYM bg3change, times 256 db 0
|
||||
NEWSYM bg4change, times 256 db 0
|
||||
NEWSYM bgwinchange, times 256 db 0
|
||||
|
||||
NEWSYM PrevPicture, times 64*56*2 db 0
|
||||
|
||||
411
zsnes/src/fixsin.c
Normal file
411
zsnes/src/fixsin.c
Normal file
@@ -0,0 +1,411 @@
|
||||
//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.
|
||||
|
||||
|
||||
int FSinTab[2048] =
|
||||
{
|
||||
0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412, 2613,
|
||||
2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021, 5222,
|
||||
5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623, 7822,
|
||||
8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212, 10410,
|
||||
10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390, 12588,
|
||||
12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555, 14751,
|
||||
14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702, 16897,
|
||||
17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831, 19024,
|
||||
19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938, 21129,
|
||||
21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022, 23210,
|
||||
23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079, 25265,
|
||||
25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108, 27291,
|
||||
27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105, 29285,
|
||||
29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070, 31247,
|
||||
31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999, 33173,
|
||||
33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891, 35061,
|
||||
35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743, 36909,
|
||||
37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553, 38716,
|
||||
38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319, 40478,
|
||||
40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040, 42194,
|
||||
42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712, 43862,
|
||||
44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335, 45480,
|
||||
45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906, 47046,
|
||||
47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423, 48558,
|
||||
48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886, 50016,
|
||||
50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291, 51416,
|
||||
51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639, 52758,
|
||||
52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926, 54040,
|
||||
54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152, 55260,
|
||||
55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315, 56417,
|
||||
56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414, 57510,
|
||||
57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447, 58538,
|
||||
58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414, 59499,
|
||||
59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313, 60392,
|
||||
60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144, 61216,
|
||||
61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905, 61971,
|
||||
62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596, 62655,
|
||||
62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215, 63268,
|
||||
63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762, 63808,
|
||||
63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237, 64276,
|
||||
64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638, 64671,
|
||||
64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966, 64992,
|
||||
65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220, 65239,
|
||||
65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400, 65412,
|
||||
65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505, 65511,
|
||||
65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535, 65536, 65535, 65534,
|
||||
65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505, 65498, 65491, 65483,
|
||||
65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400, 65386, 65372, 65358,
|
||||
65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220, 65200, 65179, 65158,
|
||||
65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966, 64939, 64912, 64884,
|
||||
64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638, 64605, 64571, 64536,
|
||||
64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237, 64197, 64156, 64115,
|
||||
64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762, 63715, 63668, 63620,
|
||||
63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215, 63162, 63108, 63053,
|
||||
62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596, 62536, 62475, 62414,
|
||||
62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905, 61839, 61772, 61705,
|
||||
61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144, 61071, 60998, 60924,
|
||||
60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313, 60235, 60155, 60075,
|
||||
59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414, 59329, 59243, 59157,
|
||||
59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447, 58356, 58264, 58172,
|
||||
58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414, 57316, 57219, 57120,
|
||||
57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315, 56212, 56108, 56004,
|
||||
55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152, 55043, 54933, 54823,
|
||||
54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926, 53811, 53696, 53581,
|
||||
53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639, 52518, 52398, 52277,
|
||||
52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291, 51166, 51040, 50914,
|
||||
50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886, 49755, 49624, 49492,
|
||||
49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423, 48288, 48151, 48015,
|
||||
47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906, 46765, 46624, 46482,
|
||||
46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335, 45189, 45043, 44897,
|
||||
44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712, 43562, 43412, 43261,
|
||||
43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040, 41885, 41730, 41575,
|
||||
41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319, 40161, 40002, 39842,
|
||||
39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553, 38390, 38227, 38064,
|
||||
37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743, 36576, 36409, 36242,
|
||||
36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891, 34721, 34550, 34379,
|
||||
34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999, 32826, 32651, 32477,
|
||||
32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070, 30893, 30715, 30538,
|
||||
30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105, 28925, 28745, 28564,
|
||||
28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108, 26925, 26741, 26557,
|
||||
26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079, 24893, 24707, 24521,
|
||||
24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022, 22833, 22645, 22456,
|
||||
22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938, 20748, 20557, 20366,
|
||||
20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831, 18638, 18446, 18253,
|
||||
18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702, 16508, 16313, 16118,
|
||||
15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555, 14359, 14162, 13966,
|
||||
13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390, 12193, 11995, 11797,
|
||||
11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212, 10013, 9814, 9616, 9417,
|
||||
9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623, 7423, 7223, 7023, 6823,
|
||||
6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021, 4821, 4620, 4420, 4219,
|
||||
4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412, 2211, 2010, 1809, 1608,
|
||||
1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402, -603, -804, -1005, -1206,
|
||||
-1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814, -3014, -3215, -3416,
|
||||
-3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021, -5222, -5422, -5622,
|
||||
-5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223, -7423, -7623, -7822,
|
||||
-8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417, -9616, -9814, -10013,
|
||||
-10212, -10410, -10609, -10807, -11006, -11204, -11402, -11600, -11797, -11995,
|
||||
-12193, -12390, -12588, -12785, -12982, -13179, -13376, -13573, -13769, -13966,
|
||||
-14162, -14359, -14555, -14751, -14946, -15142, -15338, -15533, -15728, -15923,
|
||||
-16118, -16313, -16508, -16702, -16897, -17091, -17285, -17479, -17672, -17866,
|
||||
-18059, -18253, -18446, -18638, -18831, -19024, -19216, -19408, -19600, -19792,
|
||||
-19983, -20175, -20366, -20557, -20748, -20938, -21129, -21319, -21509, -21699,
|
||||
-21889, -22078, -22267, -22456, -22645, -22833, -23022, -23210, -23398, -23586,
|
||||
-23773, -23960, -24147, -24334, -24521, -24707, -24893, -25079, -25265, -25450,
|
||||
-25635, -25820, -26005, -26189, -26373, -26557, -26741, -26925, -27108, -27291,
|
||||
-27473, -27656, -27838, -28020, -28201, -28383, -28564, -28745, -28925, -29105,
|
||||
-29285, -29465, -29645, -29824, -30003, -30181, -30360, -30538, -30715, -30893,
|
||||
-31070, -31247, -31424, -31600, -31776, -31952, -32127, -32302, -32477, -32651,
|
||||
-32826, -32999, -33173, -33346, -33519, -33692, -33864, -34036, -34208, -34379,
|
||||
-34550, -34721, -34891, -35061, -35231, -35400, -35569, -35738, -35906, -36074,
|
||||
-36242, -36409, -36576, -36743, -36909, -37075, -37241, -37406, -37571, -37736,
|
||||
-37900, -38064, -38227, -38390, -38553, -38716, -38878, -39039, -39201, -39362,
|
||||
-39522, -39682, -39842, -40002, -40161, -40319, -40478, -40636, -40793, -40950,
|
||||
-41107, -41263, -41419, -41575, -41730, -41885, -42040, -42194, -42347, -42501,
|
||||
-42653, -42806, -42958, -43110, -43261, -43412, -43562, -43712, -43862, -44011,
|
||||
-44160, -44308, -44456, -44603, -44750, -44897, -45043, -45189, -45335, -45480,
|
||||
-45624, -45768, -45912, -46055, -46198, -46340, -46482, -46624, -46765, -46906,
|
||||
-47046, -47186, -47325, -47464, -47602, -47740, -47878, -48015, -48151, -48288,
|
||||
-48423, -48558, -48693, -48828, -48961, -49095, -49228, -49360, -49492, -49624,
|
||||
-49755, -49886, -50016, -50146, -50275, -50403, -50532, -50660, -50787, -50914,
|
||||
-51040, -51166, -51291, -51416, -51541, -51665, -51788, -51911, -52033, -52155,
|
||||
-52277, -52398, -52518, -52639, -52758, -52877, -52996, -53114, -53231, -53348,
|
||||
-53465, -53581, -53696, -53811, -53926, -54040, -54153, -54266, -54379, -54491,
|
||||
-54602, -54713, -54823, -54933, -55043, -55152, -55260, -55368, -55475, -55582,
|
||||
-55688, -55794, -55899, -56004, -56108, -56212, -56315, -56417, -56519, -56621,
|
||||
-56722, -56822, -56922, -57022, -57120, -57219, -57316, -57414, -57510, -57606,
|
||||
-57702, -57797, -57892, -57986, -58079, -58172, -58264, -58356, -58447, -58538,
|
||||
-58628, -58718, -58807, -58895, -58983, -59070, -59157, -59243, -59329, -59414,
|
||||
-59499, -59583, -59666, -59749, -59831, -59913, -59994, -60075, -60155, -60235,
|
||||
-60313, -60392, -60470, -60547, -60624, -60700, -60775, -60850, -60924, -60998,
|
||||
-61071, -61144, -61216, -61288, -61359, -61429, -61499, -61568, -61637, -61705,
|
||||
-61772, -61839, -61905, -61971, -62036, -62100, -62164, -62228, -62291, -62353,
|
||||
-62414, -62475, -62536, -62596, -62655, -62714, -62772, -62829, -62886, -62942,
|
||||
-62998, -63053, -63108, -63162, -63215, -63268, -63320, -63371, -63422, -63473,
|
||||
-63522, -63571, -63620, -63668, -63715, -63762, -63808, -63854, -63899, -63943,
|
||||
-63987, -64030, -64073, -64115, -64156, -64197, -64237, -64276, -64315, -64353,
|
||||
-64391, -64428, -64465, -64501, -64536, -64571, -64605, -64638, -64671, -64703,
|
||||
-64735, -64766, -64796, -64826, -64855, -64884, -64912, -64939, -64966, -64992,
|
||||
-65018, -65043, -65067, -65091, -65114, -65136, -65158, -65179, -65200, -65220,
|
||||
-65239, -65258, -65276, -65294, -65311, -65327, -65343, -65358, -65372, -65386,
|
||||
-65400, -65412, -65424, -65436, -65446, -65457, -65466, -65475, -65483, -65491,
|
||||
-65498, -65505, -65511, -65516, -65520, -65524, -65528, -65531, -65533, -65534,
|
||||
-65535, -65536, -65535, -65534, -65533, -65531, -65528, -65524, -65520, -65516,
|
||||
-65511, -65505, -65498, -65491, -65483, -65475, -65466, -65457, -65446, -65436,
|
||||
-65424, -65412, -65400, -65386, -65372, -65358, -65343, -65327, -65311, -65294,
|
||||
-65276, -65258, -65239, -65220, -65200, -65179, -65158, -65136, -65114, -65091,
|
||||
-65067, -65043, -65018, -64992, -64966, -64939, -64912, -64884, -64855, -64826,
|
||||
-64796, -64766, -64735, -64703, -64671, -64638, -64605, -64571, -64536, -64501,
|
||||
-64465, -64428, -64391, -64353, -64315, -64276, -64237, -64197, -64156, -64115,
|
||||
-64073, -64030, -63987, -63943, -63899, -63854, -63808, -63762, -63715, -63668,
|
||||
-63620, -63571, -63522, -63473, -63422, -63371, -63320, -63268, -63215, -63162,
|
||||
-63108, -63053, -62998, -62942, -62886, -62829, -62772, -62714, -62655, -62596,
|
||||
-62536, -62475, -62414, -62353, -62291, -62228, -62164, -62100, -62036, -61971,
|
||||
-61905, -61839, -61772, -61705, -61637, -61568, -61499, -61429, -61359, -61288,
|
||||
-61216, -61144, -61071, -60998, -60924, -60850, -60775, -60700, -60624, -60547,
|
||||
-60470, -60392, -60313, -60235, -60155, -60075, -59994, -59913, -59831, -59749,
|
||||
-59666, -59583, -59499, -59414, -59329, -59243, -59157, -59070, -58983, -58895,
|
||||
-58807, -58718, -58628, -58538, -58447, -58356, -58264, -58172, -58079, -57986,
|
||||
-57892, -57797, -57702, -57606, -57510, -57414, -57316, -57219, -57120, -57022,
|
||||
-56922, -56822, -56722, -56621, -56519, -56417, -56315, -56212, -56108, -56004,
|
||||
-55899, -55794, -55688, -55582, -55475, -55368, -55260, -55152, -55043, -54933,
|
||||
-54823, -54713, -54602, -54491, -54379, -54266, -54153, -54040, -53926, -53811,
|
||||
-53696, -53581, -53465, -53348, -53231, -53114, -52996, -52877, -52758, -52639,
|
||||
-52518, -52398, -52277, -52155, -52033, -51911, -51788, -51665, -51541, -51416,
|
||||
-51291, -51166, -51040, -50914, -50787, -50660, -50532, -50403, -50275, -50146,
|
||||
-50016, -49886, -49755, -49624, -49492, -49360, -49228, -49095, -48961, -48828,
|
||||
-48693, -48558, -48423, -48288, -48151, -48015, -47878, -47740, -47602, -47464,
|
||||
-47325, -47186, -47046, -46906, -46765, -46624, -46482, -46340, -46198, -46055,
|
||||
-45912, -45768, -45624, -45480, -45335, -45189, -45043, -44897, -44750, -44603,
|
||||
-44456, -44308, -44160, -44011, -43862, -43712, -43562, -43412, -43261, -43110,
|
||||
-42958, -42806, -42653, -42501, -42347, -42194, -42040, -41885, -41730, -41575,
|
||||
-41419, -41263, -41107, -40950, -40793, -40636, -40478, -40319, -40161, -40002,
|
||||
-39842, -39682, -39522, -39362, -39201, -39039, -38878, -38716, -38553, -38390,
|
||||
-38227, -38064, -37900, -37736, -37571, -37406, -37241, -37075, -36909, -36743,
|
||||
-36576, -36409, -36242, -36074, -35906, -35738, -35569, -35400, -35231, -35061,
|
||||
-34891, -34721, -34550, -34379, -34208, -34036, -33864, -33692, -33519, -33346,
|
||||
-33173, -32999, -32826, -32651, -32477, -32302, -32127, -31952, -31776, -31600,
|
||||
-31424, -31247, -31070, -30893, -30715, -30538, -30360, -30181, -30003, -29824,
|
||||
-29645, -29465, -29285, -29105, -28925, -28745, -28564, -28383, -28201, -28020,
|
||||
-27838, -27656, -27473, -27291, -27108, -26925, -26741, -26557, -26373, -26189,
|
||||
-26005, -25820, -25635, -25450, -25265, -25079, -24893, -24707, -24521, -24334,
|
||||
-24147, -23960, -23773, -23586, -23398, -23210, -23022, -22833, -22645, -22456,
|
||||
-22267, -22078, -21889, -21699, -21509, -21319, -21129, -20938, -20748, -20557,
|
||||
-20366, -20175, -19983, -19792, -19600, -19408, -19216, -19024, -18831, -18638,
|
||||
-18446, -18253, -18059, -17866, -17672, -17479, -17285, -17091, -16897, -16702,
|
||||
-16508, -16313, -16118, -15923, -15728, -15533, -15338, -15142, -14946, -14751,
|
||||
-14555, -14359, -14162, -13966, -13769, -13573, -13376, -13179, -12982, -12785,
|
||||
-12588, -12390, -12193, -11995, -11797, -11600, -11402, -11204, -11006, -10807,
|
||||
-10609, -10410, -10212, -10013, -9814, -9616, -9417, -9218, -9019, -8819, -8620,
|
||||
-8421, -8221, -8022, -7822, -7623, -7423, -7223, -7023, -6823, -6623, -6423,
|
||||
-6223, -6023, -5823, -5622, -5422, -5222, -5021, -4821, -4620, -4420, -4219,
|
||||
-4018, -3818, -3617, -3416, -3215, -3014, -2814, -2613, -2412, -2211, -2010,
|
||||
-1809, -1608, -1407, -1206, -1005, -804, -603, -402, -201
|
||||
};
|
||||
int FCosTab[2048] =
|
||||
{
|
||||
65536, 65535, 65534, 65533, 65531, 65528, 65524, 65520, 65516, 65511, 65505,
|
||||
65498, 65491, 65483, 65475, 65466, 65457, 65446, 65436, 65424, 65412, 65400,
|
||||
65386, 65372, 65358, 65343, 65327, 65311, 65294, 65276, 65258, 65239, 65220,
|
||||
65200, 65179, 65158, 65136, 65114, 65091, 65067, 65043, 65018, 64992, 64966,
|
||||
64939, 64912, 64884, 64855, 64826, 64796, 64766, 64735, 64703, 64671, 64638,
|
||||
64605, 64571, 64536, 64501, 64465, 64428, 64391, 64353, 64315, 64276, 64237,
|
||||
64197, 64156, 64115, 64073, 64030, 63987, 63943, 63899, 63854, 63808, 63762,
|
||||
63715, 63668, 63620, 63571, 63522, 63473, 63422, 63371, 63320, 63268, 63215,
|
||||
63162, 63108, 63053, 62998, 62942, 62886, 62829, 62772, 62714, 62655, 62596,
|
||||
62536, 62475, 62414, 62353, 62291, 62228, 62164, 62100, 62036, 61971, 61905,
|
||||
61839, 61772, 61705, 61637, 61568, 61499, 61429, 61359, 61288, 61216, 61144,
|
||||
61071, 60998, 60924, 60850, 60775, 60700, 60624, 60547, 60470, 60392, 60313,
|
||||
60235, 60155, 60075, 59994, 59913, 59831, 59749, 59666, 59583, 59499, 59414,
|
||||
59329, 59243, 59157, 59070, 58983, 58895, 58807, 58718, 58628, 58538, 58447,
|
||||
58356, 58264, 58172, 58079, 57986, 57892, 57797, 57702, 57606, 57510, 57414,
|
||||
57316, 57219, 57120, 57022, 56922, 56822, 56722, 56621, 56519, 56417, 56315,
|
||||
56212, 56108, 56004, 55899, 55794, 55688, 55582, 55475, 55368, 55260, 55152,
|
||||
55043, 54933, 54823, 54713, 54602, 54491, 54379, 54266, 54153, 54040, 53926,
|
||||
53811, 53696, 53581, 53465, 53348, 53231, 53114, 52996, 52877, 52758, 52639,
|
||||
52518, 52398, 52277, 52155, 52033, 51911, 51788, 51665, 51541, 51416, 51291,
|
||||
51166, 51040, 50914, 50787, 50660, 50532, 50403, 50275, 50146, 50016, 49886,
|
||||
49755, 49624, 49492, 49360, 49228, 49095, 48961, 48828, 48693, 48558, 48423,
|
||||
48288, 48151, 48015, 47878, 47740, 47602, 47464, 47325, 47186, 47046, 46906,
|
||||
46765, 46624, 46482, 46340, 46198, 46055, 45912, 45768, 45624, 45480, 45335,
|
||||
45189, 45043, 44897, 44750, 44603, 44456, 44308, 44160, 44011, 43862, 43712,
|
||||
43562, 43412, 43261, 43110, 42958, 42806, 42653, 42501, 42347, 42194, 42040,
|
||||
41885, 41730, 41575, 41419, 41263, 41107, 40950, 40793, 40636, 40478, 40319,
|
||||
40161, 40002, 39842, 39682, 39522, 39362, 39201, 39039, 38878, 38716, 38553,
|
||||
38390, 38227, 38064, 37900, 37736, 37571, 37406, 37241, 37075, 36909, 36743,
|
||||
36576, 36409, 36242, 36074, 35906, 35738, 35569, 35400, 35231, 35061, 34891,
|
||||
34721, 34550, 34379, 34208, 34036, 33864, 33692, 33519, 33346, 33173, 32999,
|
||||
32826, 32651, 32477, 32302, 32127, 31952, 31776, 31600, 31424, 31247, 31070,
|
||||
30893, 30715, 30538, 30360, 30181, 30003, 29824, 29645, 29465, 29285, 29105,
|
||||
28925, 28745, 28564, 28383, 28201, 28020, 27838, 27656, 27473, 27291, 27108,
|
||||
26925, 26741, 26557, 26373, 26189, 26005, 25820, 25635, 25450, 25265, 25079,
|
||||
24893, 24707, 24521, 24334, 24147, 23960, 23773, 23586, 23398, 23210, 23022,
|
||||
22833, 22645, 22456, 22267, 22078, 21889, 21699, 21509, 21319, 21129, 20938,
|
||||
20748, 20557, 20366, 20175, 19983, 19792, 19600, 19408, 19216, 19024, 18831,
|
||||
18638, 18446, 18253, 18059, 17866, 17672, 17479, 17285, 17091, 16897, 16702,
|
||||
16508, 16313, 16118, 15923, 15728, 15533, 15338, 15142, 14946, 14751, 14555,
|
||||
14359, 14162, 13966, 13769, 13573, 13376, 13179, 12982, 12785, 12588, 12390,
|
||||
12193, 11995, 11797, 11600, 11402, 11204, 11006, 10807, 10609, 10410, 10212,
|
||||
10013, 9814, 9616, 9417, 9218, 9019, 8819, 8620, 8421, 8221, 8022, 7822, 7623,
|
||||
7423, 7223, 7023, 6823, 6623, 6423, 6223, 6023, 5823, 5622, 5422, 5222, 5021,
|
||||
4821, 4620, 4420, 4219, 4018, 3818, 3617, 3416, 3215, 3014, 2814, 2613, 2412,
|
||||
2211, 2010, 1809, 1608, 1407, 1206, 1005, 804, 603, 402, 201, 0, -201, -402,
|
||||
-603, -804, -1005, -1206, -1407, -1608, -1809, -2010, -2211, -2412, -2613, -2814,
|
||||
-3014, -3215, -3416, -3617, -3818, -4018, -4219, -4420, -4620, -4821, -5021,
|
||||
-5222, -5422, -5622, -5823, -6023, -6223, -6423, -6623, -6823, -7023, -7223,
|
||||
-7423, -7623, -7822, -8022, -8221, -8421, -8620, -8819, -9019, -9218, -9417,
|
||||
-9616, -9814, -10013, -10212, -10410, -10609, -10807, -11006, -11204, -11402,
|
||||
-11600, -11797, -11995, -12193, -12390, -12588, -12785, -12982, -13179, -13376,
|
||||
-13573, -13769, -13966, -14162, -14359, -14555, -14751, -14946, -15142, -15338,
|
||||
-15533, -15728, -15923, -16118, -16313, -16508, -16702, -16897, -17091, -17285,
|
||||
-17479, -17672, -17866, -18059, -18253, -18446, -18638, -18831, -19024, -19216,
|
||||
-19408, -19600, -19792, -19983, -20175, -20366, -20557, -20748, -20938, -21129,
|
||||
-21319, -21509, -21699, -21889, -22078, -22267, -22456, -22645, -22833, -23022,
|
||||
-23210, -23398, -23586, -23773, -23960, -24147, -24334, -24521, -24707, -24893,
|
||||
-25079, -25265, -25450, -25635, -25820, -26005, -26189, -26373, -26557, -26741,
|
||||
-26925, -27108, -27291, -27473, -27656, -27838, -28020, -28201, -28383, -28564,
|
||||
-28745, -28925, -29105, -29285, -29465, -29645, -29824, -30003, -30181, -30360,
|
||||
-30538, -30715, -30893, -31070, -31247, -31424, -31600, -31776, -31952, -32127,
|
||||
-32302, -32477, -32651, -32826, -32999, -33173, -33346, -33519, -33692, -33864,
|
||||
-34036, -34208, -34379, -34550, -34721, -34891, -35061, -35231, -35400, -35569,
|
||||
-35738, -35906, -36074, -36242, -36409, -36576, -36743, -36909, -37075, -37241,
|
||||
-37406, -37571, -37736, -37900, -38064, -38227, -38390, -38553, -38716, -38878,
|
||||
-39039, -39201, -39362, -39522, -39682, -39842, -40002, -40161, -40319, -40478,
|
||||
-40636, -40793, -40950, -41107, -41263, -41419, -41575, -41730, -41885, -42040,
|
||||
-42194, -42347, -42501, -42653, -42806, -42958, -43110, -43261, -43412, -43562,
|
||||
-43712, -43862, -44011, -44160, -44308, -44456, -44603, -44750, -44897, -45043,
|
||||
-45189, -45335, -45480, -45624, -45768, -45912, -46055, -46198, -46340, -46482,
|
||||
-46624, -46765, -46906, -47046, -47186, -47325, -47464, -47602, -47740, -47878,
|
||||
-48015, -48151, -48288, -48423, -48558, -48693, -48828, -48961, -49095, -49228,
|
||||
-49360, -49492, -49624, -49755, -49886, -50016, -50146, -50275, -50403, -50532,
|
||||
-50660, -50787, -50914, -51040, -51166, -51291, -51416, -51541, -51665, -51788,
|
||||
-51911, -52033, -52155, -52277, -52398, -52518, -52639, -52758, -52877, -52996,
|
||||
-53114, -53231, -53348, -53465, -53581, -53696, -53811, -53926, -54040, -54153,
|
||||
-54266, -54379, -54491, -54602, -54713, -54823, -54933, -55043, -55152, -55260,
|
||||
-55368, -55475, -55582, -55688, -55794, -55899, -56004, -56108, -56212, -56315,
|
||||
-56417, -56519, -56621, -56722, -56822, -56922, -57022, -57120, -57219, -57316,
|
||||
-57414, -57510, -57606, -57702, -57797, -57892, -57986, -58079, -58172, -58264,
|
||||
-58356, -58447, -58538, -58628, -58718, -58807, -58895, -58983, -59070, -59157,
|
||||
-59243, -59329, -59414, -59499, -59583, -59666, -59749, -59831, -59913, -59994,
|
||||
-60075, -60155, -60235, -60313, -60392, -60470, -60547, -60624, -60700, -60775,
|
||||
-60850, -60924, -60998, -61071, -61144, -61216, -61288, -61359, -61429, -61499,
|
||||
-61568, -61637, -61705, -61772, -61839, -61905, -61971, -62036, -62100, -62164,
|
||||
-62228, -62291, -62353, -62414, -62475, -62536, -62596, -62655, -62714, -62772,
|
||||
-62829, -62886, -62942, -62998, -63053, -63108, -63162, -63215, -63268, -63320,
|
||||
-63371, -63422, -63473, -63522, -63571, -63620, -63668, -63715, -63762, -63808,
|
||||
-63854, -63899, -63943, -63987, -64030, -64073, -64115, -64156, -64197, -64237,
|
||||
-64276, -64315, -64353, -64391, -64428, -64465, -64501, -64536, -64571, -64605,
|
||||
-64638, -64671, -64703, -64735, -64766, -64796, -64826, -64855, -64884, -64912,
|
||||
-64939, -64966, -64992, -65018, -65043, -65067, -65091, -65114, -65136, -65158,
|
||||
-65179, -65200, -65220, -65239, -65258, -65276, -65294, -65311, -65327, -65343,
|
||||
-65358, -65372, -65386, -65400, -65412, -65424, -65436, -65446, -65457, -65466,
|
||||
-65475, -65483, -65491, -65498, -65505, -65511, -65516, -65520, -65524, -65528,
|
||||
-65531, -65533, -65534, -65535, -65536, -65535, -65534, -65533, -65531, -65528,
|
||||
-65524, -65520, -65516, -65511, -65505, -65498, -65491, -65483, -65475, -65466,
|
||||
-65457, -65446, -65436, -65424, -65412, -65400, -65386, -65372, -65358, -65343,
|
||||
-65327, -65311, -65294, -65276, -65258, -65239, -65220, -65200, -65179, -65158,
|
||||
-65136, -65114, -65091, -65067, -65043, -65018, -64992, -64966, -64939, -64912,
|
||||
-64884, -64855, -64826, -64796, -64766, -64735, -64703, -64671, -64638, -64605,
|
||||
-64571, -64536, -64501, -64465, -64428, -64391, -64353, -64315, -64276, -64237,
|
||||
-64197, -64156, -64115, -64073, -64030, -63987, -63943, -63899, -63854, -63808,
|
||||
-63762, -63715, -63668, -63620, -63571, -63522, -63473, -63422, -63371, -63320,
|
||||
-63268, -63215, -63162, -63108, -63053, -62998, -62942, -62886, -62829, -62772,
|
||||
-62714, -62655, -62596, -62536, -62475, -62414, -62353, -62291, -62228, -62164,
|
||||
-62100, -62036, -61971, -61905, -61839, -61772, -61705, -61637, -61568, -61499,
|
||||
-61429, -61359, -61288, -61216, -61144, -61071, -60998, -60924, -60850, -60775,
|
||||
-60700, -60624, -60547, -60470, -60392, -60313, -60235, -60155, -60075, -59994,
|
||||
-59913, -59831, -59749, -59666, -59583, -59499, -59414, -59329, -59243, -59157,
|
||||
-59070, -58983, -58895, -58807, -58718, -58628, -58538, -58447, -58356, -58264,
|
||||
-58172, -58079, -57986, -57892, -57797, -57702, -57606, -57510, -57414, -57316,
|
||||
-57219, -57120, -57022, -56922, -56822, -56722, -56621, -56519, -56417, -56315,
|
||||
-56212, -56108, -56004, -55899, -55794, -55688, -55582, -55475, -55368, -55260,
|
||||
-55152, -55043, -54933, -54823, -54713, -54602, -54491, -54379, -54266, -54153,
|
||||
-54040, -53926, -53811, -53696, -53581, -53465, -53348, -53231, -53114, -52996,
|
||||
-52877, -52758, -52639, -52518, -52398, -52277, -52155, -52033, -51911, -51788,
|
||||
-51665, -51541, -51416, -51291, -51166, -51040, -50914, -50787, -50660, -50532,
|
||||
-50403, -50275, -50146, -50016, -49886, -49755, -49624, -49492, -49360, -49228,
|
||||
-49095, -48961, -48828, -48693, -48558, -48423, -48288, -48151, -48015, -47878,
|
||||
-47740, -47602, -47464, -47325, -47186, -47046, -46906, -46765, -46624, -46482,
|
||||
-46340, -46198, -46055, -45912, -45768, -45624, -45480, -45335, -45189, -45043,
|
||||
-44897, -44750, -44603, -44456, -44308, -44160, -44011, -43862, -43712, -43562,
|
||||
-43412, -43261, -43110, -42958, -42806, -42653, -42501, -42347, -42194, -42040,
|
||||
-41885, -41730, -41575, -41419, -41263, -41107, -40950, -40793, -40636, -40478,
|
||||
-40319, -40161, -40002, -39842, -39682, -39522, -39362, -39201, -39039, -38878,
|
||||
-38716, -38553, -38390, -38227, -38064, -37900, -37736, -37571, -37406, -37241,
|
||||
-37075, -36909, -36743, -36576, -36409, -36242, -36074, -35906, -35738, -35569,
|
||||
-35400, -35231, -35061, -34891, -34721, -34550, -34379, -34208, -34036, -33864,
|
||||
-33692, -33519, -33346, -33173, -32999, -32826, -32651, -32477, -32302, -32127,
|
||||
-31952, -31776, -31600, -31424, -31247, -31070, -30893, -30715, -30538, -30360,
|
||||
-30181, -30003, -29824, -29645, -29465, -29285, -29105, -28925, -28745, -28564,
|
||||
-28383, -28201, -28020, -27838, -27656, -27473, -27291, -27108, -26925, -26741,
|
||||
-26557, -26373, -26189, -26005, -25820, -25635, -25450, -25265, -25079, -24893,
|
||||
-24707, -24521, -24334, -24147, -23960, -23773, -23586, -23398, -23210, -23022,
|
||||
-22833, -22645, -22456, -22267, -22078, -21889, -21699, -21509, -21319, -21129,
|
||||
-20938, -20748, -20557, -20366, -20175, -19983, -19792, -19600, -19408, -19216,
|
||||
-19024, -18831, -18638, -18446, -18253, -18059, -17866, -17672, -17479, -17285,
|
||||
-17091, -16897, -16702, -16508, -16313, -16118, -15923, -15728, -15533, -15338,
|
||||
-15142, -14946, -14751, -14555, -14359, -14162, -13966, -13769, -13573, -13376,
|
||||
-13179, -12982, -12785, -12588, -12390, -12193, -11995, -11797, -11600, -11402,
|
||||
-11204, -11006, -10807, -10609, -10410, -10212, -10013, -9814, -9616, -9417,
|
||||
-9218, -9019, -8819, -8620, -8421, -8221, -8022, -7822, -7623, -7423, -7223,
|
||||
-7023, -6823, -6623, -6423, -6223, -6023, -5823, -5622, -5422, -5222, -5021,
|
||||
-4821, -4620, -4420, -4219, -4018, -3818, -3617, -3416, -3215, -3014, -2814,
|
||||
-2613, -2412, -2211, -2010, -1809, -1608, -1407, -1206, -1005, -804, -603, -402,
|
||||
-201, 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2010, 2211, 2412,
|
||||
2613, 2814, 3014, 3215, 3416, 3617, 3818, 4018, 4219, 4420, 4620, 4821, 5021,
|
||||
5222, 5422, 5622, 5823, 6023, 6223, 6423, 6623, 6823, 7023, 7223, 7423, 7623,
|
||||
7822, 8022, 8221, 8421, 8620, 8819, 9019, 9218, 9417, 9616, 9814, 10013, 10212,
|
||||
10410, 10609, 10807, 11006, 11204, 11402, 11600, 11797, 11995, 12193, 12390,
|
||||
12588, 12785, 12982, 13179, 13376, 13573, 13769, 13966, 14162, 14359, 14555,
|
||||
14751, 14946, 15142, 15338, 15533, 15728, 15923, 16118, 16313, 16508, 16702,
|
||||
16897, 17091, 17285, 17479, 17672, 17866, 18059, 18253, 18446, 18638, 18831,
|
||||
19024, 19216, 19408, 19600, 19792, 19983, 20175, 20366, 20557, 20748, 20938,
|
||||
21129, 21319, 21509, 21699, 21889, 22078, 22267, 22456, 22645, 22833, 23022,
|
||||
23210, 23398, 23586, 23773, 23960, 24147, 24334, 24521, 24707, 24893, 25079,
|
||||
25265, 25450, 25635, 25820, 26005, 26189, 26373, 26557, 26741, 26925, 27108,
|
||||
27291, 27473, 27656, 27838, 28020, 28201, 28383, 28564, 28745, 28925, 29105,
|
||||
29285, 29465, 29645, 29824, 30003, 30181, 30360, 30538, 30715, 30893, 31070,
|
||||
31247, 31424, 31600, 31776, 31952, 32127, 32302, 32477, 32651, 32826, 32999,
|
||||
33173, 33346, 33519, 33692, 33864, 34036, 34208, 34379, 34550, 34721, 34891,
|
||||
35061, 35231, 35400, 35569, 35738, 35906, 36074, 36242, 36409, 36576, 36743,
|
||||
36909, 37075, 37241, 37406, 37571, 37736, 37900, 38064, 38227, 38390, 38553,
|
||||
38716, 38878, 39039, 39201, 39362, 39522, 39682, 39842, 40002, 40161, 40319,
|
||||
40478, 40636, 40793, 40950, 41107, 41263, 41419, 41575, 41730, 41885, 42040,
|
||||
42194, 42347, 42501, 42653, 42806, 42958, 43110, 43261, 43412, 43562, 43712,
|
||||
43862, 44011, 44160, 44308, 44456, 44603, 44750, 44897, 45043, 45189, 45335,
|
||||
45480, 45624, 45768, 45912, 46055, 46198, 46340, 46482, 46624, 46765, 46906,
|
||||
47046, 47186, 47325, 47464, 47602, 47740, 47878, 48015, 48151, 48288, 48423,
|
||||
48558, 48693, 48828, 48961, 49095, 49228, 49360, 49492, 49624, 49755, 49886,
|
||||
50016, 50146, 50275, 50403, 50532, 50660, 50787, 50914, 51040, 51166, 51291,
|
||||
51416, 51541, 51665, 51788, 51911, 52033, 52155, 52277, 52398, 52518, 52639,
|
||||
52758, 52877, 52996, 53114, 53231, 53348, 53465, 53581, 53696, 53811, 53926,
|
||||
54040, 54153, 54266, 54379, 54491, 54602, 54713, 54823, 54933, 55043, 55152,
|
||||
55260, 55368, 55475, 55582, 55688, 55794, 55899, 56004, 56108, 56212, 56315,
|
||||
56417, 56519, 56621, 56722, 56822, 56922, 57022, 57120, 57219, 57316, 57414,
|
||||
57510, 57606, 57702, 57797, 57892, 57986, 58079, 58172, 58264, 58356, 58447,
|
||||
58538, 58628, 58718, 58807, 58895, 58983, 59070, 59157, 59243, 59329, 59414,
|
||||
59499, 59583, 59666, 59749, 59831, 59913, 59994, 60075, 60155, 60235, 60313,
|
||||
60392, 60470, 60547, 60624, 60700, 60775, 60850, 60924, 60998, 61071, 61144,
|
||||
61216, 61288, 61359, 61429, 61499, 61568, 61637, 61705, 61772, 61839, 61905,
|
||||
61971, 62036, 62100, 62164, 62228, 62291, 62353, 62414, 62475, 62536, 62596,
|
||||
62655, 62714, 62772, 62829, 62886, 62942, 62998, 63053, 63108, 63162, 63215,
|
||||
63268, 63320, 63371, 63422, 63473, 63522, 63571, 63620, 63668, 63715, 63762,
|
||||
63808, 63854, 63899, 63943, 63987, 64030, 64073, 64115, 64156, 64197, 64237,
|
||||
64276, 64315, 64353, 64391, 64428, 64465, 64501, 64536, 64571, 64605, 64638,
|
||||
64671, 64703, 64735, 64766, 64796, 64826, 64855, 64884, 64912, 64939, 64966,
|
||||
64992, 65018, 65043, 65067, 65091, 65114, 65136, 65158, 65179, 65200, 65220,
|
||||
65239, 65258, 65276, 65294, 65311, 65327, 65343, 65358, 65372, 65386, 65400,
|
||||
65412, 65424, 65436, 65446, 65457, 65466, 65475, 65483, 65491, 65498, 65505,
|
||||
65511, 65516, 65520, 65524, 65528, 65531, 65533, 65534, 65535
|
||||
};
|
||||
|
||||
25
zsnes/src/fixsin.h
Normal file
25
zsnes/src/fixsin.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//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.
|
||||
|
||||
|
||||
extern int FSinTab[2048];
|
||||
extern int FCosTab[2048];
|
||||
#define FSINMAX 2047
|
||||
#define FSin(x) FSinTab[(x)&FSINMAX]
|
||||
#define FCos(x) FCosTab[(x)&FSINMAX]
|
||||
|
||||
|
||||
4898
zsnes/src/gui/gui.asm
Normal file
4898
zsnes/src/gui/gui.asm
Normal file
File diff suppressed because it is too large
Load Diff
1340
zsnes/src/gui/guicheat.inc
Normal file
1340
zsnes/src/gui/guicheat.inc
Normal file
File diff suppressed because it is too large
Load Diff
190
zsnes/src/gui/guicombo.inc
Normal file
190
zsnes/src/gui/guicombo.inc
Normal file
@@ -0,0 +1,190 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ComboClip:
|
||||
xor eax,eax
|
||||
mov al,[GUINumCombo]
|
||||
.next
|
||||
cmp al,42
|
||||
jae .excess
|
||||
mov byte[GUIComboData+eax],0
|
||||
inc eax
|
||||
jmp .next
|
||||
.excess
|
||||
ret
|
||||
|
||||
ComboAdder:
|
||||
cmp byte[romloadskip],0
|
||||
je .romloaded
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
jne near .skipall
|
||||
.romloaded
|
||||
pushad
|
||||
call ComboClip
|
||||
mov eax,[NumCombo]
|
||||
shl eax,6
|
||||
add eax,[NumCombo]
|
||||
add eax,[NumCombo]
|
||||
add eax,CombinDataGlob
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
je .nogamespec
|
||||
sub eax,CombinDataGlob
|
||||
add eax,CombinDataLocl
|
||||
.nogamespec
|
||||
; copy data to eax
|
||||
mov ecx,20 ; copy name
|
||||
mov ebx,GUIComboTextH
|
||||
.loop
|
||||
mov dl,[ebx]
|
||||
mov [eax],dl
|
||||
inc ebx
|
||||
inc eax
|
||||
loop .loop
|
||||
mov ecx,42 ; copy combination code
|
||||
mov ebx,GUIComboData
|
||||
.loop2
|
||||
mov dl,[ebx]
|
||||
mov [eax],dl
|
||||
inc ebx
|
||||
inc eax
|
||||
loop .loop2
|
||||
mov dx,[GUIComboKey]
|
||||
mov [eax],dx
|
||||
mov dl,[GUIComboPNum]
|
||||
mov [eax+2],dl
|
||||
mov dl,[GUIComboLHorz]
|
||||
mov [eax+3],dl
|
||||
mov eax,[NumCombo]
|
||||
mov [GUIccombcursloc],eax
|
||||
sub eax,7
|
||||
cmp [GUIccombviewloc],eax
|
||||
jge .rangeokay
|
||||
mov [GUIccombviewloc],eax
|
||||
.rangeokay
|
||||
inc dword[NumCombo]
|
||||
mov eax,[NumCombo]
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
jne .local
|
||||
mov [NumComboGlob],eax
|
||||
jmp .global
|
||||
.local
|
||||
mov [NumComboLocl],eax
|
||||
.global
|
||||
popad
|
||||
mov byte[GUIComboTextH],0
|
||||
mov byte[GUINumCombo],0
|
||||
mov dword[GUIComboKey],0
|
||||
.skipall
|
||||
ret
|
||||
|
||||
ComboReplace:
|
||||
pushad
|
||||
call ComboClip
|
||||
mov eax,[GUIccombcursloc]
|
||||
shl eax,6
|
||||
add eax,[GUIccombcursloc]
|
||||
add eax,[GUIccombcursloc]
|
||||
add eax,CombinDataGlob
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
je .nogamespec
|
||||
sub eax,CombinDataGlob
|
||||
add eax,CombinDataLocl
|
||||
.nogamespec
|
||||
; copy data to eax
|
||||
mov ecx,20 ; copy name
|
||||
mov ebx,GUIComboTextH
|
||||
.loop
|
||||
mov dl,[ebx]
|
||||
mov [eax],dl
|
||||
inc ebx
|
||||
inc eax
|
||||
loop .loop
|
||||
mov ecx,42 ; copy combination code
|
||||
mov ebx,GUIComboData
|
||||
.loop2
|
||||
mov dl,[ebx]
|
||||
mov [eax],dl
|
||||
inc ebx
|
||||
inc eax
|
||||
loop .loop2
|
||||
mov dx,[GUIComboKey]
|
||||
mov [eax],dx
|
||||
mov dl,[GUIComboPNum]
|
||||
mov [eax+2],dl
|
||||
mov dl,[GUIComboLHorz]
|
||||
mov [eax+3],dl
|
||||
popad
|
||||
ret
|
||||
|
||||
ComboRemoval:
|
||||
pushad
|
||||
mov eax,[GUIccombcursloc]
|
||||
shl eax,6
|
||||
add eax,[GUIccombcursloc]
|
||||
add eax,[GUIccombcursloc]
|
||||
add eax,CombinDataGlob
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
je .nogamespec
|
||||
sub eax,CombinDataGlob
|
||||
add eax,CombinDataLocl
|
||||
.nogamespec
|
||||
mov ecx,[NumCombo]
|
||||
sub ecx,[GUIccombcursloc]
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
jle .nomove
|
||||
.loop2
|
||||
mov ebx,66
|
||||
.loop
|
||||
mov dl,[eax+66]
|
||||
mov [eax],dl
|
||||
inc eax
|
||||
dec ebx
|
||||
jnz .loop
|
||||
loop .loop2
|
||||
.nomove
|
||||
dec dword[NumCombo]
|
||||
mov eax,[NumCombo]
|
||||
or eax,eax
|
||||
jz .yeszero
|
||||
dec eax
|
||||
.yeszero
|
||||
cmp [GUIccombviewloc],eax
|
||||
jbe .notequal
|
||||
mov [GUIccombviewloc],eax
|
||||
.notequal
|
||||
cmp [GUIccombcursloc],eax
|
||||
jbe .notequal2
|
||||
mov [GUIccombcursloc],eax
|
||||
.notequal2
|
||||
mov eax,[NumCombo]
|
||||
cmp byte[GUIComboGameSpec],0
|
||||
jne .local
|
||||
mov [NumComboGlob],eax
|
||||
jmp .global
|
||||
.local
|
||||
mov [NumComboLocl],eax
|
||||
.global
|
||||
popad
|
||||
ret
|
||||
|
||||
2186
zsnes/src/gui/guikeys.inc
Normal file
2186
zsnes/src/gui/guikeys.inc
Normal file
File diff suppressed because it is too large
Load Diff
1555
zsnes/src/gui/guiload.inc
Normal file
1555
zsnes/src/gui/guiload.inc
Normal file
File diff suppressed because it is too large
Load Diff
499
zsnes/src/gui/guimisc.inc
Normal file
499
zsnes/src/gui/guimisc.inc
Normal file
@@ -0,0 +1,499 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
; Movie, Joystick setting (display) routines, SNES Reset Function
|
||||
|
||||
MovieRecord:
|
||||
mov byte[GUICBHold],0
|
||||
mov dword[MovieCounter],0
|
||||
cmp byte[MovieProcessing],0
|
||||
jne near .dontrecord
|
||||
; check if movie exists already
|
||||
mov ebx,[statefileloc]
|
||||
mov eax,[fnamest+ebx-3]
|
||||
push eax
|
||||
mov dword[fnamest+ebx-3],'.ZMV'
|
||||
mov al,[CMovieExt]
|
||||
mov byte[fnamest+ebx],al
|
||||
|
||||
; check if file exists
|
||||
cmp byte[MovieRecordWinVal],1
|
||||
je .nocheck
|
||||
mov edx,fnamest+1
|
||||
call Open_File
|
||||
jc .nocheck
|
||||
mov bx,ax
|
||||
call Close_File
|
||||
mov byte[MovieRecordWinVal],1
|
||||
jmp .skipstate
|
||||
.nocheck
|
||||
mov dword[CFWriteHead],0
|
||||
mov dword[CReadHead],0
|
||||
mov dword[ReadHead],0
|
||||
mov dword[CFWriteStart],64
|
||||
mov byte[MovieRecordWinVal],0
|
||||
call ChangetoSRAMdir
|
||||
mov byte[NoPictureSave],1
|
||||
call statesaver
|
||||
mov byte[NoPictureSave],0
|
||||
mov edx,fnamest+1
|
||||
call Open_File_Write
|
||||
mov bx,ax
|
||||
mov [MovieFileHand],bx
|
||||
mov cx,0
|
||||
mov dx,0
|
||||
call File_Seek_End
|
||||
mov al,[soundon]
|
||||
mov [RecData],al
|
||||
mov eax,[welcome+8]
|
||||
mov [RecData+1],eax
|
||||
mov byte[RecData+2],1
|
||||
mov eax,[timer2upd]
|
||||
mov [RecData+3],eax
|
||||
mov eax,[curexecstate]
|
||||
mov [RecData+7],eax
|
||||
mov edx,RecData
|
||||
mov ecx,16
|
||||
call Write_File
|
||||
cmp dword[ramsize],0
|
||||
je .noram
|
||||
mov edx,[sram]
|
||||
mov ecx,[ramsize]
|
||||
call Write_File
|
||||
.noram
|
||||
mov byte[MovieProcessing],2
|
||||
mov dword[MovieBuffSize],0
|
||||
mov dword[MovieBuffFrame],0
|
||||
mov byte[RepeatFrame],0
|
||||
cmp byte[CNetType],20
|
||||
je near .netstuff
|
||||
cmp byte[CNetType],21
|
||||
je near .netstuff
|
||||
mov dword[nmiprevaddrl],0
|
||||
mov dword[nmiprevaddrh],0
|
||||
mov dword[nmirept],0
|
||||
mov dword[nmiprevline],224
|
||||
mov dword[nmistatus],0
|
||||
mov byte[spcnumread],0
|
||||
mov byte[NextLineCache],0
|
||||
mov dword[PJoyAOrig],0
|
||||
mov dword[PJoyBOrig],0
|
||||
mov dword[PJoyCOrig],0
|
||||
mov dword[PJoyDOrig],0
|
||||
mov dword[PJoyEOrig],0
|
||||
mov byte[DSPMem+08h],0
|
||||
mov byte[DSPMem+18h],0
|
||||
mov byte[DSPMem+28h],0
|
||||
mov byte[DSPMem+38h],0
|
||||
mov byte[DSPMem+48h],0
|
||||
mov byte[DSPMem+58h],0
|
||||
mov byte[DSPMem+68h],0
|
||||
mov byte[DSPMem+78h],0
|
||||
.netstuff
|
||||
call ChangetoLOADdir
|
||||
.skipstate
|
||||
pop eax
|
||||
mov ebx,[statefileloc]
|
||||
mov [fnamest+ebx-3],eax
|
||||
.dontrecord
|
||||
ret
|
||||
|
||||
MovieRecordWinVal db 0
|
||||
NEWSYM MovieProcessing, db 0
|
||||
NEWSYM MovieFileHand, dw 0
|
||||
NEWSYM RepeatFrame, db 0
|
||||
NEWSYM RecData, times 16 db 0
|
||||
NEWSYM NoPictureSave, db 0
|
||||
|
||||
SkipMovie:
|
||||
mov byte[MovieRecordWinVal],0
|
||||
mov byte[GUICBHold],0
|
||||
ret
|
||||
|
||||
MovieStop:
|
||||
mov byte[GUICBHold],0
|
||||
cmp byte[MovieProcessing],0
|
||||
je .skipfileend
|
||||
mov bx,[MovieFileHand]
|
||||
mov byte[MovieProcessing],0
|
||||
call Close_File
|
||||
.skipfileend
|
||||
ret
|
||||
|
||||
CalibrateDispA:
|
||||
xor ebx,ebx
|
||||
mov ecx,256
|
||||
.a
|
||||
mov byte[pressed+ebx],0
|
||||
inc ebx
|
||||
loop .a
|
||||
call GUIUnBuffer
|
||||
call DisplayBoxes
|
||||
call DisplayMenu
|
||||
GUIBox 75,103,192,135,160
|
||||
GUIBox 75,103,192,103,162
|
||||
GUIBox 75,103,75,135,161
|
||||
GUIBox 192,103,192,135,159
|
||||
GUIBox 75,135,192,135,158
|
||||
GUIOuttext 81,109,guicalberror1,220-15
|
||||
GUIOuttext 80,108,guicalberror1,220
|
||||
GUIOuttext 81,117,guicalberror2,220-15
|
||||
GUIOuttext 80,116,guicalberror2,220
|
||||
GUIOuttext 81,125,guicalberror3,220-15
|
||||
GUIOuttext 80,124,guicalberror3,220
|
||||
call vidpastecopyscr
|
||||
call WaitForKey
|
||||
ret
|
||||
|
||||
CalibrateDispB:
|
||||
xor ebx,ebx
|
||||
mov ecx,256
|
||||
.a
|
||||
mov byte[pressed+ebx],0
|
||||
inc ebx
|
||||
loop .a
|
||||
call GUIUnBuffer
|
||||
call DisplayBoxes
|
||||
call DisplayMenu
|
||||
GUIBox 75,103,192,143,160
|
||||
GUIBox 75,103,192,103,162
|
||||
GUIBox 75,103,75,143,161
|
||||
GUIBox 192,103,192,143,159
|
||||
GUIBox 75,143,192,143,158
|
||||
GUIOuttext 81,109,guicalberror4,220-15
|
||||
GUIOuttext 80,108,guicalberror4,220
|
||||
GUIOuttext 81,117,guicalberror5,220-15
|
||||
GUIOuttext 80,116,guicalberror5,220
|
||||
GUIOuttext 81,125,guicalberror6,220-15
|
||||
GUIOuttext 80,124,guicalberror6,220
|
||||
GUIOuttext 81,133,guicalberror7,220-15
|
||||
GUIOuttext 80,132,guicalberror7,220
|
||||
call vidpastecopyscr
|
||||
call WaitForKey
|
||||
ret
|
||||
|
||||
guicalberror1 db 'PRESS THE TOP LEFT',0
|
||||
guicalberror2 db 'CORNER AND PRESS A',0
|
||||
guicalberror3 db 'BUTTON OR KEY',0
|
||||
guicalberror4 db 'PRESS THE BOTTOM',0
|
||||
guicalberror5 db 'RIGHT CORNER AND',0
|
||||
guicalberror6 db 'PRESS A BUTTON OR',0
|
||||
guicalberror7 db 'KEY',0
|
||||
|
||||
|
||||
SetAllKeys:
|
||||
xor ebx,ebx
|
||||
mov ecx,256+128+64
|
||||
.a
|
||||
mov byte[pressed+ebx],0
|
||||
inc ebx
|
||||
loop .a
|
||||
|
||||
mov byte[GUICBHold],0
|
||||
mov edi,pl1selk
|
||||
cmp byte[cplayernum],1
|
||||
jne .nopl2
|
||||
mov edi,pl2selk
|
||||
.nopl2
|
||||
cmp byte[cplayernum],2
|
||||
jne .nopl3
|
||||
mov edi,pl3selk
|
||||
.nopl3
|
||||
cmp byte[cplayernum],3
|
||||
jne .nopl4
|
||||
mov edi,pl4selk
|
||||
.nopl4
|
||||
cmp byte[cplayernum],4
|
||||
jne .nopl5
|
||||
mov edi,pl5selk
|
||||
.nopl5
|
||||
mov dword[guicpressptr],edi
|
||||
xor ebx,ebx
|
||||
mov ecx,12
|
||||
mov dword[guipressptr],guipresstext4b
|
||||
.loop
|
||||
mov eax,[.ordercalb+ebx*4]
|
||||
shl eax,2
|
||||
add dword[guicpressptr],eax
|
||||
push ebx
|
||||
push ecx
|
||||
call guipresstestb
|
||||
pop ecx
|
||||
pop ebx
|
||||
add dword[guipressptr],21
|
||||
mov eax,[.ordercalb+ebx*4]
|
||||
shl eax,2
|
||||
sub dword[guicpressptr],eax
|
||||
inc ebx
|
||||
dec ecx
|
||||
jnz .loop
|
||||
ret
|
||||
.ordercalb dd 2,3,4,5,1,0,7,10,6,9,8,11
|
||||
|
||||
CalibrateDev1:
|
||||
xor eax,eax
|
||||
mov al,[cplayernum]
|
||||
mov ebx,[GUIInputRefP+eax*4]
|
||||
mov bl,[ebx]
|
||||
mov byte[GUICBHold],0
|
||||
cmp byte[pl1p209+eax],0
|
||||
jne near .port209
|
||||
cmp bl,1
|
||||
jbe .nojoy
|
||||
cmp bl,18
|
||||
je near .6button
|
||||
cmp bl,5
|
||||
je near .6button
|
||||
cmp bl,6
|
||||
jae .nojoy
|
||||
mov dx,201h
|
||||
call GetCoords
|
||||
mov eax,[JoyX]
|
||||
mov [.joybcx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybcy],eax
|
||||
call CalibrateDispA
|
||||
mov dx,201h
|
||||
call GetCoords
|
||||
mov eax,[JoyX]
|
||||
mov [.joyblx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybly],eax
|
||||
call CalibrateDispB
|
||||
mov dx,201h
|
||||
call GetCoords
|
||||
jmp .procdir
|
||||
.nojoy
|
||||
ret
|
||||
.6button
|
||||
mov dx,201h
|
||||
call GetCoords3
|
||||
mov eax,[JoyX]
|
||||
mov [.joybcx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybcy],eax
|
||||
call CalibrateDispA
|
||||
mov dx,201h
|
||||
call GetCoords3
|
||||
mov eax,[JoyX]
|
||||
mov [.joyblx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybly],eax
|
||||
call CalibrateDispB
|
||||
mov dx,201h
|
||||
call GetCoords3
|
||||
.procdir
|
||||
mov eax,[.joybcx]
|
||||
add eax,[.joyblx]
|
||||
shr eax,1
|
||||
mov [JoyMinX],eax
|
||||
mov [CalibXmin],eax
|
||||
mov eax,[.joybcy]
|
||||
add eax,[.joybly]
|
||||
shr eax,1
|
||||
mov [JoyMinY],eax
|
||||
mov [CalibYmin],eax
|
||||
mov eax,[.joybcx]
|
||||
add eax,[JoyX]
|
||||
shr eax,1
|
||||
mov [JoyMaxX],eax
|
||||
mov [CalibXmax],eax
|
||||
mov eax,[.joybcy]
|
||||
add eax,[JoyY]
|
||||
shr eax,1
|
||||
mov [JoyMaxY],eax
|
||||
mov [CalibYmax],eax
|
||||
ret
|
||||
.port209
|
||||
cmp bl,1
|
||||
jbe .nojoy209
|
||||
cmp bl,18
|
||||
je near .6button209
|
||||
cmp bl,5
|
||||
je near .6button209
|
||||
cmp bl,6
|
||||
jae .nojoy209
|
||||
mov dx,209h
|
||||
call GetCoords
|
||||
mov eax,[JoyX]
|
||||
mov [.joybcx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybcy],eax
|
||||
call CalibrateDispA
|
||||
mov dx,209h
|
||||
call GetCoords
|
||||
mov eax,[JoyX]
|
||||
mov [.joyblx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybly],eax
|
||||
call CalibrateDispB
|
||||
mov dx,209h
|
||||
call GetCoords
|
||||
jmp .procdir209
|
||||
.nojoy209
|
||||
ret
|
||||
.6button209
|
||||
mov dx,209h
|
||||
call GetCoords3
|
||||
mov eax,[JoyX]
|
||||
mov [.joybcx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybcy],eax
|
||||
call CalibrateDispA
|
||||
mov dx,209h
|
||||
call GetCoords3
|
||||
mov eax,[JoyX]
|
||||
mov [.joyblx],eax
|
||||
mov eax,[JoyY]
|
||||
mov [.joybly],eax
|
||||
call CalibrateDispB
|
||||
mov dx,209h
|
||||
call GetCoords3
|
||||
.procdir209
|
||||
mov eax,[.joybcx]
|
||||
add eax,[.joyblx]
|
||||
shr eax,1
|
||||
mov [JoyMinX209],eax
|
||||
mov [CalibXmin209],eax
|
||||
mov eax,[.joybcy]
|
||||
add eax,[.joybly]
|
||||
shr eax,1
|
||||
mov [JoyMinY209],eax
|
||||
mov [CalibYmin209],eax
|
||||
mov eax,[.joybcx]
|
||||
add eax,[JoyX]
|
||||
shr eax,1
|
||||
mov [JoyMaxX209],eax
|
||||
mov [CalibXmax209],eax
|
||||
mov eax,[.joybcy]
|
||||
add eax,[JoyY]
|
||||
shr eax,1
|
||||
mov [JoyMaxY209],eax
|
||||
mov [CalibYmax209],eax
|
||||
ret
|
||||
.joyblx dd 0
|
||||
.joybly dd 0
|
||||
.joybcx dd 0
|
||||
.joybcy dd 0
|
||||
|
||||
|
||||
SetDevice:
|
||||
mov byte[GUICBHold],0
|
||||
xor eax,eax
|
||||
mov al,[cplayernum]
|
||||
cmp byte[OSPort],1
|
||||
ja .notdos
|
||||
cmp byte[pl1p209+eax],0
|
||||
jne .port209
|
||||
.notdos
|
||||
mov dword[CalibXmin],0
|
||||
mov ecx,[DevicePtr+eax*4]
|
||||
mov eax,[GUIInputRefP+eax*4]
|
||||
mov ebx,[GUIcurrentinputcursloc]
|
||||
mov bl,[GUIInputRefF+ebx]
|
||||
mov [eax],bl
|
||||
mov eax,ecx
|
||||
mov bh,[cplayernum]
|
||||
call SetInputDevice
|
||||
call UpdateDevices
|
||||
jmp .procmtap
|
||||
.port209
|
||||
mov dword[CalibXmin209],0
|
||||
mov ecx,[DevicePtr+eax*4]
|
||||
mov eax,[GUIInputRefP+eax*4]
|
||||
mov ebx,[GUIcurrentinputcursloc]
|
||||
mov bl,[GUIInputRefF+ebx]
|
||||
mov [eax],bl
|
||||
mov eax,ecx
|
||||
mov bh,[cplayernum]
|
||||
call SetInputDevice209
|
||||
call UpdateDevices
|
||||
.procmtap
|
||||
mov byte[MultiTap],1
|
||||
cmp byte[SFXEnable],1
|
||||
je .dismtap
|
||||
cmp byte[pl3contrl],0
|
||||
jne .mtap
|
||||
cmp byte[pl4contrl],0
|
||||
jne .mtap
|
||||
cmp byte[pl5contrl],0
|
||||
jne .mtap
|
||||
.dismtap
|
||||
mov byte[MultiTap],0
|
||||
.mtap
|
||||
ret
|
||||
|
||||
NEWSYM GUIDoReset
|
||||
call ClearScreen
|
||||
; mov byte[NetPlayNoMore],1
|
||||
mov byte[RestoreValues],0
|
||||
|
||||
cmp byte[MovieProcessing],0
|
||||
je .skipfileend
|
||||
mov bx,[MovieFileHand]
|
||||
mov byte[MovieProcessing],0
|
||||
call Close_File
|
||||
.skipfileend
|
||||
call RestoreSystemVars
|
||||
; clear spc700 ram
|
||||
mov al,0FFh
|
||||
mov edi,spcRam
|
||||
mov ecx,65472
|
||||
rep stosb
|
||||
; clear dsp ram
|
||||
xor al,al
|
||||
mov edi,DSPMem
|
||||
mov ecx,256
|
||||
rep stosb
|
||||
|
||||
; reset the snes
|
||||
call init65816
|
||||
call procexecloop
|
||||
|
||||
mov eax,spcRam
|
||||
mov edx,0EFh
|
||||
.loop
|
||||
mov byte[eax],0
|
||||
inc eax
|
||||
dec edx
|
||||
jnz .loop
|
||||
|
||||
xor eax,eax
|
||||
mov edx,spcRam
|
||||
mov ax,0FFC9h
|
||||
add edx,eax
|
||||
mov [spcPCRam],edx
|
||||
mov dword [spcS],1EFh
|
||||
mov dword [spcRamDP],spcRam
|
||||
mov byte[spcA],0
|
||||
mov byte[spcX],0
|
||||
mov byte[spcY],0
|
||||
mov byte[spcP],0
|
||||
mov byte[spcNZ],0
|
||||
mov byte[Voice0Status],0
|
||||
mov byte[Voice1Status],0
|
||||
mov byte[Voice2Status],0
|
||||
mov byte[Voice3Status],0
|
||||
mov byte[Voice4Status],0
|
||||
mov byte[Voice5Status],0
|
||||
mov byte[Voice6Status],0
|
||||
mov byte[Voice7Status],0
|
||||
mov byte[GUIQuit],2
|
||||
ret
|
||||
|
||||
2861
zsnes/src/gui/guimouse.inc
Normal file
2861
zsnes/src/gui/guimouse.inc
Normal file
File diff suppressed because it is too large
Load Diff
1780
zsnes/src/gui/guinetpl.inc
Normal file
1780
zsnes/src/gui/guinetpl.inc
Normal file
File diff suppressed because it is too large
Load Diff
836
zsnes/src/gui/guitools.inc
Normal file
836
zsnes/src/gui/guitools.inc
Normal file
@@ -0,0 +1,836 @@
|
||||
;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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; Tools for the GUI (string functions are also used elsewhere)
|
||||
|
||||
NEWSYM CopyString
|
||||
push eax
|
||||
.again
|
||||
mov dl,[eax]
|
||||
mov [ebx],dl
|
||||
inc eax
|
||||
inc ebx
|
||||
or dl,dl
|
||||
jnz .again
|
||||
pop eax
|
||||
ret
|
||||
|
||||
NEWSYM StringLength
|
||||
xor ecx,ecx
|
||||
push eax
|
||||
.loop
|
||||
cmp byte[eax],0
|
||||
je .done
|
||||
inc eax
|
||||
inc ecx
|
||||
jmp .loop
|
||||
.done
|
||||
pop eax
|
||||
ret
|
||||
|
||||
NEWSYM ClipString
|
||||
; clip string eax by bl characters
|
||||
.next
|
||||
push eax
|
||||
.again
|
||||
mov dl,[eax+1]
|
||||
mov [eax],dl
|
||||
inc eax
|
||||
or dl,dl
|
||||
jnz .again
|
||||
pop eax
|
||||
dec bl
|
||||
jnz .next
|
||||
ret
|
||||
|
||||
NEWSYM ConcatString
|
||||
; concat eax in front of ebx, store in ebx
|
||||
; move string forward by length of eax
|
||||
pushad
|
||||
mov esi,eax
|
||||
cmp byte[esi],0
|
||||
je near .nomore3
|
||||
.next
|
||||
inc esi
|
||||
cmp byte[esi],0
|
||||
jne .next
|
||||
dec esi
|
||||
.again
|
||||
mov dl,[esi]
|
||||
push ebx
|
||||
xor ecx,ecx
|
||||
.loop
|
||||
cmp byte[ebx],0
|
||||
je .nomore
|
||||
inc ebx
|
||||
inc ecx
|
||||
jmp .loop
|
||||
.nomore
|
||||
inc ebx
|
||||
inc ecx
|
||||
.loop2
|
||||
or ecx,ecx
|
||||
jz .nomore2
|
||||
mov dh,[ebx-1]
|
||||
mov [ebx],dh
|
||||
dec ebx
|
||||
dec ecx
|
||||
jmp .loop2
|
||||
.nomore2
|
||||
pop ebx
|
||||
mov [ebx],dl
|
||||
cmp eax,esi
|
||||
je .nomore3
|
||||
dec esi
|
||||
jmp .again
|
||||
.nomore3
|
||||
popad
|
||||
ret
|
||||
|
||||
GUIoutputchar:
|
||||
push edi
|
||||
push esi
|
||||
push eax
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
mov edi,GUIFontData
|
||||
lea ebx,[ebx*5]
|
||||
add edi,ebx
|
||||
mov cl,5
|
||||
.loopa
|
||||
mov ah,[edi]
|
||||
mov ch,5
|
||||
.loopb
|
||||
test ah,80h
|
||||
jz .nowrite
|
||||
mov al,[GUItextcolor]
|
||||
sub al,cl
|
||||
sub al,ch
|
||||
mov byte[esi],al
|
||||
.nowrite
|
||||
shl ah,1
|
||||
inc esi
|
||||
dec ch
|
||||
jnz .loopb
|
||||
add esi,283
|
||||
inc edi
|
||||
dec cl
|
||||
jnz .loopa
|
||||
pop eax
|
||||
pop esi
|
||||
pop edi
|
||||
ret
|
||||
|
||||
GUIOutputString:
|
||||
xor eax,eax
|
||||
.more
|
||||
mov al,[edi]
|
||||
or al,al
|
||||
jz .nomore
|
||||
mov al,[ASCII2Font+eax]
|
||||
call GUIoutputchar
|
||||
add esi,6
|
||||
inc edi
|
||||
jmp .more
|
||||
.nomore
|
||||
ret
|
||||
|
||||
%macro GUIOuttext 4
|
||||
mov edi,%2
|
||||
mov esi,edi
|
||||
shl esi,8
|
||||
shl edi,5
|
||||
add esi,edi
|
||||
add esi,[vidbuffer]
|
||||
add esi,%1
|
||||
add esi,16
|
||||
mov edi,%3
|
||||
mov byte[GUItextcolor],%4
|
||||
call GUIOutputString
|
||||
%endmacro
|
||||
|
||||
GUIDrawBox:
|
||||
.loop
|
||||
push edi
|
||||
push ecx
|
||||
rep stosb
|
||||
pop ecx
|
||||
pop edi
|
||||
add edi,288
|
||||
dec edx
|
||||
jnz .loop
|
||||
ret
|
||||
|
||||
%macro GUIBox 5
|
||||
mov edi,[vidbuffer]
|
||||
add edi,%1
|
||||
mov edx,%2
|
||||
mov ecx,edx
|
||||
shl edx,8
|
||||
shl ecx,5
|
||||
add edx,ecx
|
||||
add edi,edx
|
||||
add edi,16
|
||||
mov ecx,%3
|
||||
sub ecx,%1
|
||||
inc ecx
|
||||
mov edx,%4
|
||||
sub edx,%2
|
||||
inc edx
|
||||
mov al,%5
|
||||
call GUIDrawBox
|
||||
%endmacro
|
||||
|
||||
GUIHLines:
|
||||
cmp ecx,0
|
||||
jl near .nodraw
|
||||
cmp eax,255
|
||||
jg near .nodraw
|
||||
cmp eax,0
|
||||
jnl .noofx
|
||||
mov eax,0
|
||||
.noofx
|
||||
cmp ecx,255
|
||||
jng .noofx2
|
||||
mov ecx,255
|
||||
.noofx2
|
||||
cmp ebx,0
|
||||
jl .nodraw
|
||||
cmp ebx,223
|
||||
jg .nodraw
|
||||
|
||||
sub ecx,eax
|
||||
inc ecx
|
||||
|
||||
mov edi,[vidbuffer]
|
||||
add edi,eax
|
||||
add edi,16
|
||||
|
||||
mov eax,ebx
|
||||
shl eax,8
|
||||
add edi,eax
|
||||
mov eax,ebx
|
||||
shl eax,5
|
||||
add edi,eax
|
||||
mov eax,edx
|
||||
.loop
|
||||
mov [edi],ah
|
||||
add eax,[GUIcolscaleval]
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loop
|
||||
|
||||
.nodraw
|
||||
ret
|
||||
|
||||
GUIHLine:
|
||||
cmp ecx,0
|
||||
jl near .nodraw
|
||||
cmp eax,255
|
||||
jg near .nodraw
|
||||
cmp eax,0
|
||||
jnl .noofx
|
||||
mov eax,0
|
||||
.noofx
|
||||
cmp ecx,255
|
||||
jng .noofx2
|
||||
mov ecx,255
|
||||
.noofx2
|
||||
cmp ebx,0
|
||||
jl .nodraw
|
||||
cmp ebx,223
|
||||
jg .nodraw
|
||||
sub ecx,eax
|
||||
inc ecx
|
||||
mov edi,[vidbuffer]
|
||||
add edi,eax
|
||||
add edi,16
|
||||
mov eax,ebx
|
||||
shl eax,8
|
||||
add edi,eax
|
||||
mov eax,ebx
|
||||
shl eax,5
|
||||
add edi,eax
|
||||
mov eax,edx
|
||||
rep stosb
|
||||
.nodraw
|
||||
ret
|
||||
|
||||
%macro GUIPal 4
|
||||
mov dx,03C8h
|
||||
mov al,%1
|
||||
out dx,al
|
||||
inc dx
|
||||
mov al,%2
|
||||
out dx,al
|
||||
mov al,%3
|
||||
out dx,al
|
||||
mov al,%4
|
||||
out dx,al
|
||||
%endmacro
|
||||
|
||||
GUIDrawShadow:
|
||||
.loop
|
||||
push edi
|
||||
push ecx
|
||||
.loop2
|
||||
mov al,[edi-3*288-3]
|
||||
cmp al,148
|
||||
jb .nomidshad
|
||||
cmp al,167
|
||||
ja .mid2
|
||||
add byte[edi-3*288-3],20
|
||||
jmp .noshadow
|
||||
.mid2
|
||||
cmp al,189
|
||||
jb .nomidshad
|
||||
cmp al,220
|
||||
ja .nomidshad
|
||||
sub al,189
|
||||
shr al,1
|
||||
add al,189
|
||||
mov byte[edi-288*3-3],al
|
||||
jmp .noshadow
|
||||
.nomidshad
|
||||
mov al,[edi]
|
||||
cmp al,32
|
||||
jae .noshadow
|
||||
add al,96
|
||||
mov [edi],al
|
||||
.noshadow
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loop2
|
||||
pop ecx
|
||||
pop edi
|
||||
add edi,288
|
||||
dec edx
|
||||
jnz near .loop
|
||||
ret
|
||||
|
||||
%macro GUIShadow 4
|
||||
mov edi,[vidbuffer]
|
||||
add edi,%1+%2*288+16
|
||||
mov ecx,%3-%1+1
|
||||
mov edx,%4-%2+1
|
||||
call GUIDrawShadow
|
||||
%endmacro
|
||||
|
||||
|
||||
GUIDrawShadow2:
|
||||
.loop
|
||||
push edi
|
||||
push ecx
|
||||
.loop2
|
||||
mov al,[edi]
|
||||
cmp al,32
|
||||
jae .noshadow
|
||||
add al,96
|
||||
mov [edi],al
|
||||
.noshadow
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .loop2
|
||||
pop ecx
|
||||
pop edi
|
||||
add edi,288
|
||||
dec ebx
|
||||
jnz .loop
|
||||
ret
|
||||
|
||||
GUIoutputcharwin:
|
||||
push edi
|
||||
push esi
|
||||
push eax
|
||||
xor ebx,ebx
|
||||
mov bl,al
|
||||
mov edi,GUIFontData
|
||||
lea ebx,[ebx*5]
|
||||
add edi,ebx
|
||||
mov cl,5
|
||||
.loopa
|
||||
mov ah,[edi]
|
||||
mov ch,5
|
||||
cmp esi,[vidbuffer]
|
||||
jb .below
|
||||
mov edx,[vidbuffer]
|
||||
add edx,224*288
|
||||
cmp esi,edx
|
||||
jb .loopb
|
||||
.below
|
||||
add esi,5
|
||||
jmp .nowrite2
|
||||
.loopb
|
||||
test ah,80h
|
||||
jz .nowrite
|
||||
mov al,[GUItextcolor]
|
||||
mov byte[esi],al
|
||||
.nowrite
|
||||
shl ah,1
|
||||
inc esi
|
||||
dec ch
|
||||
jnz .loopb
|
||||
.nowrite2
|
||||
add esi,283
|
||||
inc edi
|
||||
dec cl
|
||||
jnz .loopa
|
||||
pop eax
|
||||
pop esi
|
||||
pop edi
|
||||
ret
|
||||
|
||||
GUIOutputStringwin:
|
||||
xor eax,eax
|
||||
.more
|
||||
mov al,[edi]
|
||||
or al,al
|
||||
jz .nomore
|
||||
mov al,[ASCII2Font+eax]
|
||||
cmp edx,-8
|
||||
jl .nodraw
|
||||
cmp edx,255
|
||||
jg .nodraw
|
||||
push esi
|
||||
push edx
|
||||
add esi,edx
|
||||
call GUIoutputcharwin
|
||||
pop edx
|
||||
pop esi
|
||||
.nodraw
|
||||
add edx,6
|
||||
inc edi
|
||||
jmp .more
|
||||
.nomore
|
||||
ret
|
||||
|
||||
GUIOutputStringwinl:
|
||||
xor eax,eax
|
||||
mov ecx,[cloadmaxlen]
|
||||
.more
|
||||
mov al,[edi]
|
||||
cmp byte[OSPort],1
|
||||
jbe .noperc
|
||||
cmp al,'%'
|
||||
jne .noperc
|
||||
call ConvertPercValue
|
||||
.noperc
|
||||
or al,al
|
||||
jz .nomore
|
||||
mov al,[ASCII2Font+eax]
|
||||
cmp edx,-8
|
||||
jl .nodraw
|
||||
cmp edx,255
|
||||
jg .nodraw
|
||||
push esi
|
||||
push edx
|
||||
push ecx
|
||||
add esi,edx
|
||||
call GUIoutputcharwin
|
||||
pop ecx
|
||||
pop edx
|
||||
pop esi
|
||||
.nodraw
|
||||
add edx,6
|
||||
inc edi
|
||||
dec ecx
|
||||
jz .nomore
|
||||
jmp .more
|
||||
.nomore
|
||||
ret
|
||||
|
||||
ConvertPercValue:
|
||||
mov al,[edi+2]
|
||||
cmp al,'a'
|
||||
jb .notlower
|
||||
cmp al,'z'
|
||||
ja .notlower
|
||||
sub al,'a'-'A'
|
||||
.notlower
|
||||
mov ah,[edi+1]
|
||||
cmp ah,'a'
|
||||
jb .notlowerb
|
||||
cmp ah,'z'
|
||||
ja .notlowerb
|
||||
sub ah,'a'-'A'
|
||||
.notlowerb
|
||||
cmp al,'0'
|
||||
jb .noperc
|
||||
cmp al,'9'
|
||||
jbe .yesperc
|
||||
cmp al,'F'
|
||||
ja .noperc
|
||||
cmp al,'A'
|
||||
jb .noperc
|
||||
.yesperc
|
||||
cmp ah,'0'
|
||||
jb .noperc
|
||||
cmp ah,'9'
|
||||
jbe .yesperc2
|
||||
cmp ah,'F'
|
||||
ja .noperc
|
||||
cmp ah,'A'
|
||||
jb .noperc
|
||||
.yesperc2
|
||||
sub al,'0'
|
||||
cmp al,9
|
||||
jbe .nodec
|
||||
sub al,'A'-'0'-10
|
||||
.nodec
|
||||
sub ah,'0'
|
||||
cmp ah,9
|
||||
jbe .nodecb
|
||||
sub ah,'A'-'0'-10
|
||||
.nodecb
|
||||
shl ah,4
|
||||
or al,ah
|
||||
add edi,2
|
||||
and eax,0FFh
|
||||
ret
|
||||
.noperc
|
||||
xor eax,eax
|
||||
mov al,[edi]
|
||||
ret
|
||||
|
||||
OutputUnder:
|
||||
cmp edx,-8
|
||||
jl .nodraw
|
||||
cmp edx,255
|
||||
jg .nodraw
|
||||
mov dword[esi+edx+5*288-1],0E8E8E8E8h
|
||||
mov byte[esi+edx+5*288+3],0E8h
|
||||
.nodraw
|
||||
ret
|
||||
|
||||
%macro GUIOuttextwin 1
|
||||
mov esi,ebx
|
||||
mov eax,ebx
|
||||
shl esi,8
|
||||
shl eax,5
|
||||
add esi,eax
|
||||
add esi,16
|
||||
add esi,[vidbuffer]
|
||||
mov edi,%1
|
||||
call GUIOutputStringwin
|
||||
%endmacro
|
||||
|
||||
%macro GUIOuttextwin2 4
|
||||
mov edx,dword[GUIwinposx+%1*4]
|
||||
mov ebx,dword[GUIwinposy+%1*4]
|
||||
add edx,%2
|
||||
add ebx,%3
|
||||
|
||||
mov esi,ebx
|
||||
mov eax,ebx
|
||||
shl esi,8
|
||||
shl eax,5
|
||||
add esi,eax
|
||||
add esi,16
|
||||
add esi,[vidbuffer]
|
||||
mov edi,%4
|
||||
call GUIOutputStringwin
|
||||
%endmacro
|
||||
|
||||
%macro GUIOuttextwin2l 4
|
||||
mov edx,dword[GUIwinposx+%1*4]
|
||||
mov ebx,dword[GUIwinposy+%1*4]
|
||||
add edx,%2
|
||||
add ebx,%3
|
||||
|
||||
mov esi,ebx
|
||||
mov eax,ebx
|
||||
shl esi,8
|
||||
shl eax,5
|
||||
add esi,eax
|
||||
add esi,16
|
||||
add esi,[vidbuffer]
|
||||
mov edi,%4
|
||||
call GUIOutputStringwinl
|
||||
%endmacro
|
||||
|
||||
%macro GUIOuttextwin2u 5
|
||||
mov edx,dword[GUIwinposx+%1*4]
|
||||
mov ebx,dword[GUIwinposy+%1*4]
|
||||
add edx,%2
|
||||
add ebx,%3
|
||||
|
||||
mov esi,ebx
|
||||
mov eax,ebx
|
||||
shl esi,8
|
||||
shl eax,5
|
||||
add esi,eax
|
||||
add esi,16
|
||||
add esi,[vidbuffer]
|
||||
mov edi,%4
|
||||
add edx,%5*6
|
||||
call OutputUnder
|
||||
sub edx,%5*6
|
||||
call GUIOutputStringwin
|
||||
%endmacro
|
||||
|
||||
GUIoutputiconwin:
|
||||
cmp eax,-9
|
||||
jl .nodraw
|
||||
cmp eax,256
|
||||
jl .draw
|
||||
.nodraw
|
||||
ret
|
||||
.draw
|
||||
mov esi,ebx
|
||||
mov ecx,ebx
|
||||
shl esi,8
|
||||
shl ecx,5
|
||||
add esi,ecx
|
||||
add esi,16
|
||||
add esi,[vidbuffer]
|
||||
add esi,eax
|
||||
mov cl,10
|
||||
.loopa
|
||||
mov ch,10
|
||||
cmp esi,[vidbuffer]
|
||||
jb .below
|
||||
mov edx,[vidbuffer]
|
||||
add edx,224*288
|
||||
cmp esi,edx
|
||||
jb .loopb
|
||||
.below
|
||||
add esi,10
|
||||
jmp .nowrite2
|
||||
.loopb
|
||||
mov al,[edi]
|
||||
or al,al
|
||||
jz .transp
|
||||
cmp al,189
|
||||
ja .col2
|
||||
cmp byte[GUIWincoladd],0
|
||||
je .col3
|
||||
inc al
|
||||
jmp .col3
|
||||
.col2
|
||||
sub al,[GUIWincoladd]
|
||||
dec al
|
||||
.col3
|
||||
mov [esi],al
|
||||
.transp
|
||||
inc edi
|
||||
inc esi
|
||||
dec ch
|
||||
jnz .loopb
|
||||
.nowrite2
|
||||
add esi,278
|
||||
dec cl
|
||||
jnz .loopa
|
||||
ret
|
||||
|
||||
%macro GUIDisplayIcon 1
|
||||
mov edi,%1
|
||||
call GUIoutputiconwin
|
||||
%endmacro
|
||||
|
||||
%macro GUIDisplayIconWin 4
|
||||
mov eax,dword[GUIwinposx+%1*4]
|
||||
mov ebx,dword[GUIwinposy+%1*4]
|
||||
add eax,%2
|
||||
add ebx,%3
|
||||
mov edi,%4
|
||||
call GUIoutputiconwin
|
||||
%endmacro
|
||||
|
||||
GUIDrawSlideBar:
|
||||
cmp eax,-10
|
||||
jl .ret
|
||||
cmp eax,256
|
||||
jg .ret
|
||||
jmp .noret
|
||||
.ret
|
||||
ret
|
||||
.noret
|
||||
mov edi,[vidbuffer]
|
||||
mov [vbuflimtop],edi
|
||||
mov edi,[vidbuffer]
|
||||
add edi,288*224
|
||||
sub edi,16
|
||||
mov [vbuflimbot],edi
|
||||
mov edi,eax
|
||||
mov eax,ebx
|
||||
shl ebx,8
|
||||
shl eax,5
|
||||
add edi,ebx
|
||||
add edi,eax
|
||||
add edi,[vidbuffer]
|
||||
add edi,16
|
||||
xor eax,eax
|
||||
dec ecx
|
||||
.loop
|
||||
cmp edx,0
|
||||
je near .toparea
|
||||
cmp ecx,0
|
||||
je near .bottomarea
|
||||
cmp ah,1
|
||||
je .filleddisp
|
||||
cmp edi,[vbuflimtop]
|
||||
jb near .nodraw
|
||||
cmp edi,[vbuflimbot]
|
||||
ja near .nodraw
|
||||
mov al,197
|
||||
sub al,byte[GUIWincoladd]
|
||||
mov [edi],al
|
||||
sub al,2
|
||||
mov [edi+1],al
|
||||
dec al
|
||||
mov [edi+2],al
|
||||
dec al
|
||||
mov [edi+3],al
|
||||
mov [edi+4],al
|
||||
inc al
|
||||
mov [edi+5],al
|
||||
inc al
|
||||
mov [edi+6],al
|
||||
add al,2
|
||||
mov [edi+7],al
|
||||
jmp .fin
|
||||
.filleddisp
|
||||
cmp edi,[vbuflimtop]
|
||||
jb near .nodraw
|
||||
cmp edi,[vbuflimbot]
|
||||
ja near .nodraw
|
||||
mov al,202
|
||||
sub al,byte[GUIWincoladd]
|
||||
mov [edi],al
|
||||
sub al,2
|
||||
mov [edi+1],al
|
||||
mov [edi+2],al
|
||||
mov [edi+3],al
|
||||
mov [edi+4],al
|
||||
mov [edi+5],al
|
||||
mov [edi+6],al
|
||||
sub al,2
|
||||
mov [edi+7],al
|
||||
jmp .fin
|
||||
.toparea
|
||||
cmp edi,[vbuflimtop]
|
||||
jb near .nodraw
|
||||
cmp edi,[vbuflimbot]
|
||||
ja near .nodraw
|
||||
mov al,202
|
||||
sub al,byte[GUIWincoladd]
|
||||
mov [edi],al
|
||||
add al,2
|
||||
mov [edi+1],al
|
||||
mov [edi+2],al
|
||||
mov [edi+3],al
|
||||
mov [edi+4],al
|
||||
mov [edi+5],al
|
||||
mov [edi+6],al
|
||||
mov [edi+7],al
|
||||
mov ah,1
|
||||
jmp .fin
|
||||
.bottomarea
|
||||
cmp edi,[vbuflimtop]
|
||||
jb near .nodraw
|
||||
cmp edi,[vbuflimbot]
|
||||
ja near .nodraw
|
||||
mov al,6
|
||||
mov al,196
|
||||
sub al,byte[GUIWincoladd]
|
||||
mov [edi],al
|
||||
mov [edi+1],al
|
||||
mov [edi+2],al
|
||||
mov [edi+3],al
|
||||
mov [edi+4],al
|
||||
mov [edi+5],al
|
||||
mov [edi+6],al
|
||||
add al,2
|
||||
mov [edi+7],al
|
||||
mov ah,0
|
||||
.fin
|
||||
.nodraw
|
||||
add edi,288
|
||||
dec ecx
|
||||
dec edx
|
||||
dec esi
|
||||
jnz near .loop
|
||||
ret
|
||||
|
||||
%macro DrawSlideBarWin 8
|
||||
; win#,X,Y start, %4-List Loc, %5-List size, %6-Screen size, %7-Bar Size
|
||||
mov ebx,%5
|
||||
mov ecx,%4
|
||||
; if (Screen Size > List Size) List Size = Screen Size
|
||||
cmp ebx,%6
|
||||
jae %%noscrbig
|
||||
mov ebx,%6
|
||||
%%noscrbig
|
||||
; If (ListLoc + ScreenSize > ListSize) ListLoc = ListSize - ScreenSize
|
||||
mov eax,ecx
|
||||
add eax,%6
|
||||
cmp eax,ebx
|
||||
jbe %%nosetlloc
|
||||
mov ecx,ebx
|
||||
sub ecx,%6
|
||||
%%nosetlloc
|
||||
; Scrollbarsize = (Screen Size/List size)*Bar Size
|
||||
push ebx
|
||||
mov eax,%6
|
||||
mov ebx,%7
|
||||
mul ebx
|
||||
pop ebx
|
||||
div ebx
|
||||
; If (Scrollbarsize < 5) Scrollbarsize = 5
|
||||
cmp eax,5
|
||||
jae %%validscroll
|
||||
mov eax,5
|
||||
%%validscroll
|
||||
; StartY = (Bar Size-Scrollbarsize)*(List Loc/(List size-ScreenSize))
|
||||
push eax
|
||||
sub eax,%7
|
||||
neg eax
|
||||
mul ecx
|
||||
sub ebx,%6
|
||||
cmp ebx,0
|
||||
je %%zero
|
||||
div ebx
|
||||
jmp %%notzero
|
||||
%%zero
|
||||
xor eax,eax
|
||||
%%notzero
|
||||
mov edx,eax
|
||||
pop eax
|
||||
mov ecx,eax
|
||||
add ecx,edx
|
||||
; ecx = endy, edx = starty
|
||||
mov esi,%7
|
||||
sub esi,ecx
|
||||
add esi,edx
|
||||
dec esi
|
||||
mov [%8],esi
|
||||
mov [%8+4],edx
|
||||
mov [%8+8],ecx
|
||||
mov eax,dword[GUIwinposx+%1*4]
|
||||
mov ebx,dword[GUIwinposy+%1*4]
|
||||
add eax,%2
|
||||
add ebx,%3
|
||||
mov esi,%7
|
||||
call GUIDrawSlideBar
|
||||
%endmacro
|
||||
|
||||
5622
zsnes/src/gui/guiwindp.inc
Normal file
5622
zsnes/src/gui/guiwindp.inc
Normal file
File diff suppressed because it is too large
Load Diff
1437
zsnes/src/gui/menu.asm
Normal file
1437
zsnes/src/gui/menu.asm
Normal file
File diff suppressed because it is too large
Load Diff
5327
zsnes/src/init.asm
Normal file
5327
zsnes/src/init.asm
Normal file
File diff suppressed because it is too large
Load Diff
2
zsnes/src/link.win32
Normal file
2
zsnes/src/link.win32
Normal file
@@ -0,0 +1,2 @@
|
||||
/Fezsnesw.exe chips\dsp1proc.obj dos\sw.obj dos\gppro.obj dos\vesa12.obj dos\zsipx.obj dos\modemrtn.obj dos\joy.obj dos\debug.obj dos\vesa2.obj dos\initvid.obj cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj video\procvid.obj win\copyvwin.obj win\winintrf.obj win\winlink.obj win\zloaderw.obj win\ztcp.obj win\zfilew.obj win\zipxw.obj video\makev16b.obj video\makev16t.obj video\makevid.obj video\mode716.obj video\mode716b.obj video\mode716d.obj video\mode716e.obj video\mode716t.obj video\mode7.obj video\mode7ext.obj video\mv16tms.obj video\newg162.obj video\newgfx16.obj video\newgfx2.obj video\newgfx.obj video\m716text.obj video\2xsaiw.obj video\2xsai.obj gui\gui.obj gui\menu.obj cpu\addrni.obj cpu\dma.obj cpu\dsp.obj cpu\dspproc.obj cpu\execute.obj cpu\irq.obj cpu\memory.obj cpu\spc700.obj cpu\stable.obj cpu\table.obj cpu\tableb.obj cpu\tablec.obj chips\dsp1emu.obj chips\fxemu2.obj chips\fxemu2b.obj chips\fxemu2c.obj chips\fxtable.obj chips\sa1proc.obj chips\sa1regs.obj chips\sfxproc.obj obj\unzip.obj obj\zzip.obj zlib.lib wsock32.lib user32.lib gdi32.lib shell32.lib ddraw.lib dsound.lib dinput.lib d3dx.lib /link /section:.text,erw
|
||||
|
||||
48
zsnes/src/macros.mac
Normal file
48
zsnes/src/macros.mac
Normal file
@@ -0,0 +1,48 @@
|
||||
;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.
|
||||
|
||||
|
||||
bits 32
|
||||
section .text
|
||||
; Zsnes required macros
|
||||
%imacro newsym 1
|
||||
GLOBAL _%1
|
||||
_%1:
|
||||
%1:
|
||||
%endmacro
|
||||
|
||||
%imacro newsym 2+
|
||||
GLOBAL _%1
|
||||
_%1:
|
||||
%1: %2
|
||||
%endmacro
|
||||
|
||||
%macro ALIGN32 0
|
||||
times ($$-$) & 1Fh nop ; Long word alignment
|
||||
%endmacro
|
||||
|
||||
%macro ALIGN16 0
|
||||
times ($$-$) & 1Fh nop ; Long word alignment
|
||||
%endmacro
|
||||
|
||||
%imacro extsym 1-*
|
||||
%rep %0
|
||||
EXTERN _%1
|
||||
%define %1 _%1
|
||||
%rotate 1
|
||||
%endrep
|
||||
%endmacro
|
||||
185
zsnes/src/makefile.dos
Normal file
185
zsnes/src/makefile.dos
Normal file
@@ -0,0 +1,185 @@
|
||||
#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.
|
||||
|
||||
CHIPDIR=chips
|
||||
CPUDIR=cpu
|
||||
DOSDIR=dos
|
||||
GUIDIR=gui
|
||||
VIDEODIR=video
|
||||
WINDIR=win
|
||||
OBJDIR=obj
|
||||
|
||||
CHIPSOBJ=${CHIPDIR}/dsp1emu.o ${CHIPDIR}/fxemu2.o ${CHIPDIR}/sfxproc.o\
|
||||
${CHIPDIR}/fxemu2b.o ${CHIPDIR}/fxemu2c.o ${CHIPDIR}/fxtable.o\
|
||||
${CHIPDIR}/sa1proc.o ${CHIPDIR}/sa1regs.o ${CHIPDIR}/dsp1proc.o
|
||||
|
||||
CPUOBJ=${CPUDIR}/addrni.o ${CPUDIR}/dma.o ${CPUDIR}/dsp.o ${CPUDIR}/dspproc.o\
|
||||
${CPUDIR}/execute.o ${CPUDIR}/irq.o ${CPUDIR}/memory.o\
|
||||
${CPUDIR}/spc700.o ${CPUDIR}/stable.o ${CPUDIR}/table.o\
|
||||
${CPUDIR}/tableb.o ${CPUDIR}/tablec.o
|
||||
|
||||
GUIOBJ=${GUIDIR}/gui.o ${GUIDIR}/menu.o
|
||||
|
||||
VIDEOBJ=${VIDEODIR}/makev16b.o ${VIDEODIR}/makev16t.o ${VIDEODIR}/makevid.o\
|
||||
${VIDEODIR}/mode716.o ${VIDEODIR}/mode716b.o ${VIDEODIR}/mode716d.o\
|
||||
${VIDEODIR}/mode716e.o ${VIDEODIR}/mode716t.o ${VIDEODIR}/mode7.o\
|
||||
${VIDEODIR}/mode7ext.o ${VIDEODIR}/mv16tms.o ${VIDEODIR}/newg162.o\
|
||||
${VIDEODIR}/newgfx16.o ${VIDEODIR}/newgfx2.o ${VIDEODIR}/newgfx.o\
|
||||
${VIDEODIR}/m716text.o ${VIDEODIR}/2xsai.o ${VIDEODIR}/procvid.o
|
||||
|
||||
DOSOBJ= ${DOSDIR}/dosintrf.o ${DOSDIR}/gppro.o ${DOSDIR}/debug.o\
|
||||
${DOSDIR}/initvid.o ${DOSDIR}/modemrtn.o ${DOSDIR}/sw32.o\
|
||||
${DOSDIR}/joy.o ${DOSDIR}/sw.o ${DOSDIR}/vesa12.o ${DOSDIR}/vesa2.o\
|
||||
${DOSDIR}/zloader.o ${DOSDIR}/zsipx.o ${DOSDIR}/zfile.o
|
||||
|
||||
WINOBJ=${WINDIR}/copywin.o ${WINDIR}/winintrf.o ${WINDIR}/winlink.o\
|
||||
${WINDIR}/zloaderw.o ${WINDIR}/ztcp.o ${WINDIR}/zipxw.o
|
||||
|
||||
PREOBJ=${OBJDIR}/dosbuff.o ${OBJDIR}/ipx.o ${OBJDIR}/unzip.o\
|
||||
${OBJDIR}/zipx.o ${OBJDIR}/zzip.o
|
||||
|
||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
|
||||
|
||||
|
||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ}
|
||||
LIBS=-lz -lgcc -lm
|
||||
CFLAGS=
|
||||
ASM=nasm
|
||||
ASMFLAGS=-f coff
|
||||
CC=gcc
|
||||
PP=gpp
|
||||
|
||||
|
||||
.SUFFIXES: .c .cpp .asm
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${CFLAGS} -o $@ -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
${PP} ${CFLAGS} -o $@ -c $<
|
||||
|
||||
%.o: %.asm
|
||||
${ASM} ${ASMFLAGS} -o $@ $<
|
||||
|
||||
|
||||
ALL: zsnes.exe
|
||||
|
||||
zsnes.exe: ${OBJS}
|
||||
${CC} -Ws -s -o zsnes.exe ${OBJS} ${LIBS}
|
||||
|
||||
${DOSDIR}/zloader.o: ${DOSDIR}/zloader.c
|
||||
fixsin.o: fixsin.c
|
||||
water.o: water.c
|
||||
${DOSDIR}/zfile.o: ${DOSDIR}/zfile.c
|
||||
${VIDEODIR}/2xsai.o: ${VIDEODIR}/2xsai.cpp
|
||||
${VIDEODIR}/procvid.o: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xSaImmx.inc
|
||||
${CHIPDIR}/dsp1proc.o: ${CHIPDIR}/dsp1proc.asm macros.mac
|
||||
${CHIPDIR}/sa1regs.o: ${CHIPDIR}/sa1regs.asm macros.mac\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regsw.mac
|
||||
${CHIPDIR}/sfxproc.o: ${CHIPDIR}/sfxproc.asm macros.mac\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regsw.mac
|
||||
|
||||
${CHIPDIR}/dsp1emu.o: ${CHIPDIR}/dsp1emu.c betauser.mac
|
||||
ui.o: ui.asm macros.mac betauser.mac
|
||||
cfgload.o:cfgload.asm macros.mac
|
||||
init.o:init.asm macros.mac
|
||||
${DOSDIR}/debug.o: ${DOSDIR}/debug.asm macros.mac
|
||||
${CPUDIR}/execute.o: ${CPUDIR}/execute.asm macros.mac
|
||||
${CPUDIR}/table.o: ${CPUDIR}/table.asm ${CPUDIR}/65816d.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816.inc\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regs.inc ${CPUDIR}/regsw.mac\
|
||||
${CPUDIR}/regsw.inc macros.mac
|
||||
${CPUDIR}/tableb.o: ${CPUDIR}/tableb.asm ${CPUDIR}/65816db.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816b.inc\
|
||||
${CPUDIR}/regs.mac macros.mac
|
||||
${CPUDIR}/tablec.o: ${CPUDIR}/tablec.asm ${CPUDIR}/65816dc.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816c.inc\
|
||||
${CPUDIR}/regs.mac macros.mac
|
||||
${CPUDIR}/stable.o: ${CPUDIR}/stable.asm ${CPUDIR}/s65816d.inc\
|
||||
${CPUDIR}/saddress.inc ${CPUDIR}/saddrni.inc ${CPUDIR}/se65816.inc\
|
||||
macros.mac
|
||||
${CPUDIR}/memory.o: ${CPUDIR}/memory.asm macros.mac
|
||||
${CPUDIR}/dma.o: ${CPUDIR}/dma.asm macros.mac
|
||||
${DOSDIR}/dosintrf.o: ${DOSDIR}/dosintrf.asm macros.mac
|
||||
vcache.o:vcache.asm macros.mac
|
||||
${DOSDIR}/initvid.o:${DOSDIR}/initvid.asm macros.mac
|
||||
${VIDEODIR}/makevid.o: ${VIDEODIR}/makevid.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/makev16b.o: ${VIDEODIR}/makev16b.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/makev16t.o: ${VIDEODIR}/makev16t.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mv16tms.o: ${VIDEODIR}/mv16tms.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode7.o: ${VIDEODIR}/mode7.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716.o: ${VIDEODIR}/mode716.asm ${VIDEODIR}/mode716.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716b.o:${VIDEODIR}/mode716b.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716t.o:${VIDEODIR}/mode716t.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716d.o:${VIDEODIR}/mode716d.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode7ext.o:${VIDEODIR}/mode7ext.asm macros.mac
|
||||
${VIDEODIR}/mode716e.o:${VIDEODIR}/mode716e.asm macros.mac
|
||||
${VIDEODIR}/m716text.o:${VIDEODIR}/m716text.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${CPUDIR}/irq.o: ${CPUDIR}/irq.asm macros.mac
|
||||
${CPUDIR}/dspproc.o: ${CPUDIR}/dspproc.asm macros.mac
|
||||
${CPUDIR}/spc700.o:${CPUDIR}/spc700.asm macros.mac\
|
||||
${CPUDIR}/regsw.mac ${CPUDIR}/spcdef.inc ${CPUDIR}/spcaddr.inc
|
||||
${CPUDIR}/dsp.o: ${CPUDIR}/dsp.asm macros.mac
|
||||
${DOSDIR}/vesa2.o: ${DOSDIR}/vesa2.asm macros.mac
|
||||
${DOSDIR}/vesa12.o: ${DOSDIR}/vesa12.asm macros.mac
|
||||
${DOSDIR}/joy.o: ${DOSDIR}/joy.asm macros.mac
|
||||
${DOSDIR}/sw.o: ${DOSDIR}/sw.asm macros.mac
|
||||
${GUIDIR}/gui.o: ${GUIDIR}/gui.asm ${GUIDIR}/guitools.inc\
|
||||
${GUIDIR}/guimisc.inc ${GUIDIR}/guimouse.inc ${GUIDIR}/guiwindp.inc\
|
||||
${GUIDIR}/guinetpl.inc ${GUIDIR}/guikeys.inc ${GUIDIR}/guicheat.inc\
|
||||
${GUIDIR}/guicombo.inc ${GUIDIR}/guiload.inc macros.mac
|
||||
${GUIDIR}/menu.o: ${GUIDIR}/menu.asm macros.mac
|
||||
${VIDEODIR}/newgfx.o:${VIDEODIR}/newgfx.asm ${VIDEODIR}/vidmacro.mac\
|
||||
${VIDEODIR}/newgfx2.mac ${VIDEODIR}/newgfx.mac macros.mac
|
||||
${VIDEODIR}/newgfx2.o:${VIDEODIR}/newgfx2.asm ${VIDEODIR}/newgfxwn.mac\
|
||||
${VIDEODIR}/newgfx.mac macros.mac
|
||||
${VIDEODIR}/newgfx16.o: ${VIDEODIR}/newgfx16.asm macros.mac ${VIDEODIR}/vidmacro.mac\
|
||||
${VIDEODIR}/newgfx16.mac ${VIDEODIR}/newg162.mac
|
||||
${VIDEODIR}/newg162.o: macros.mac ${VIDEODIR}/newg162.asm ${VIDEODIR}/newg162.mac\
|
||||
${VIDEODIR}/vidmacro.mac ${VIDEODIR}/newg16wn.mac
|
||||
${CHIPDIR}/fxemu2.o: ${CHIPDIR}/fxemu2.asm ${CHIPDIR}/fxemu2.mac\
|
||||
macros.mac
|
||||
${CHIPSDIR}/fxemu2b.o: ${CHIPDIR}/fxemu2b.asm ${CHIPDIR}/fxemu2.mac\
|
||||
${CHIPDIR}/fxemu2b.mac
|
||||
${CHIPSDIR}/fxemu2c.o: ${CHIPDIR}/fxemu2c.asm macros.mac ${CHIPDIR}/fxemu2.mac\
|
||||
${CHIPDIR}/fxemu2b.mac ${CHIPDIR}/fxemu2c.mac
|
||||
${CHIPDIR}/fxtable.o: ${CHIPDIR}/fxtable.asm macros.mac
|
||||
${DOSDIR}/gppro.o: ${DOSDIR}/gppro.asm macros.mac
|
||||
${DOSDIR}/zsipx.o: ${DOSDIR}/zsipx.asm
|
||||
${CHIPDIR}/sa1proc.o: ${CHIPDIR}/sa1proc.asm macros.mac
|
||||
endmem.o: endmem.asm macros.mac
|
||||
${DOSDIR}/modemrtn.o: ${DOSDIR}/modemrtn.asm macros.mac
|
||||
|
||||
clean:
|
||||
del *.o
|
||||
del ${CHIPDIR}\*.o
|
||||
del ${CPUDIR}\*.o
|
||||
del ${VIDEODIR}\*.o
|
||||
del ${GUIDIR}\*.o
|
||||
del ${DOSDIR}\*.o
|
||||
del zsnes.exe
|
||||
|
||||
212
zsnes/src/makefile.win
Normal file
212
zsnes/src/makefile.win
Normal file
@@ -0,0 +1,212 @@
|
||||
#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.
|
||||
|
||||
#This file depends on link.win32 so if you modify this makefile,
|
||||
#don't forget to update link.win32
|
||||
#it is quite ugly but without that trick, the compilation didn't
|
||||
#work for me (command line too long)
|
||||
|
||||
#put the correct path to your directx sdk here
|
||||
DXDIR=f:\mssdk
|
||||
|
||||
CHIPDIR=chips
|
||||
CPUDIR=cpu
|
||||
DOSDIR=dos
|
||||
GUIDIR=gui
|
||||
VIDEODIR=video
|
||||
WINDIR=win
|
||||
OBJDIR=obj
|
||||
|
||||
CHIPSOBJ=${CHIPDIR}/sfxproc.obj ${CHIPDIR}/fxemu2.obj ${CHIPDIR}/dsp1proc.obj\
|
||||
${CHIPDIR}/fxemu2b.obj ${CHIPDIR}/fxemu2c.obj ${CHIPDIR}/fxtable.obj\
|
||||
${CHIPDIR}/sa1proc.obj ${CHIPDIR}/sa1regs.obj ${CHIPDIR}/dsp1emu.obj
|
||||
|
||||
CPUOBJ=${CPUDIR}/addrni.obj ${CPUDIR}/dma.obj ${CPUDIR}/dsp.obj ${CPUDIR}/dspproc.obj\
|
||||
${CPUDIR}/execute.obj ${CPUDIR}/irq.obj ${CPUDIR}/memory.obj \
|
||||
${CPUDIR}/spc700.obj ${CPUDIR}/stable.obj ${CPUDIR}/table.obj\
|
||||
${CPUDIR}/tableb.obj ${CPUDIR}/tablec.obj
|
||||
|
||||
GUIOBJ=${GUIDIR}/gui.obj ${GUIDIR}/menu.obj
|
||||
|
||||
VIDEOBJ=${VIDEODIR}/makev16b.obj ${VIDEODIR}/makev16t.obj ${VIDEODIR}/makevid.obj\
|
||||
${VIDEODIR}/mode716.obj ${VIDEODIR}/mode716b.obj ${VIDEODIR}/mode716d.obj\
|
||||
${VIDEODIR}/mode716e.obj ${VIDEODIR}/mode716t.obj ${VIDEODIR}/mode7.obj\
|
||||
${VIDEODIR}/mode7ext.obj ${VIDEODIR}/mv16tms.obj ${VIDEODIR}/newg162.obj\
|
||||
${VIDEODIR}/newgfx16.obj ${VIDEODIR}/newgfx2.obj ${VIDEODIR}/newgfx.obj\
|
||||
${VIDEODIR}/m716text.obj ${VIDEODIR}/2xsaiw.obj ${VIDEODIR}/2xsai.obj\
|
||||
${VIDEODIR}/procvid.obj
|
||||
|
||||
WINOBJ=${WINDIR}/copyvwin.obj ${WINDIR}/winintrf.obj ${WINDIR}/winlink.obj\
|
||||
${WINDIR}/zloaderw.obj ${WINDIR}/ztcp.obj ${WINDIR}/zipxw.obj\
|
||||
${WINDIR}/zfilew.obj
|
||||
|
||||
WINDOSOBJ=${DOSDIR}/debug.obj ${DOSDIR}/joy.obj ${DOSDIR}/modemrtn.obj ${DOSDIR}/vesa2.obj\
|
||||
${DOSDIR}/initvid.obj ${DOSDIR}/sw.obj ${DOSDIR}/gppro.obj ${DOSDIR}/vesa12.obj
|
||||
|
||||
PREOBJ=${OBJDIR}/unzip.obj ${OBJDIR}/zzip.obj ${DOSDIR}/zsipx.obj
|
||||
|
||||
MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj
|
||||
|
||||
|
||||
|
||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${WINDOSOBJ}
|
||||
LIBS=
|
||||
CFLAGS=/c
|
||||
ASM=nasm
|
||||
ASMFLAGS=-f win32
|
||||
CC=cl
|
||||
|
||||
.SUFFIXES: .c .cpp .asm
|
||||
|
||||
%.obj : %.c
|
||||
${CC} ${CFLAGS} /Fo$@ $<
|
||||
|
||||
%.obj: %.cpp
|
||||
${CC} ${CFLAGS} /Fo$@ $<
|
||||
|
||||
%.obj: %.asm
|
||||
${ASM} ${ASMFLAGS} -o $@ $<
|
||||
|
||||
|
||||
ALL: zsnesw.exe
|
||||
|
||||
zsnesw.exe: ${OBJS} ${WINDIR}/zsnes.res
|
||||
cl @link.win32 ${WINDIR}/zsnes.res /link /libpath:${DXDIR}\lib
|
||||
|
||||
${WINDIR}/zsnes.res: ${WINDIR}/zsnes.rc
|
||||
rc ${WINDIR}/zsnes.rc
|
||||
${WINDIR}/copyvwin.obj: ${WINDIR}/copyvwin.asm macros.mac
|
||||
${WINDIR}/winintrf.obj: ${WINDIR}/winintrf.asm macros.mac
|
||||
${WINDIR}/zfilew.obj: ${WINDIR}/zfilew.c
|
||||
${WINDIR}/zipxw.obj: ${WINDIR}/zipxw.c
|
||||
${WINDIR}/zloaderw.obj: ${WINDIR}/zloaderw.c
|
||||
${WINDIR}/ztcp.obj: ${WINDIR}/ztcp.c
|
||||
${WINDIR}/winlink.obj: ${WINDIR}/winlink.cpp ${WINDIR}/resource.h
|
||||
${DOSDIR}/initvid.o:${DOSDIR}/initvid.asm macros.mac
|
||||
${DOSDIR}/modemrtn.o: ${DOSDIR}/modemrtn.asm macros.mac
|
||||
${DOSDIR}/zsipx.o: ${DOSDIR}/zsipx.asm
|
||||
${DOSDIR}/debug.obj: ${DOSDIR}/debug.asm macros.mac
|
||||
${DOSDIR}/joy.obj: ${DOSDIR}/joy.asm macros.mac
|
||||
${DOSDIR}/vesa2.obj: ${DOSDIR}/vesa2.asm macros.mac
|
||||
${DOSDIR}/gppro.o: ${DOSDIR}/gppro.asm macros.mac
|
||||
${DOSDIR}/sw.o: ${DOSDIR}/sw.asm macros.mac
|
||||
${DOSDIR}/vesa12.o: ${DOSDIR}/vesa12.asm macros.mac
|
||||
fixsin.obj: fixsin.c
|
||||
water.obj: water.c
|
||||
${VIDEODIR}/2xsaiw.obj: ${VIDEODIR}/2xsaiw.asm macros.mac
|
||||
${VIDEODIR}/2xsai.obj: ${VIDEODIR}/2xsai.cpp
|
||||
${VIDEODIR}/procvid.obj: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xSaImmx.inc
|
||||
${CHIPDIR}/sa1regs.obj: ${CHIPDIR}/sa1regs.asm macros.mac\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regsw.mac
|
||||
${CHIPDIR}/sfxproc.obj: ${CHIPDIR}/sfxproc.asm macros.mac\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regsw.mac
|
||||
|
||||
${CHIPDIR}/dsp1emu.obj: ${CHIPDIR}/dsp1emu.c betauser.mac
|
||||
${CHIPDIR}/dsp1proc.obj: ${CHIPDIR}/dsp1proc.asm macros.mac
|
||||
ui.obj: ui.asm macros.mac betauser.mac
|
||||
cfgload.obj:cfgload.asm macros.mac
|
||||
init.obj:init.asm macros.mac
|
||||
${DOSDIR}/debug.obj: ${DOSDIR}/debug.asm macros.mac
|
||||
${CPUDIR}/addrni.obj: ${CPUDIR}/addrni.asm
|
||||
${CPUDIR}/execute.obj: ${CPUDIR}/execute.asm macros.mac
|
||||
${CPUDIR}/table.obj: ${CPUDIR}/table.asm ${CPUDIR}/65816d.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816.inc\
|
||||
${CPUDIR}/regs.mac ${CPUDIR}/regs.inc ${CPUDIR}/regsw.mac\
|
||||
${CPUDIR}/regsw.inc macros.mac
|
||||
${CPUDIR}/tableb.obj: ${CPUDIR}/tableb.asm ${CPUDIR}/65816db.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816b.inc\
|
||||
${CPUDIR}/regs.mac macros.mac
|
||||
${CPUDIR}/tablec.obj: ${CPUDIR}/tablec.asm ${CPUDIR}/65816dc.inc\
|
||||
${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816c.inc\
|
||||
${CPUDIR}/regs.mac macros.mac
|
||||
${CPUDIR}/stable.obj: ${CPUDIR}/stable.asm ${CPUDIR}/s65816d.inc\
|
||||
${CPUDIR}/saddress.inc ${CPUDIR}/saddrni.inc ${CPUDIR}/se65816.inc\
|
||||
macros.mac
|
||||
${CPUDIR}/memory.obj: ${CPUDIR}/memory.asm macros.mac
|
||||
${CPUDIR}/dma.obj: ${CPUDIR}/dma.asm macros.mac
|
||||
${DOSDIR}/dosintrf.obj: ${DOSDIR}/dosintrf.asm macros.mac
|
||||
vcache.obj:vcache.asm macros.mac
|
||||
${DOSDIR}/initvid.obj:${DOSDIR}/initvid.asm macros.mac
|
||||
${VIDEODIR}/makevid.obj: ${VIDEODIR}/makevid.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/makev16b.obj: ${VIDEODIR}/makev16b.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/makev16t.obj: ${VIDEODIR}/makev16t.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mv16tms.obj: ${VIDEODIR}/mv16tms.asm ${VIDEODIR}/vidmacro.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode7.obj: ${VIDEODIR}/mode7.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716.obj: ${VIDEODIR}/mode716.asm ${VIDEODIR}/mode716.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716b.obj:${VIDEODIR}/mode716b.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716t.obj:${VIDEODIR}/mode716t.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode716d.obj:${VIDEODIR}/mode716d.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${VIDEODIR}/mode7ext.obj:${VIDEODIR}/mode7ext.asm macros.mac
|
||||
${VIDEODIR}/mode716e.obj:${VIDEODIR}/mode716e.asm macros.mac
|
||||
${VIDEODIR}/m716text.obj:${VIDEODIR}/m716text.asm ${VIDEODIR}/mode7.mac\
|
||||
macros.mac
|
||||
${CPUDIR}/irq.obj: ${CPUDIR}/irq.asm macros.mac
|
||||
${CPUDIR}/dspproc.obj: ${CPUDIR}/dspproc.asm macros.mac
|
||||
${CPUDIR}/spc700.obj:${CPUDIR}/spc700.asm macros.mac\
|
||||
${CPUDIR}/regsw.mac ${CPUDIR}/spcdef.inc ${CPUDIR}/spcaddr.inc
|
||||
${CPUDIR}/dsp.obj: ${CPUDIR}/dsp.asm macros.mac
|
||||
${DOSDIR}/vesa2.obj: ${DOSDIR}/vesa2.asm macros.mac
|
||||
${DOSDIR}/vesa12.obj: ${DOSDIR}/vesa12.asm macros.mac
|
||||
${DOSDIR}/joy.obj: ${DOSDIR}/joy.asm macros.mac
|
||||
${DOSDIR}/sw.obj: ${DOSDIR}/sw.asm macros.mac
|
||||
${GUIDIR}/gui.obj: ${GUIDIR}/gui.asm ${GUIDIR}/guitools.inc\
|
||||
${GUIDIR}/guimisc.inc ${GUIDIR}/guimouse.inc ${GUIDIR}/guiwindp.inc\
|
||||
${GUIDIR}/guinetpl.inc ${GUIDIR}/guikeys.inc ${GUIDIR}/guicheat.inc\
|
||||
${GUIDIR}/guicombo.inc ${GUIDIR}/guiload.inc macros.mac
|
||||
${GUIDIR}/menu.obj: ${GUIDIR}/menu.asm macros.mac
|
||||
${VIDEODIR}/newgfx.obj:${VIDEODIR}/newgfx.asm ${VIDEODIR}/vidmacro.mac\
|
||||
${VIDEODIR}/newgfx2.mac ${VIDEODIR}/newgfx.mac macros.mac
|
||||
${VIDEODIR}/newgfx2.obj:${VIDEODIR}/newgfx2.asm ${VIDEODIR}/newgfxwn.mac\
|
||||
${VIDEODIR}/newgfx.mac macros.mac
|
||||
${VIDEODIR}/newgfx16.obj: ${VIDEODIR}/newgfx16.asm macros.mac ${VIDEODIR}/vidmacro.mac\
|
||||
${VIDEODIR}/newgfx16.mac ${VIDEODIR}/newg162.mac
|
||||
${VIDEODIR}/newg162.obj: macros.mac ${VIDEODIR}/newg162.asm ${VIDEODIR}/newg162.mac\
|
||||
${VIDEODIR}/vidmacro.mac ${VIDEODIR}/newg16wn.mac
|
||||
${CHIPDIR}/fxemu2.obj: ${CHIPDIR}/fxemu2.asm ${CHIPDIR}/fxemu2.mac\
|
||||
macros.mac
|
||||
${CHIPDIR}/fxemu2b.obj: ${CHIPDIR}/fxemu2b.asm ${CHIPDIR}/fxemu2.mac\
|
||||
${CHIPDIR}/fxemu2b.mac
|
||||
${CHIPDIR}/fxemu2c.obj: ${CHIPDIR}/fxemu2c.asm macros.mac ${CHIPDIR}/fxemu2.mac\
|
||||
${CHIPDIR}/fxemu2b.mac ${CHIPDIR}/fxemu2c.mac
|
||||
${CHIPDIR}/fxtable.obj: ${CHIPDIR}/fxtable.asm macros.mac
|
||||
${DOSDIR}/gppro.obj: ${DOSDIR}/gppro.asm macros.mac
|
||||
${DOSDIR}/zsipx.obj: ${DOSDIR}/zsipx.asm
|
||||
${CHIPDIR}/sa1proc.obj: ${CHIPDIR}/sa1proc.asm macros.mac
|
||||
endmem.obj: endmem.asm macros.mac
|
||||
${DOSDIR}/modemrtn.obj: ${DOSDIR}/modemrtn.asm macros.mac
|
||||
|
||||
clean:
|
||||
del *.obj
|
||||
del ${CHIPDIR}\*.obj
|
||||
del ${CPUDIR}\*.obj
|
||||
del ${VIDEODIR}\*.obj
|
||||
del ${GUIDIR}\*.obj
|
||||
del ${WINDIR}\*.obj
|
||||
del ${WINDIR}\zsnes.res
|
||||
del ${DOSDIR}\*.obj
|
||||
del zsnesw.exe
|
||||
|
||||
|
||||
1330
zsnes/src/ui.asm
Normal file
1330
zsnes/src/ui.asm
Normal file
File diff suppressed because it is too large
Load Diff
3765
zsnes/src/vcache.asm
Normal file
3765
zsnes/src/vcache.asm
Normal file
File diff suppressed because it is too large
Load Diff
289
zsnes/src/video/2xsai.cpp
Normal file
289
zsnes/src/video/2xsai.cpp
Normal file
@@ -0,0 +1,289 @@
|
||||
//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--)
|
||||
}
|
||||
}
|
||||
|
||||
1358
zsnes/src/video/2xsaimmx.inc
Normal file
1358
zsnes/src/video/2xsaimmx.inc
Normal file
File diff suppressed because it is too large
Load Diff
1345
zsnes/src/video/2xsaiw.asm
Normal file
1345
zsnes/src/video/2xsaiw.asm
Normal file
File diff suppressed because it is too large
Load Diff
1375
zsnes/src/video/2xsaiw.inc
Normal file
1375
zsnes/src/video/2xsaiw.inc
Normal file
File diff suppressed because it is too large
Load Diff
5698
zsnes/src/video/copyvid.inc
Normal file
5698
zsnes/src/video/copyvid.inc
Normal file
File diff suppressed because it is too large
Load Diff
994
zsnes/src/video/m716text.asm
Normal file
994
zsnes/src/video/m716text.asm
Normal file
@@ -0,0 +1,994 @@
|
||||
;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 coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor
|
||||
EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab
|
||||
EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf
|
||||
EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset
|
||||
EXTSYM fulladdtab
|
||||
EXTSYM cwinptr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
%macro mode7halfadd 0
|
||||
mov [esi+288*2],dl
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bcl+edx*4]
|
||||
cmp cx,0
|
||||
je %%noadd
|
||||
and ebx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
%%noadd
|
||||
mov [esi],bx
|
||||
xor ecx,ecx
|
||||
%%nodraw
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladd 0
|
||||
mov [esi+288*2],dl
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
mov [esi],bx
|
||||
%%nodraw
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsub 0
|
||||
mov [esi+288*2],dl
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
xor ebx,0FFFFh
|
||||
mov [esi],bx
|
||||
%%nodraw
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsub 0
|
||||
mov [esi+288*2],dl
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
%endmacro
|
||||
|
||||
%macro mode7halfaddwinon 0
|
||||
mov [esi+288*2],dl
|
||||
mov eax,[cwinptr]
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[eax],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bcl+edx*4]
|
||||
cmp cx,0
|
||||
je %%noadd
|
||||
and ebx,[vesa2_clbit]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
%%noadd
|
||||
mov [esi],bx
|
||||
xor ecx,ecx
|
||||
%%nodraw
|
||||
inc dword[cwinptr]
|
||||
%endmacro
|
||||
|
||||
%macro mode7fulladdwinon 0
|
||||
mov [esi+288*2],dl
|
||||
mov eax,[cwinptr]
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[eax],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
mov [esi],bx
|
||||
%%nodraw
|
||||
inc dword[cwinptr]
|
||||
%endmacro
|
||||
|
||||
%macro mode7fullsubwinon 0
|
||||
mov [esi+288*2],dl
|
||||
mov eax,[cwinptr]
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[eax],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[ebp]
|
||||
mov ebx,[pal16bxcl+edx*4]
|
||||
and ecx,[vesa2_clbit]
|
||||
add ebx,ecx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
xor ebx,0FFFFh
|
||||
mov [esi],bx
|
||||
%%nodraw
|
||||
inc dword[cwinptr]
|
||||
%endmacro
|
||||
|
||||
%macro mode7mainsubwinon 0
|
||||
mov [esi+288*2],dl
|
||||
mov eax,[cwinptr]
|
||||
test dl,80h
|
||||
jnz %%nodraw
|
||||
or dl,dl
|
||||
jz %%nodraw
|
||||
test byte[eax],0FFh
|
||||
jnz %%nodraw
|
||||
mov ecx,[pal16b+edx*4]
|
||||
mov [esi],cx
|
||||
mov [ebp],cx
|
||||
%%nodraw
|
||||
inc dword[cwinptr]
|
||||
%endmacro
|
||||
|
||||
%macro mode716tmacro 1
|
||||
; 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 ebx,word[.cyloc]
|
||||
movsx eax,word[mode7C]
|
||||
imul eax,ebx
|
||||
neg eax
|
||||
mov [.mode7xpos],eax
|
||||
mov bx,word[mode7X0]
|
||||
add [.mode7xpos+1],bx
|
||||
|
||||
movsx ebx,word[.cyloc]
|
||||
movsx eax,word[mode7D]
|
||||
imul eax,ebx
|
||||
; neg ax
|
||||
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 ebx,word[.cxloc]
|
||||
movsx eax,word[mode7B]
|
||||
mov [.mode7yadder],eax
|
||||
imul eax,ebx
|
||||
add [.mode7ypos],eax
|
||||
|
||||
; 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
|
||||
mov ebp,transpbuf+32
|
||||
|
||||
; 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
|
||||
mov byte[.temp],0
|
||||
xor ebx,ebx
|
||||
xor edx,edx
|
||||
xor ecx,ecx
|
||||
mov dword[.mode7xadd2],800h
|
||||
mov byte[.mode7xinc],2
|
||||
test dword[.mode7xadder],80000000h
|
||||
jz .noneg
|
||||
mov dword[.mode7xadd2],-800h
|
||||
mov byte[.mode7xinc],-2
|
||||
.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
|
||||
|
||||
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 ch,ch
|
||||
mov [.mode7ptr],ebx
|
||||
mov cl,[edi+ebx]
|
||||
shl ecx,7
|
||||
add edi,ecx
|
||||
|
||||
.nextval
|
||||
test byte[.mode7xrpos+1],08h
|
||||
jnz near .rposoffx
|
||||
.nextposx
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near .rposoffy
|
||||
.nextposy
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
add [.mode7xrpos],eax
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[edi+edx]
|
||||
sub [.mode7yrpos],eax
|
||||
%1
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .nextval
|
||||
jmp .finishmode7
|
||||
.rposoffx
|
||||
mov al,[.mode7xinc]
|
||||
mov edi,[vram]
|
||||
add [.mode7ptr],al
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadd2]
|
||||
shl ecx,7
|
||||
sub [.mode7xrpos],eax
|
||||
add edi,ecx
|
||||
jmp .nextposx
|
||||
.rposoffy
|
||||
mov al,[.mode7yinc]
|
||||
mov edi,[vram]
|
||||
sub [.mode7ptr+1],al
|
||||
and byte[.mode7ptr+1],7Fh
|
||||
mov ebx,[.mode7ptr]
|
||||
xor ecx,ecx
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7yadd2]
|
||||
shl ecx,7
|
||||
add [.mode7yrpos],eax
|
||||
add edi,ecx
|
||||
jmp .nextposy
|
||||
.finishmode7
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, no repetition mode
|
||||
;**********************************************************
|
||||
|
||||
.norep2
|
||||
test byte[mode7set],40h
|
||||
jnz .tilerep2
|
||||
.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,2
|
||||
add ebp,2
|
||||
dec byte[.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
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.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
|
||||
|
||||
.nextvalr
|
||||
test byte[.mode7xrpos+1],08h
|
||||
jnz near .rposoffxr
|
||||
.nextposxr
|
||||
test byte[.mode7yrpos+1],08h
|
||||
jnz near .rposoffyr
|
||||
.nextposyr
|
||||
mov cl,[.mode7yrpos+1]
|
||||
mov eax,[.mode7xadder]
|
||||
mov ch,[.mode7xrpos+1]
|
||||
add [.mode7xrpos],eax
|
||||
mov dl,[mode7tab+ecx]
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[edi+edx]
|
||||
sub [.mode7yrpos],eax
|
||||
%1
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .nextvalr
|
||||
jmp .finishmode7
|
||||
.rposoffxr
|
||||
mov al,[.mode7xinc]
|
||||
mov edi,[vram]
|
||||
add [.mode7ptr],al
|
||||
jz .roff
|
||||
cmp byte[.mode7ptr],0FEh
|
||||
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
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .tilerep3
|
||||
jmp .finishmode7
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, old routines
|
||||
;**********************************************************
|
||||
|
||||
.nextval3
|
||||
test byte[mode7set],80h
|
||||
jnz near .norep
|
||||
.nextval2
|
||||
; get tile # @ ([.mode7xpos],[.mode7ypos])
|
||||
; get tile location in vram (tileloc=x*2+y*256)
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
mov cl,bl
|
||||
mov ch,al
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
mov dl,[mode7tab+ecx]
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
xor ch,ch
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadder]
|
||||
shl ecx,7
|
||||
add [.mode7xpos],eax
|
||||
add ecx,edx
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[edi+ecx]
|
||||
sub [.mode7ypos],eax
|
||||
%1
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .nextval2
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
; Color repetition
|
||||
.norep
|
||||
test byte[mode7set],40h
|
||||
jnz near .tilerep
|
||||
.nextvalb
|
||||
; get tile # @ ([.mode7xpos],[.mode7ypos])
|
||||
; get tile location in vram (tileloc=x*2+y*256)
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja near .offscr
|
||||
cmp byte[.mode7xpos+2],3
|
||||
ja near .offscr
|
||||
.offscrb
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
mov cl,bl
|
||||
mov ch,al
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
mov dl,[mode7tab+ecx]
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
xor ch,ch
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadder]
|
||||
shl ecx,7
|
||||
add [.mode7xpos],eax
|
||||
add ecx,edx
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[edi+ecx]
|
||||
sub [.mode7ypos],eax
|
||||
%1
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .nextvalb
|
||||
jmp .goon
|
||||
.offscrc
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja .offscr
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near .offscrb
|
||||
.offscr
|
||||
mov eax,[.mode7xadder]
|
||||
mov ebx,[.mode7yadder]
|
||||
add [.mode7xpos],eax
|
||||
sub [.mode7ypos],ebx
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz .offscrc
|
||||
.goon
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
|
||||
.tilerep
|
||||
.nextvalbtr
|
||||
; get tile # @ ([.mode7xpos],[.mode7ypos])
|
||||
; get tile location in vram (tileloc=x*2+y*256)
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja near .offscrtr
|
||||
cmp byte[.mode7xpos+2],3
|
||||
ja near .offscrtr
|
||||
.offscrtrb
|
||||
mov ebx,[.mode7ypos+1]
|
||||
mov eax,[.mode7xpos+1]
|
||||
mov cl,bl
|
||||
mov ch,al
|
||||
shl ebx,5
|
||||
shr eax,3
|
||||
mov dl,[mode7tab+ecx]
|
||||
and ebx,07FF8h
|
||||
shl al,1
|
||||
mov bl,al
|
||||
xor ch,ch
|
||||
mov cl,[edi+ebx]
|
||||
mov eax,[.mode7xadder]
|
||||
shl ecx,7
|
||||
add [.mode7xpos],eax
|
||||
add ecx,edx
|
||||
mov eax,[.mode7yadder]
|
||||
mov dl,[edi+ecx]
|
||||
sub [.mode7ypos],eax
|
||||
%1
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .nextvalbtr
|
||||
jmp .goon
|
||||
.offscrtrc
|
||||
cmp byte[.mode7ypos+2],3
|
||||
ja .offscrtr
|
||||
cmp byte[.mode7xpos+2],3
|
||||
jbe near .offscrtrb
|
||||
.offscrtr
|
||||
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
|
||||
add esi,2
|
||||
add ebp,2
|
||||
dec byte[.temp]
|
||||
jnz near .offscrtrc
|
||||
jmp .goon
|
||||
|
||||
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
|
||||
.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 dd 0 ; cx location
|
||||
.cyloc dd 0 ; cy location
|
||||
%endmacro
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 half Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716textbg
|
||||
; test byte[scaddset],1
|
||||
; jnz near drawmode7dcolor
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near drawmode716twinonextbg
|
||||
.domosaic
|
||||
test byte[scaddtype],80h
|
||||
jnz near drawmode716tsubextbg
|
||||
test byte[scaddtype],40h
|
||||
jz near drawmode716tfulladdextbg
|
||||
cmp byte[scrnon+1],0
|
||||
je near drawmode716tfulladdextbg
|
||||
cmp dword[coladdr],0
|
||||
jnz near drawmode716tfulladdextbg
|
||||
mode716tmacro mode7halfadd
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 Full Addition
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716tfulladdextbg
|
||||
mode716tmacro mode7fulladd
|
||||
|
||||
;**********************************************************
|
||||
; Processes and draws Mode 7 subtract
|
||||
;**********************************************************
|
||||
|
||||
drawmode716tsubextbg:
|
||||
mode716tmacro mode7fullsub
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, main & sub mode
|
||||
;**********************************************************
|
||||
|
||||
NEWSYM drawmode716tbextbg
|
||||
mode716tmacro mode7mainsub
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 half Addition, Window on
|
||||
;*******************************************************
|
||||
NEWSYM drawmode716twinonextbg
|
||||
test byte[scaddtype],80h
|
||||
jnz near drawmode716tsubwinonextbg
|
||||
test byte[scaddtype],40h
|
||||
jz near drawmode716tfulladdwinonextbg
|
||||
cmp byte[scrnon+1],0
|
||||
je near drawmode716tfulladdwinonextbg
|
||||
cmp dword[coladdr],0
|
||||
jnz near drawmode716tfulladdwinonextbg
|
||||
mode716tmacro mode7halfaddwinon
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7 Full Addition, Window on
|
||||
;*******************************************************
|
||||
|
||||
NEWSYM drawmode716tfulladdwinonextbg
|
||||
mode716tmacro mode7fulladdwinon
|
||||
|
||||
;**********************************************************
|
||||
; Processes and draws Mode 7 subtract, Window on
|
||||
;**********************************************************
|
||||
|
||||
NEWSYM drawmode716tsubwinonextbg
|
||||
mode716tmacro mode7fullsubwinon
|
||||
|
||||
;**********************************************************
|
||||
; Mode 7, main & sub mode, Window on
|
||||
;**********************************************************
|
||||
|
||||
NEWSYM drawmode716tbwinonextbg
|
||||
mode716tmacro mode7mainsubwinon
|
||||
|
||||
|
||||
NEWSYM drawmode716textbg2
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
|
||||
; 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
|
||||
|
||||
mov edi,transpbuf+32
|
||||
test byte[scaddtype],80h
|
||||
jnz near extbg2sub
|
||||
test byte[scaddtype],40h
|
||||
jz near extbg2add
|
||||
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawwin
|
||||
.domosaic
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop
|
||||
mov al,[esi+288*2]
|
||||
test al,80h
|
||||
jz .nopr2
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bcl+eax*4]
|
||||
cmp dx,0
|
||||
je .noadd
|
||||
and ebx,[vesa2_clbit]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
.noadd
|
||||
mov [esi],bx
|
||||
.nopr2
|
||||
add esi,2
|
||||
add edi,2
|
||||
loop .loop
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
.drawwin
|
||||
mov ebp,[cwinptr]
|
||||
mov byte[esi],cl
|
||||
.nodrawbw
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop2
|
||||
mov al,[esi+288*2]
|
||||
test byte[ebp],0FFh
|
||||
jnz .nopr2b
|
||||
test al,80h
|
||||
jz .nopr2b
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bcl+eax*4]
|
||||
cmp dx,0
|
||||
je .noadd2
|
||||
and ebx,[vesa2_clbit]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
.noadd2
|
||||
mov [esi],bx
|
||||
.nopr2b
|
||||
add esi,2
|
||||
add edi,2
|
||||
inc ebp
|
||||
loop .loop2
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
|
||||
extbg2add:
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawwin
|
||||
.domosaic
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop
|
||||
mov al,[esi+288*2]
|
||||
test al,80h
|
||||
jz .nopr2
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bcl+eax*4]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
mov [esi],bx
|
||||
.nopr2
|
||||
add esi,2
|
||||
add edi,2
|
||||
loop .loop
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
.drawwin
|
||||
mov ebp,[cwinptr]
|
||||
mov byte[esi],cl
|
||||
.nodrawbw
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop2
|
||||
mov al,[esi+288*2]
|
||||
test byte[ebp],0FFh
|
||||
jnz .nopr2b
|
||||
test al,80h
|
||||
jz .nopr2b
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bcl+eax*4]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
mov [esi],bx
|
||||
.nopr2b
|
||||
add esi,2
|
||||
add edi,2
|
||||
inc ebp
|
||||
loop .loop2
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
|
||||
extbg2sub:
|
||||
cmp byte[curmosaicsz],1
|
||||
jne .domosaic
|
||||
cmp byte[winon],0
|
||||
jne near .drawwin
|
||||
.domosaic
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop
|
||||
mov al,[esi+288*2]
|
||||
test al,80h
|
||||
jz .nopr2
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bxcl+eax*4]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
xor ebx,0FFFFh
|
||||
mov [esi],bx
|
||||
.nopr2
|
||||
add esi,2
|
||||
add edi,2
|
||||
loop .loop
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
.drawwin
|
||||
mov ebp,[cwinptr]
|
||||
mov byte[esi],cl
|
||||
.nodrawbw
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop2
|
||||
mov al,[esi+288*2]
|
||||
test byte[ebp],0FFh
|
||||
jnz .nopr2b
|
||||
test al,80h
|
||||
jz .nopr2b
|
||||
and al,7Fh
|
||||
mov edx,[edi]
|
||||
mov ebx,[pal16bxcl+eax*4]
|
||||
and edx,[vesa2_clbit]
|
||||
add ebx,edx
|
||||
shr ebx,1
|
||||
mov ebx,[fulladdtab+ebx*2]
|
||||
xor ebx,0FFFFh
|
||||
mov [esi],bx
|
||||
.nopr2b
|
||||
add esi,2
|
||||
add edi,2
|
||||
inc ebp
|
||||
loop .loop2
|
||||
xor eax,eax
|
||||
mov dh,byte[curmosaicsz]
|
||||
cmp dh,1
|
||||
jne near domosaic16b
|
||||
ret
|
||||
|
||||
3085
zsnes/src/video/makev16b.asm
Normal file
3085
zsnes/src/video/makev16b.asm
Normal file
File diff suppressed because it is too large
Load Diff
5313
zsnes/src/video/makev16t.asm
Normal file
5313
zsnes/src/video/makev16t.asm
Normal file
File diff suppressed because it is too large
Load Diff
4386
zsnes/src/video/makevid.asm
Normal file
4386
zsnes/src/video/makevid.asm
Normal file
File diff suppressed because it is too large
Load Diff
818
zsnes/src/video/mode7.asm
Normal file
818
zsnes/src/video/mode7.asm
Normal file
@@ -0,0 +1,818 @@
|
||||
;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 mode7tab,winptrref,nglogicval,winlogicaval
|
||||
EXTSYM curmosaicsz,curvidoffset,cwinptr,domosaic,mode7A,mode7B
|
||||
EXTSYM mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama,winon,xtravbuf
|
||||
EXTSYM ngwinen, winbg1enval, BuildWindow, ngwintable, ngcwinptr, domosaicng
|
||||
EXTSYM pesimpng
|
||||
EXTSYM mode7hr
|
||||
EXTSYM BGMA, mode7ab, mode7cd, BG1SYl, BG1SXl, mosenng, mosszng
|
||||
|
||||
%include "video/mode7.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov byte[esi],dl
|
||||
%%nodrawb
|
||||
inc esi
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Window 0
|
||||
or dl,dl
|
||||
jz %%nodrawbw
|
||||
test byte[ebp],0FFh
|
||||
jnz %%nodrawbw
|
||||
mov byte[esi],dl
|
||||
%%nodrawbw
|
||||
inc esi
|
||||
inc ebp
|
||||
%endmacro
|
||||
|
||||
NEWSYM Makemode7Table
|
||||
xor eax,eax
|
||||
.nextentry
|
||||
mov cl,al
|
||||
mov dl,ah
|
||||
and cl,07h
|
||||
and dl,07h
|
||||
shl cl,4
|
||||
shl dl,1
|
||||
inc dl
|
||||
add dl,cl
|
||||
mov [mode7tab+eax],dl
|
||||
dec ax
|
||||
jnz .nextentry
|
||||
ret
|
||||
|
||||
;mode7tab times 65536 db 0
|
||||
|
||||
; backup mode7X0, mode7Y0, Mode7A, and Mode7B
|
||||
NEWSYM drawmode7
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+16
|
||||
mov ecx,64
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+16
|
||||
.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
|
||||
|
||||
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, domosaic, 1
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic, 1
|
||||
|
||||
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, domosaic, 1
|
||||
.nextval3w
|
||||
Mode7ProcessB Mode7Window, domosaic, 1
|
||||
|
||||
|
||||
NEWSYM drawmode7win
|
||||
cmp byte[mode7hr+ebx],1
|
||||
je near drawmode7winhr
|
||||
ProcessBuildWindow 0
|
||||
.nohr
|
||||
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov [pesimpng],esi
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+16
|
||||
mov ecx,64
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+16
|
||||
.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
|
||||
|
||||
cmp byte[ngwinen],1
|
||||
je near .drawmode7win
|
||||
|
||||
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, domosaicng, 1
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaicng, 1
|
||||
|
||||
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 ebx,[.mode7xrpos]
|
||||
mov [mode7xrpos],ebx
|
||||
mov ebx,[.mode7yrpos]
|
||||
mov [mode7yrpos],ebx
|
||||
mov ebx,[.mode7xadder]
|
||||
mov [mode7xadder],ebx
|
||||
mov ebx,[.mode7yadder]
|
||||
mov [mode7yadder],ebx
|
||||
mov ebx,[.mode7xpos]
|
||||
mov [mode7xpos],ebx
|
||||
mov ebx,[.mode7ypos]
|
||||
mov [mode7ypos],ebx
|
||||
|
||||
mov edi,[vram]
|
||||
Mode7Processngw Mode7Normal, domosaicng, 1
|
||||
|
||||
NEWSYM drawmode7winB
|
||||
cmp byte[mode7hr+ebx],1
|
||||
je near drawmode7winBhr
|
||||
ProcessBuildWindow 0
|
||||
.nohr
|
||||
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
Mode7CalculateB
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+16
|
||||
mov ecx,64
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+16
|
||||
.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
|
||||
|
||||
cmp byte[ngwinen],1
|
||||
je near .drawmode7win
|
||||
|
||||
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, domosaic, 1
|
||||
.nextval3
|
||||
Mode7ProcessB Mode7Normal, domosaic, 1
|
||||
|
||||
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 ebx,[.mode7xrpos]
|
||||
mov [mode7xrpos],ebx
|
||||
mov ebx,[.mode7yrpos]
|
||||
mov [mode7yrpos],ebx
|
||||
mov ebx,[.mode7xpos]
|
||||
mov [mode7xpos],ebx
|
||||
mov ebx,[.mode7ypos]
|
||||
mov [mode7ypos],ebx
|
||||
mov ebx,[.mode7xadder]
|
||||
mov [mode7xadder],ebx
|
||||
mov ebx,[.mode7yadder]
|
||||
mov [mode7yadder],ebx
|
||||
|
||||
mov edi,[vram]
|
||||
Mode7Processngw Mode7Normal, domosaic, 1
|
||||
|
||||
NEWSYM drawmode7winhr
|
||||
ProcessBuildWindow 0
|
||||
|
||||
cmp byte[ngwinen],1
|
||||
jne .notwinen
|
||||
mov byte[mode7hr+ebx],0
|
||||
jmp drawmode7win.nohr
|
||||
.notwinen
|
||||
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
Mode7Calculate
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov [pesimpng],esi
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+16
|
||||
mov ecx,64
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+16
|
||||
.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
|
||||
|
||||
sar dword[.mode7xadder],1
|
||||
sar dword[.mode7yadder],1
|
||||
|
||||
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
|
||||
Mode7Processhr Mode7Normal, domosaicng, 1
|
||||
.nextval3
|
||||
Mode7ProcessBhr Mode7Normal, domosaicng, 1
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.temp2 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
|
||||
|
||||
NEWSYM drawmode7winBhr
|
||||
ProcessBuildWindow 0
|
||||
|
||||
cmp byte[ngwinen],1
|
||||
jne .notwinen
|
||||
mov byte[mode7hr+ebx],0
|
||||
jmp drawmode7winB.nohr
|
||||
.notwinen
|
||||
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
Mode7CalculateB
|
||||
|
||||
; esi = pointer to video buffer
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
cmp byte[curmosaicsz],1
|
||||
je .nomosaic
|
||||
mov esi,xtravbuf+16
|
||||
mov ecx,64
|
||||
.clearnext
|
||||
mov dword[esi],0
|
||||
add esi,4
|
||||
dec ecx
|
||||
jnz .clearnext
|
||||
mov esi,xtravbuf+16
|
||||
.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
|
||||
|
||||
sar dword[.mode7xadder],1
|
||||
sar dword[.mode7yadder],1
|
||||
|
||||
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
|
||||
Mode7Processhr Mode7Normal, domosaic, 1
|
||||
.nextval3
|
||||
Mode7ProcessBhr Mode7Normal, domosaic, 1
|
||||
|
||||
ALIGN32
|
||||
.temp dd 0 ; for byte move left
|
||||
.temp2 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
|
||||
|
||||
ALIGN32
|
||||
NEWSYM ngwleft, dd 0 ; for byte move left
|
||||
NEWSYM ngwleftb, dd 0 ; for byte move left
|
||||
NEWSYM mode7xpos, dd 0,0 ; x position
|
||||
NEWSYM mode7ypos, dd 0,0 ; x position
|
||||
NEWSYM mode7xrpos, dd 0,0 ; x position, relative
|
||||
NEWSYM mode7yrpos, dd 0,0 ; y position, relative
|
||||
NEWSYM mode7xadder, dd 0,0 ; number to add for x
|
||||
NEWSYM mode7yadder, dd 0,0 ; number to add for y
|
||||
|
||||
NEWSYM ProcessMode7ngwin
|
||||
mov ecx,[ngcwinptr]
|
||||
mov ecx,[ecx]
|
||||
or ecx,ecx
|
||||
jz near .winb
|
||||
cmp ecx,[ngwleft]
|
||||
jae .alldisplay
|
||||
sub [ngwleft],ecx
|
||||
mov dword[ngwleftb],ecx
|
||||
xor ecx,ecx
|
||||
mov eax,[mode7xrpos]
|
||||
ret
|
||||
.alldisplay
|
||||
mov ecx,[ngwleft]
|
||||
mov dword[ngwleftb],ecx
|
||||
mov dword[ngwleft],0
|
||||
xor ecx,ecx
|
||||
mov eax,[mode7xrpos]
|
||||
ret
|
||||
.winb
|
||||
NEWSYM ProcessMode7ngwinB
|
||||
add dword[ngcwinptr],4
|
||||
mov ecx,[ngcwinptr]
|
||||
mov ecx,[ecx]
|
||||
cmp ecx,[ngwleft]
|
||||
jae near .finishmode7
|
||||
sub [ngwleft],ecx
|
||||
or ecx,ecx
|
||||
jz .noclip
|
||||
.nextvalngw
|
||||
mov eax,[mode7xadder]
|
||||
add [mode7xrpos],eax
|
||||
mov eax,[mode7yadder]
|
||||
sub [mode7yrpos],eax
|
||||
inc esi
|
||||
dec ecx
|
||||
jnz near .nextvalngw
|
||||
.noclip
|
||||
add dword[ngcwinptr],4
|
||||
jmp ProcessMode7ngwin
|
||||
.finishmode7
|
||||
mov dword[ngwleft],0
|
||||
mov dword[ngwleftb],0
|
||||
ret
|
||||
|
||||
NEWSYM ProcessMode7ngwinC
|
||||
mov ecx,[ngcwinptr]
|
||||
mov ecx,[ecx]
|
||||
or ecx,ecx
|
||||
jz near .winb
|
||||
cmp ecx,[ngwleft]
|
||||
jae .alldisplay
|
||||
sub [ngwleft],ecx
|
||||
mov dword[ngwleftb],ecx
|
||||
xor ecx,ecx
|
||||
mov eax,[mode7xpos]
|
||||
ret
|
||||
.alldisplay
|
||||
mov ecx,[ngwleft]
|
||||
mov dword[ngwleftb],ecx
|
||||
mov dword[ngwleft],0
|
||||
xor ecx,ecx
|
||||
mov eax,[mode7xpos]
|
||||
ret
|
||||
.winb
|
||||
NEWSYM ProcessMode7ngwinD
|
||||
add dword[ngcwinptr],4
|
||||
mov ecx,[ngcwinptr]
|
||||
mov ecx,[ecx]
|
||||
cmp ecx,[ngwleft]
|
||||
jae near .finishmode7
|
||||
sub [ngwleft],ecx
|
||||
or ecx,ecx
|
||||
jz .noclip
|
||||
.nextvalngw
|
||||
mov eax,[mode7xadder]
|
||||
add [mode7xpos],eax
|
||||
mov eax,[mode7yadder]
|
||||
sub [mode7ypos],eax
|
||||
inc esi
|
||||
dec ecx
|
||||
jnz near .nextvalngw
|
||||
.noclip
|
||||
add dword[ngcwinptr],4
|
||||
jmp ProcessMode7ngwin
|
||||
.finishmode7
|
||||
mov dword[ngwleft],0
|
||||
mov dword[ngwleftb],0
|
||||
ret
|
||||
|
||||
%macro newvaluepred 2
|
||||
mov dx,word[%1+ebx*4+8]
|
||||
cmp dx,word[%1+ebx*4]
|
||||
je %%nodivide
|
||||
cmp byte[BGMA+ebx+2],7
|
||||
je %%mode7scaleb
|
||||
%%nodivide
|
||||
movsx edx,word[%1+ebx*4+4]
|
||||
movsx ecx,word[%1+ebx*4]
|
||||
add ecx,edx
|
||||
sar ecx,1
|
||||
mov [%2],cx
|
||||
jmp %%mode7scalend
|
||||
%%mode7scaleb
|
||||
mov esi,ebx
|
||||
movsx ebx,word[%1+esi*4+8]
|
||||
movsx edx,word[%1+esi*4]
|
||||
sub ebx,edx
|
||||
movsx ecx,word[%1+esi*4+4]
|
||||
sub ecx,edx
|
||||
mov eax,ecx
|
||||
imul ecx
|
||||
idiv ebx
|
||||
add ax,word[%1+esi*4]
|
||||
mov ebx,esi
|
||||
mov [%2],ax
|
||||
%%mode7scalend
|
||||
%endmacro
|
||||
|
||||
NEWSYM processmode7hires
|
||||
cmp byte[BGMA+ebx+1],7
|
||||
jne near .nogo
|
||||
|
||||
push esi
|
||||
push ebx
|
||||
; predict new values
|
||||
push eax
|
||||
push edx
|
||||
push ebx
|
||||
push esi
|
||||
newvaluepred mode7ab,mode7A
|
||||
newvaluepred mode7ab+2,mode7B
|
||||
newvaluepred mode7cd,mode7C
|
||||
newvaluepred mode7cd+2,mode7D
|
||||
pop esi
|
||||
pop ebx
|
||||
pop edx
|
||||
pop eax
|
||||
|
||||
mov ecx,edx
|
||||
xor edx,edx
|
||||
mov dx,[BG1SXl+ebx*2+2]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,ebx
|
||||
inc eax
|
||||
test byte[mode7set],02h
|
||||
jz .noflip
|
||||
mov eax,261
|
||||
sub eax,ebx
|
||||
.noflip
|
||||
add ax,[BG1SYl+ebx*2+2]
|
||||
add eax,ecx
|
||||
|
||||
add esi,75036
|
||||
mov [curvidoffset],esi
|
||||
call drawmode7winB
|
||||
pop ebx
|
||||
pop esi
|
||||
.nogo
|
||||
ret
|
||||
|
||||
1563
zsnes/src/video/mode7.mac
Normal file
1563
zsnes/src/video/mode7.mac
Normal file
File diff suppressed because it is too large
Load Diff
687
zsnes/src/video/mode716.asm
Normal file
687
zsnes/src/video/mode716.asm
Normal file
@@ -0,0 +1,687 @@
|
||||
;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 mode7tab,winptrref,nglogicval,winlogicaval
|
||||
EXTSYM curmosaicsz,curvidoffset,cwinptr,domosaic,mode7A,mode7B
|
||||
EXTSYM mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama,winon,xtravbuf
|
||||
EXTSYM ngwleft,ngwleftb,mode7xpos,mode7ypos,mode7xrpos,mode7yrpos
|
||||
EXTSYM mode7xadder,mode7yadder,mode7hr,drawmode7winhr,dcolortab
|
||||
EXTSYM UnusedBitXor,UnusedBit
|
||||
EXTSYM scrndis
|
||||
EXTSYM vidbright,prevbrightdc,Gendcolortable
|
||||
EXTSYM mode7ab,mode7cd,BGMA
|
||||
EXTSYM BG1SXl,BG1SYl
|
||||
EXTSYM processmode7hires
|
||||
|
||||
%include "video/mode716.mac"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;*******************************************************
|
||||
; Processes & Draws Mode 7
|
||||
;*******************************************************
|
||||
|
||||
%macro Mode7Normal 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2+512]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalmsnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalmst 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2+512]
|
||||
mov [esi],dx
|
||||
and dx,[UnusedBitXor]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalsnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Normalst 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Direct 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
or dx,[UnusedBit]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directmsnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi],dx
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directmst 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi+75036*2],dx
|
||||
or dx,[UnusedBit]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directsnt 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7Directst 0
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
mov dx,[dcolortab+edx*4]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBG 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGnt 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGt 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2+512]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGmsnt 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi],dx
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGmst 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2+512]
|
||||
mov [esi+75036*2],dx
|
||||
or dx,[UnusedBit]
|
||||
mov [esi],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGsnt 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
%macro Mode7ExtBGst 0
|
||||
mov [esi+75036*8],dl
|
||||
or dl,dl
|
||||
jz %%nodrawb
|
||||
test dl,80h
|
||||
jnz %%nodrawb
|
||||
mov dx,[ebp+edx*2]
|
||||
mov [esi+75036*2],dx
|
||||
xor edx,edx
|
||||
%%nodrawb
|
||||
add esi,2
|
||||
%endmacro
|
||||
|
||||
NEWSYM drawmode7win16b
|
||||
test byte[scrndis],1
|
||||
jz .notdisabled
|
||||
ret
|
||||
.notdisabled
|
||||
CheckTransparency 01h,drawmode7win16bt
|
||||
normal
|
||||
Mode7NonMainSub Mode7Normal
|
||||
drawmode7win16bt
|
||||
test byte[scadtng+ebx],1h
|
||||
jz near drawmode7win16bnt
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawmode716bmst
|
||||
Mode7NonMainSub Mode7Normalt
|
||||
drawmode716bmst:
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmt
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bst
|
||||
drawmode7w16bmst
|
||||
Mode7NonMainSub Mode7Normalmst
|
||||
drawmode7w16bmt
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmst
|
||||
Mode7MainSub Mode7Normalmst,Mode7Normalst
|
||||
drawmode7w16bst
|
||||
Mode7MainSub Mode7Normalmst,Mode7Normalt
|
||||
drawmode7win16bnt:
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawsprngm716bmsnt
|
||||
Mode7NonMainSub Mode7Normalnt
|
||||
drawsprngm716bmsnt:
|
||||
cmp dword[ngwinen],0
|
||||
je drawmode7w16bmsnt
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmnt
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bsnt
|
||||
drawmode7w16bmsnt
|
||||
Mode7NonMainSub Mode7Normalmsnt
|
||||
drawmode7w16bmnt
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmsnt
|
||||
Mode7MainSub Mode7Normalmsnt,Mode7Normalsnt
|
||||
drawmode7w16bsnt
|
||||
Mode7MainSub Mode7Normalmsnt,Mode7Normalnt
|
||||
|
||||
NEWSYM drawmode7win16bd
|
||||
test byte[scrndis],1
|
||||
jz .notdisabled
|
||||
ret
|
||||
.notdisabled
|
||||
mov bl,[vidbright]
|
||||
cmp bl,[prevbrightdc]
|
||||
je .nodcchange
|
||||
mov [prevbrightdc],bl
|
||||
call Gendcolortable
|
||||
.nodcchange
|
||||
CheckTransparency 01h,drawmode7win16btd
|
||||
Mode7NonMainSub Mode7Direct
|
||||
drawmode7win16btd
|
||||
test byte[scadtng+ebx],1h
|
||||
jz near drawmode7win16bntd
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawmode716bmstd
|
||||
Mode7NonMainSub Mode7Directt
|
||||
drawmode716bmstd:
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmtd
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bstd
|
||||
drawmode7w16bmstd
|
||||
Mode7NonMainSub Mode7Directmst
|
||||
drawmode7w16bmtd
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmstd
|
||||
Mode7MainSub Mode7Directmst,Mode7Directst
|
||||
drawmode7w16bstd
|
||||
Mode7MainSub Mode7Directmst,Mode7Directt
|
||||
drawmode7win16bntd:
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawsprngm716bmsntd
|
||||
Mode7NonMainSub Mode7Directnt
|
||||
drawsprngm716bmsntd:
|
||||
cmp dword[ngwinen],0
|
||||
je drawmode7w16bmsntd
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmntd
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bsntd
|
||||
drawmode7w16bmsntd
|
||||
Mode7NonMainSub Mode7Directmsnt
|
||||
drawmode7w16bmntd
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmsntd
|
||||
Mode7MainSub Mode7Directmsnt,Mode7Directsnt
|
||||
drawmode7w16bsntd
|
||||
Mode7MainSub Mode7Directmsnt,Mode7Directnt
|
||||
|
||||
|
||||
NEWSYM drawmode7ngextbg16b
|
||||
test byte[scrndis],1
|
||||
jz .notdisabled
|
||||
ret
|
||||
.notdisabled
|
||||
mov byte[curmosaicsz],1
|
||||
push ecx
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov ecx,256
|
||||
.loop
|
||||
mov byte[esi+75036*8],0
|
||||
add esi,2
|
||||
loop .loop
|
||||
pop ecx
|
||||
|
||||
cmp byte[mode7hr+ebx],1
|
||||
; je near drawmode7winextbghr16e
|
||||
CheckTransparency 02h,drawmode7win16bte
|
||||
mov esi,[cwinptr]
|
||||
mov [winptrref],esi
|
||||
mov esi,[curvidoffset]
|
||||
Mode7NonMainSube Mode7ExtBG
|
||||
drawmode7win16bte
|
||||
test byte[scadtng+ebx],1h
|
||||
jz near drawmode7win16bnte
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawmode716bmste
|
||||
Mode7NonMainSube Mode7ExtBGt
|
||||
drawmode716bmste:
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmte
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bste
|
||||
drawmode7w16bmste
|
||||
Mode7NonMainSube Mode7ExtBGmst
|
||||
drawmode7w16bmte
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmste
|
||||
Mode7MainSube Mode7ExtBGmst,Mode7ExtBGst
|
||||
drawmode7w16bste
|
||||
Mode7MainSube Mode7ExtBGmst,Mode7ExtBGt
|
||||
drawmode7win16bnte:
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawsprngm716bmsnte
|
||||
Mode7NonMainSube Mode7ExtBGnt
|
||||
drawsprngm716bmsnte:
|
||||
cmp dword[ngwinen],0
|
||||
je drawmode7w16bmsnte
|
||||
mov edi,[CMainWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmnte
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bsnte
|
||||
drawmode7w16bmsnte
|
||||
Mode7NonMainSube Mode7ExtBGmsnt
|
||||
drawmode7w16bmnte
|
||||
mov edi,[CSubWinScr]
|
||||
cmp byte[edi+ebx],0
|
||||
jne near drawmode7w16bmsnte
|
||||
Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGsnt
|
||||
drawmode7w16bsnte
|
||||
Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGnt
|
||||
|
||||
%macro ExtBG2 1
|
||||
mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16
|
||||
mov ecx,256
|
||||
xor eax,eax
|
||||
.loop
|
||||
mov al,[esi+75036*8]
|
||||
test al,80h
|
||||
jz .nopr2
|
||||
and al,7Fh
|
||||
%1
|
||||
.nopr2
|
||||
add esi,2
|
||||
loop .loop
|
||||
xor eax,eax
|
||||
ret
|
||||
%endmacro
|
||||
|
||||
%macro ExtBGNormal 0
|
||||
mov dx,[ebp+eax*2]
|
||||
mov [esi],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalt 0
|
||||
mov dx,[ebp+eax*2+512]
|
||||
mov [esi],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalnt 0
|
||||
mov dx,[ebp+eax*2]
|
||||
mov [esi],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalst 0
|
||||
mov dx,[ebp+eax*2]
|
||||
mov [esi+75036*2],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalsnt 0
|
||||
mov dx,[ebp+eax*2]
|
||||
mov [esi+75036*2],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalmst 0
|
||||
mov dx,[ebp+eax*2+512]
|
||||
mov [esi],dx
|
||||
and dx,[UnusedBitXor]
|
||||
mov [esi+75036*2],dx
|
||||
%endmacro
|
||||
%macro ExtBGNormalmsnt 0
|
||||
mov dx,[ebp+eax*2]
|
||||
mov [esi],dx
|
||||
mov [esi+75036*2],dx
|
||||
%endmacro
|
||||
|
||||
NEWSYM drawmode7ngextbg216b
|
||||
test byte[scrndis],1
|
||||
jz .notdisabled
|
||||
ret
|
||||
.notdisabled
|
||||
cmp byte[mode7hr+ebx],1
|
||||
; je near drawmode7winextbg2hr16b
|
||||
; esi = pointer to video buffer
|
||||
CheckTransparency 01h,drawmode7ngextbg216bt
|
||||
test byte[FillSubScr+ebx],1
|
||||
jz .main
|
||||
test byte[BGMS1+ebx*2],01h
|
||||
jnz .main
|
||||
add esi,75036*2
|
||||
.main
|
||||
ExtBG2 ExtBGNormal
|
||||
drawmode7ngextbg216bt:
|
||||
test byte[scadtng+ebx],1h
|
||||
jz near drawmode7ngextbg216bnt
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawmode7ngextbg216bmst
|
||||
ExtBG2 ExtBGNormalt
|
||||
drawmode7ngextbg216bmst
|
||||
test byte[BGMS1+ebx*2],1h
|
||||
jz near drawmode7ngextbg216bst
|
||||
ExtBG2 ExtBGNormalmst
|
||||
drawmode7ngextbg216bst:
|
||||
ExtBG2 ExtBGNormalst
|
||||
drawmode7ngextbg216bnt:
|
||||
test byte[BGMS1+ebx*2+1],1h
|
||||
jnz near drawmode7ngextbg216bmsnt
|
||||
ExtBG2 ExtBGNormalnt
|
||||
drawmode7ngextbg216bmsnt
|
||||
test byte[BGMS1+ebx*2],1h
|
||||
jz near drawmode7ngextbg216bsnt
|
||||
ExtBG2 ExtBGNormalmsnt
|
||||
drawmode7ngextbg216bsnt:
|
||||
ExtBG2 ExtBGNormalsnt
|
||||
|
||||
ALIGN32
|
||||
mtemp dd 0 ; for byte move left
|
||||
mmode7xpos dd 0 ; x position
|
||||
mtempa2 dd 0 ; keep this blank!
|
||||
mmode7xrpos dd 0 ; x position
|
||||
mtempa dd 0 ; keep this blank!
|
||||
mmode7ypos dd 0 ; y position
|
||||
mtempb2 dd 0 ; keep this blank!
|
||||
mmode7yrpos dd 0 ; y position
|
||||
mtempb dd 0 ; keep this blank!
|
||||
mmode7xadder dd 0 ; number to add for x
|
||||
mtempc2 dd 0 ; keep this blank!
|
||||
mmode7xadd2 dd 0 ; number to add for x
|
||||
mtempc dd 0 ; keep this blank!
|
||||
mmode7yadder dd 0 ; number to add for y
|
||||
mtempd2 dd 0 ; keep this blank!
|
||||
mmode7yadd2 dd 0 ; number to add for y
|
||||
mtempd dd 0 ; keep this blank!
|
||||
mmode7ptr dd 0 ; pointer value
|
||||
mmode7xinc dd 0 ; number to add for x
|
||||
mmode7xincc dd 0 ; range check for x
|
||||
mmode7yinc dd 0 ; number to add for y
|
||||
mmode7xsloc dd 0 ; which screen x
|
||||
mmode7ysloc dd 0 ; which screen y
|
||||
mmode7xsrl dd 0 ; which relative screen x
|
||||
mmode7ysrl dd 0 ; which relative screen y
|
||||
mcxloc dw 0 ; cx location
|
||||
mcyloc dw 0 ; cy location
|
||||
M7HROn dd 0 ; High Resolution On
|
||||
switchtorep3 dd 0
|
||||
|
||||
m7xaddof dd 0
|
||||
m7xaddof2 dd 0
|
||||
m7yaddof dd 0
|
||||
m7yaddof2 dd 0
|
||||
pixelsleft dd 0
|
||||
mm7xaddof dd 0
|
||||
mm7xaddof2 dd 0
|
||||
mm7yaddof dd 0
|
||||
mm7yaddof2 dd 0
|
||||
|
||||
%macro newvaluepred 2
|
||||
mov dx,word[%1+ebx*4+8]
|
||||
cmp dx,word[%1+ebx*4]
|
||||
je %%nodivide
|
||||
cmp byte[BGMA+ebx+2],7
|
||||
je %%mode7scaleb
|
||||
%%nodivide
|
||||
movsx edx,word[%1+ebx*4+4]
|
||||
movsx ecx,word[%1+ebx*4]
|
||||
add ecx,edx
|
||||
sar ecx,1
|
||||
mov [%2],cx
|
||||
jmp %%mode7scalend
|
||||
%%mode7scaleb
|
||||
mov esi,ebx
|
||||
movsx ebx,word[%1+esi*4+8]
|
||||
movsx edx,word[%1+esi*4]
|
||||
sub ebx,edx
|
||||
movsx ecx,word[%1+esi*4+4]
|
||||
sub ecx,edx
|
||||
mov eax,ecx
|
||||
imul ecx
|
||||
idiv ebx
|
||||
add ax,word[%1+esi*4]
|
||||
mov ebx,esi
|
||||
mov [%2],ax
|
||||
%%mode7scalend
|
||||
%endmacro
|
||||
|
||||
CalculateNewValues:
|
||||
; predict new values
|
||||
push eax
|
||||
push edx
|
||||
push ebx
|
||||
push esi
|
||||
newvaluepred mode7ab,mode7A
|
||||
newvaluepred mode7ab+2,mode7B
|
||||
newvaluepred mode7cd,mode7C
|
||||
newvaluepred mode7cd+2,mode7D
|
||||
pop esi
|
||||
pop ebx
|
||||
pop edx
|
||||
pop eax
|
||||
|
||||
mov ecx,edx
|
||||
xor edx,edx
|
||||
mov dx,[BG1SXl+ebx*2+2]
|
||||
add edx,ecx
|
||||
shr edx,1
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,ebx
|
||||
inc eax
|
||||
test byte[mode7set],02h
|
||||
jz .noflip
|
||||
mov eax,261
|
||||
sub eax,ebx
|
||||
.noflip
|
||||
add ax,[BG1SYl+ebx*2+2]
|
||||
add eax,ecx
|
||||
ret
|
||||
|
||||
|
||||
NEWSYM processmode7hires16b
|
||||
cmp byte[BGMA+ebx+1],7
|
||||
jne near .nogo
|
||||
push esi
|
||||
push ebx
|
||||
call CalculateNewValues
|
||||
add esi,75036*4
|
||||
mov [curvidoffset],esi
|
||||
mov dword[M7HROn],1
|
||||
call drawmode7win16b
|
||||
mov dword[M7HROn],0
|
||||
pop ebx
|
||||
pop esi
|
||||
.nogo
|
||||
ret
|
||||
|
||||
NEWSYM processmode7hires16bd
|
||||
cmp byte[BGMA+ebx+1],7
|
||||
jne near .nogo
|
||||
push esi
|
||||
push ebx
|
||||
call CalculateNewValues
|
||||
add esi,75036*4
|
||||
mov [curvidoffset],esi
|
||||
mov dword[M7HROn],1
|
||||
call drawmode7win16bd
|
||||
mov dword[M7HROn],0
|
||||
pop ebx
|
||||
pop esi
|
||||
.nogo
|
||||
ret
|
||||
|
||||
|
||||
1904
zsnes/src/video/mode716.mac
Normal file
1904
zsnes/src/video/mode716.mac
Normal file
File diff suppressed because it is too large
Load Diff
189
zsnes/src/video/mode716b.asm
Normal file
189
zsnes/src/video/mode716b.asm
Normal file
@@ -0,0 +1,189 @@
|
||||
;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
|
||||
|
||||
233
zsnes/src/video/mode716d.asm
Normal file
233
zsnes/src/video/mode716d.asm
Normal file
@@ -0,0 +1,233 @@
|
||||
;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
|
||||
|
||||
1261
zsnes/src/video/mode716e.asm
Normal file
1261
zsnes/src/video/mode716e.asm
Normal file
File diff suppressed because it is too large
Load Diff
364
zsnes/src/video/mode716t.asm
Normal file
364
zsnes/src/video/mode716t.asm
Normal file
@@ -0,0 +1,364 @@
|
||||
;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
|
||||
|
||||
|
||||
326
zsnes/src/video/mode7cal.inc
Normal file
326
zsnes/src/video/mode7cal.inc
Normal file
@@ -0,0 +1,326 @@
|
||||
;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
|
||||
|
||||
|
||||
1318
zsnes/src/video/mode7ext.asm
Normal file
1318
zsnes/src/video/mode7ext.asm
Normal file
File diff suppressed because it is too large
Load Diff
1502
zsnes/src/video/mv16tms.asm
Normal file
1502
zsnes/src/video/mv16tms.asm
Normal file
File diff suppressed because it is too large
Load Diff
1402
zsnes/src/video/newg162.asm
Normal file
1402
zsnes/src/video/newg162.asm
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user