Removed superfluous ^Z at the end of files

This commit is contained in:
teuf
2001-04-05 13:27:14 +00:00
parent dffb25d0ef
commit 5cbbb9d4da
143 changed files with 184758 additions and 184882 deletions

View File

@@ -1,57 +1,57 @@
Compiling the Source Code:
--------------------------
Well, for the moment, zsnes sources may be a little hard to compile. Here
is a quick guide (based on my own experience and on a doc written by zsKnight)
explaining how to compile zsnes. With these tools, I can build both dos and
win version, I hope it will also work for you
First, you need the following software:
Dos port :
- NASM v0.98 : http://www.cryogen.com/nasm/
the version found on http://nasm.2y.net/ DOES NOT WORK
with zsnes sources. When you type nasm -r, you must get
'NASM version 0.98' and not 'NASM version 0.98.08' if you
have the correct version
- DJGPP v2 or higher, (GCC also installed) : http://www.delorie.com/djgpp/
using the zip picker, the default choices are ok if you
check C and C++ in the programming languages. You also need
to get zlib which is available with the full distribution
of djgpp. You can get it at :
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/zlib112b.zip
Then to build the executable, go to the src directory and type:
make -f makefile.dos
You may also want to compress zsnes.exe with upx (http://upx.tsx.org), it will
divide its size by 10.
Windows port :
- GNU Make : it comes with djgpp
- NASM v0.98 : http://nasm.2y.net/ or http://www.cryogen.com/nasm/
- MSVC++ 6.0 or higher : not freely available, you'll have to buy it
You need to run VCVARS32.BAT. If you get an
out of environment space error, type 'command /e:32768'
(to create a new command.com entity with more
environment space)
- DX7.0 SDK or higher : you can get it at microsoft.com. It is quite big.
Also, edit makefile.win to set the correct path to your
SDK. I also had some problems with vc++ using its own
(old) directx headers instead of the sdk headers. I replaced
these old headers (in the include directory of vc++ dir)
with the newer ones.
- zlib : http://www.info-zip.org/pub/infozip/zlib/
you need the Win9x/WinNT static library (the dll version doesn't
seem to work with zsnes). Name the static version zlib.lib and
put it somewhere where vc++ will find it (for example, the lib
directory in vc++ dir).
Don't forget to set the correct path to the directx sdk in makefile.win!
Then to build the executable, go to the src directory and type:
make -f makefile.win
You may also want to compress zsnesw.exe with upx (http://upx.tsx.org), it will
divide its size by 10.
Compiling the Source Code:
--------------------------
Well, for the moment, zsnes sources may be a little hard to compile. Here
is a quick guide (based on my own experience and on a doc written by zsKnight)
explaining how to compile zsnes. With these tools, I can build both dos and
win version, I hope it will also work for you
First, you need the following software:
Dos port :
- NASM v0.98 : http://www.cryogen.com/nasm/
the version found on http://nasm.2y.net/ DOES NOT WORK
with zsnes sources. When you type nasm -r, you must get
'NASM version 0.98' and not 'NASM version 0.98.08' if you
have the correct version
- DJGPP v2 or higher, (GCC also installed) : http://www.delorie.com/djgpp/
using the zip picker, the default choices are ok if you
check C and C++ in the programming languages. You also need
to get zlib which is available with the full distribution
of djgpp. You can get it at :
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/zlib112b.zip
Then to build the executable, go to the src directory and type:
make -f makefile.dos
You may also want to compress zsnes.exe with upx (http://upx.tsx.org), it will
divide its size by 10.
Windows port :
- GNU Make : it comes with djgpp
- NASM v0.98 : http://nasm.2y.net/ or http://www.cryogen.com/nasm/
- MSVC++ 6.0 or higher : not freely available, you'll have to buy it
You need to run VCVARS32.BAT. If you get an
out of environment space error, type 'command /e:32768'
(to create a new command.com entity with more
environment space)
- DX7.0 SDK or higher : you can get it at microsoft.com. It is quite big.
Also, edit makefile.win to set the correct path to your
SDK. I also had some problems with vc++ using its own
(old) directx headers instead of the sdk headers. I replaced
these old headers (in the include directory of vc++ dir)
with the newer ones.
- zlib : http://www.info-zip.org/pub/infozip/zlib/
you need the Win9x/WinNT static library (the dll version doesn't
seem to work with zsnes). Name the static version zlib.lib and
put it somewhere where vc++ will find it (for example, the lib
directory in vc++ dir).
Don't forget to set the correct path to the directx sdk in makefile.win!
Then to build the executable, go to the src directory and type:
make -f makefile.win
You may also want to compress zsnesw.exe with upx (http://upx.tsx.org), it will
divide its size by 10.

View File

@@ -1,6 +1,6 @@
ZSNES Open Source Authors:
--------------------------
zsKnight <zsknight@zsnes.com>
_Demo_ <z_demo_z@users.sourceforge.net>

ZSNES Open Source Authors:
--------------------------
zsKnight <zsknight@zsnes.com>
_Demo_ <z_demo_z@users.sourceforge.net>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,343 +1,342 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1 +0,0 @@


View File

@@ -1,5 +1,5 @@
If you need help to compile zsnes, read install.txt.
If you need help to browse the sources, read srcinfo.txt.
For more information about zsnes development, check http://zsnes.sourceforge.net
The official website is at http://www.zsnes.com
If you need help to compile zsnes, read install.txt.
If you need help to browse the sources, read srcinfo.txt.
For more information about zsnes development, check http://zsnes.sourceforge.net
The official website is at http://www.zsnes.com

View File

@@ -1,29 +1,28 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,89 +1,88 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,365 +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 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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,409 +1,408 @@
;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

;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

View File

@@ -1,405 +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,[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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,101 +1,100 @@
;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

;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

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,51 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,404 +1,403 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,97 +1,96 @@
;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

;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

View File

@@ -1,168 +1,167 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,156 +1,155 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,437 +1,436 @@
;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

;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

View File

@@ -1,226 +1,225 @@
;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

;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

View File

@@ -1,330 +1,329 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,267 +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);
}
//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);
}

View File

@@ -1,396 +1,395 @@
//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;
}

//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;
}

View File

@@ -1,212 +1,211 @@
;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

;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

View File

@@ -1,250 +1,249 @@
;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

;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

View File

@@ -1,411 +1,410 @@
//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
};

//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
};

View File

@@ -1,25 +1,24 @@
//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]

//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]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,190 +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.
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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,499 +1,498 @@
;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

;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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1 @@
/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

/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

View File

@@ -1,48 +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
;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

View File

@@ -1,185 +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

#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

View File

@@ -1,212 +1,211 @@
#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

#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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,289 +1,288 @@
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//#define MMX
#define uint32 unsigned long
#define uint16 unsigned short
#define uint8 unsigned char
static uint32 colorMask = 0xF7DEF7DE;
static uint32 lowPixelMask = 0x08210821;
static uint32 qcolorMask = 0xE79CE79C;
static uint32 qlowpixelMask = 0x18631863;
static uint32 redblueMask = 0xF81F;
static uint32 greenMask = 0x7E0;
extern "C" void Init_2xSaI(uint32 BitFormat)
{
if (BitFormat == 565)
{
colorMask = 0xF7DEF7DE;
lowPixelMask = 0x08210821;
qcolorMask = 0xE79CE79C;
qlowpixelMask = 0x18631863;
redblueMask = 0xF81F;
greenMask = 0x7E0;
}
else
if (BitFormat == 555)
{
colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421;
qcolorMask = 0x739C739C;
qlowpixelMask = 0x0C630C63;
redblueMask = 0x7C1F;
greenMask = 0x3E0;
}
else
{
return;
}
#ifdef MMX
Init_2xSaIMMX(BitFormat);
#endif
return;
}
static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r-=1;
if (y <= 1) r+=1;
return r;
}
static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline uint32 INTERPOLATE(uint32 A, uint32 B)
{
if (A !=B)
{
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
}
else return A;
}
static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
{
register uint32 x = ((A & qcolorMask) >> 2) +
((B & qcolorMask) >> 2) +
((C & qcolorMask) >> 2) +
((D & qcolorMask) >> 2);
register uint32 y = (A & qlowpixelMask) +
(B & qlowpixelMask) +
(C & qlowpixelMask) +
(D & qlowpixelMask);
y = (y>>2) & qlowpixelMask;
return x+y;
}
#define BLUE_MASK565 0x001F001F
#define RED_MASK565 0xF800F800
#define GREEN_MASK565 0x07E007E0
#define BLUE_MASK555 0x001F001F
#define RED_MASK555 0x7C007C00
#define GREEN_MASK555 0x03E003E0
//srcPtr equ 8
//deltaPtr equ 12
//srcPitch equ 16
//width equ 20
//dstOffset equ 24
//dstPitch equ 28
//dstSegment equ 32
extern "C" void Super2xSaI(uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch,
int width, uint8 *dstPtr , uint32 dstPitch)
{
uint16 *dP;
uint16 *bP;
uint32 inc_bP;
int height = 1;
uint32 dPitch = dstPitch >> 1;
uint32 Nextline = srcPitch >> 1;
{
inc_bP = 1;
// for (height; height; height-=1)
{
bP = (uint16 *) srcPtr;
dP = (uint16 *) dstPtr;
for (uint32 finish = width; finish; finish -= inc_bP )
{
uint32 color4, color5, color6;
uint32 color1, color2, color3;
uint32 colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
uint32 product1a, product1b,
product2a, product2b;
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
colorB0 = *(bP- Nextline - 1);
colorB1 = *(bP- Nextline);
colorB2 = *(bP- Nextline + 1);
colorB3 = *(bP- Nextline + 2);
color4 = *(bP - 1);
color5 = *(bP);
color6 = *(bP + 1);
colorS2 = *(bP + 2);
color1 = *(bP + Nextline - 1);
color2 = *(bP + Nextline);
color3 = *(bP + Nextline + 1);
colorS1 = *(bP + Nextline + 2);
colorA0 = *(bP + Nextline + Nextline - 1);
colorA1 = *(bP + Nextline + Nextline);
colorA2 = *(bP + Nextline + Nextline + 1);
colorA3 = *(bP + Nextline + Nextline + 2);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GetResult (color6, color5, color1, colorA1);
r += GetResult (color6, color5, color4, colorB1);
r += GetResult (color6, color5, colorA2, colorS1);
r += GetResult (color6, color5, colorB2, colorS2);
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
else
product2b = INTERPOLATE (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
else
product1b = INTERPOLATE (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE (color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE (color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE(color2, color5);
else
product1a = color5;
product1a = product1a | (product1b << 16);
product2a = product2a | (product2b << 16);
*dP = product1a;
*(dP + 1) = product1b;
*(dP + dPitch) = product2a;
*(dP + dPitch + 1) = product2b;
bP ++;
dP += 2;
}//end of for ( finish= width etc..)
srcPtr += srcPitch;
deltaPtr += srcPitch << 1;
}; //endof: for (height; height; height--)
}
}

//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//#define MMX
#define uint32 unsigned long
#define uint16 unsigned short
#define uint8 unsigned char
static uint32 colorMask = 0xF7DEF7DE;
static uint32 lowPixelMask = 0x08210821;
static uint32 qcolorMask = 0xE79CE79C;
static uint32 qlowpixelMask = 0x18631863;
static uint32 redblueMask = 0xF81F;
static uint32 greenMask = 0x7E0;
extern "C" void Init_2xSaI(uint32 BitFormat)
{
if (BitFormat == 565)
{
colorMask = 0xF7DEF7DE;
lowPixelMask = 0x08210821;
qcolorMask = 0xE79CE79C;
qlowpixelMask = 0x18631863;
redblueMask = 0xF81F;
greenMask = 0x7E0;
}
else
if (BitFormat == 555)
{
colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421;
qcolorMask = 0x739C739C;
qlowpixelMask = 0x0C630C63;
redblueMask = 0x7C1F;
greenMask = 0x3E0;
}
else
{
return;
}
#ifdef MMX
Init_2xSaIMMX(BitFormat);
#endif
return;
}
static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r-=1;
if (y <= 1) r+=1;
return r;
}
static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C) x+=1; else if (B == C) y+=1;
if (A == D) x+=1; else if (B == D) y+=1;
if (x <= 1) r+=1;
if (y <= 1) r-=1;
return r;
}
static inline uint32 INTERPOLATE(uint32 A, uint32 B)
{
if (A !=B)
{
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
}
else return A;
}
static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
{
register uint32 x = ((A & qcolorMask) >> 2) +
((B & qcolorMask) >> 2) +
((C & qcolorMask) >> 2) +
((D & qcolorMask) >> 2);
register uint32 y = (A & qlowpixelMask) +
(B & qlowpixelMask) +
(C & qlowpixelMask) +
(D & qlowpixelMask);
y = (y>>2) & qlowpixelMask;
return x+y;
}
#define BLUE_MASK565 0x001F001F
#define RED_MASK565 0xF800F800
#define GREEN_MASK565 0x07E007E0
#define BLUE_MASK555 0x001F001F
#define RED_MASK555 0x7C007C00
#define GREEN_MASK555 0x03E003E0
//srcPtr equ 8
//deltaPtr equ 12
//srcPitch equ 16
//width equ 20
//dstOffset equ 24
//dstPitch equ 28
//dstSegment equ 32
extern "C" void Super2xSaI(uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch,
int width, uint8 *dstPtr , uint32 dstPitch)
{
uint16 *dP;
uint16 *bP;
uint32 inc_bP;
int height = 1;
uint32 dPitch = dstPitch >> 1;
uint32 Nextline = srcPitch >> 1;
{
inc_bP = 1;
// for (height; height; height-=1)
{
bP = (uint16 *) srcPtr;
dP = (uint16 *) dstPtr;
for (uint32 finish = width; finish; finish -= inc_bP )
{
uint32 color4, color5, color6;
uint32 color1, color2, color3;
uint32 colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
uint32 product1a, product1b,
product2a, product2b;
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
colorB0 = *(bP- Nextline - 1);
colorB1 = *(bP- Nextline);
colorB2 = *(bP- Nextline + 1);
colorB3 = *(bP- Nextline + 2);
color4 = *(bP - 1);
color5 = *(bP);
color6 = *(bP + 1);
colorS2 = *(bP + 2);
color1 = *(bP + Nextline - 1);
color2 = *(bP + Nextline);
color3 = *(bP + Nextline + 1);
colorS1 = *(bP + Nextline + 2);
colorA0 = *(bP + Nextline + Nextline - 1);
colorA1 = *(bP + Nextline + Nextline);
colorA2 = *(bP + Nextline + Nextline + 1);
colorA3 = *(bP + Nextline + Nextline + 2);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GetResult (color6, color5, color1, colorA1);
r += GetResult (color6, color5, color4, colorB1);
r += GetResult (color6, color5, colorA2, colorS1);
r += GetResult (color6, color5, colorB2, colorS2);
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
else
product2b = INTERPOLATE (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
else
product1b = INTERPOLATE (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE (color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE (color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE(color2, color5);
else
product1a = color5;
product1a = product1a | (product1b << 16);
product2a = product2a | (product2b << 16);
*dP = product1a;
*(dP + 1) = product1b;
*(dP + dPitch) = product2a;
*(dP + dPitch + 1) = product2b;
bP ++;
dP += 2;
}//end of for ( finish= width etc..)
srcPtr += srcPitch;
deltaPtr += srcPitch << 1;
}; //endof: for (height; height; height--)
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More